     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  ; test install command: install; s $ psp:0 l 10 CD; s uninstall
     5                                  ; test run command: $ psp:0 l 10 CD; .; .
     6                                  
     7                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     8                                  %include "eld.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELD_MAC
    16                              <1> %define ELD_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> 
    20                              <1> 		; ELD executable header
    21                              <1> 	struc ELD_HEADER
    22 00000000 ????????            <1> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <1> 			resb 3	; reserved
    24 00000007 ??                  <1> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <1> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <1> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <1> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <1> eldhDataOffset:		resd 1
    29 00000014 ????                <1> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <1> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <1> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <1> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <1> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <1> 	endstruc
    35                              <1> 	endarea ELD_HEADER, 1
    36                              <1> 
    37                              <1> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <1> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <1> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <1> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <1> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <1> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <1> 	alignb 16
    44                              <1> 	endstruc
    45                              <1> 
    46                              <1> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <1> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <1> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <1> 				;  add this dword to the seek offset
    50 0000000C ????                <1> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <1> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <1> 	endstruc
    53                              <1> 	endarea ELD_TRAILER_HEADER, 1
    54                              <1> 
    55                              <1> 	struc ELD_LIBTABLE
    56 00000000 ????                <1> eldltFormat:		resw 1
    57                              <1> 	; 0 = uncompressed
    58                              <1> 	; 2 = heatshrink compressed
    59                              <1> 	; 3 = lzexedat -4 compressed
    60                              <1> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <1> eldltAmount:		resw 1
    62 00000004 ????????            <1> eldltOffset:		resd 1	; from eldhxHeader
    63                              <1> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <1> 	endstruc
    65                              <1> 	endarea ELD_LIBTABLE, 1
    66                              <1> 
    67                              <1> 		; ELD instance header
    68                              <1> 	struc ELD_INSTANCE
    69 00000000 ????                <1> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <1> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <1> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <1> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <1> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <1> eldiFlags:		resw 1	; flags
    75                              <1> eldiListing_size equ 14
    76 00000012 <res Eh>            <1> eldiListing:		resb eldiListing_size
    77                              <1> 				; ASCIZ listing file name
    78                              <1> 	endstruc
    79                              <1> 		; flags for eldiFlags:
    80                              <1> eldifResident:		equ 1
    81                              <1> 
    82                              <1> 		; ELD link info header
    83                              <1> 	struc ELD_LINKINFO
    84 00000000 ????                <1> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <1> eldlReserved:		resw 2
    86 00000006 ????                <1> eldlUseLinkHash:	resw 1
    87 00000008 ????                <1> eldlDataAmount:		resw 1
    88 0000000A ????                <1> eldlDataPrefixes:	resw 1
    89 0000000C ????                <1> eldlDataEntries:	resw 1
    90 0000000E ????                <1> eldlDataAddresses:	resw 1
    91 00000010 ????                <1> eldlCodeAmount:		resw 1
    92 00000012 ????                <1> eldlCodePrefixes:	resw 1
    93 00000014 ????                <1> eldlCodeEntries:	resw 1
    94 00000016 ????                <1> eldlCodeAddresses:	resw 1
    95                              <1> 	endstruc
    96                              <1> 
    97                              <1> 	numdef ELD_CODE_VSTART, 9001h
    98                              <1> 	numdef ELD_DATA_VSTART, 8000h
    99                              <1> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <1> 
   101                              <1> 	numdef ELD_RECLAIM_HINT, 0
   102                              <1> 	strdef ELD_LISTING, ""
   103                              <1> 	numdef ELD_DATETIME, 0
   104                              <1> 
   105                              <1> %if _ELD_DATETIME
   106                              <1>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <1>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <1> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <1> 		asciz		; for future extension
   110                              <1>  %endmacro
   111                              <1> %else
   112                              <1>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <1>  %define PUT_ELD_DATETIME
   114                              <1> %endif
   115                              <1> 
   116                              <1> %endif
     9                                  %include "eldcall.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug call macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2024 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDCALL_MAC
    16                              <1> %define ELDCALL_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    19                              <1> %include "nasmhash.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> Hashing macros
     5                              <2>  by E. C. Masloch, 2019
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef __NASMHASH_MAC__
    16                              <2> %assign __NASMHASH_MAC__ 1
    17                              <2> 
    18                              <2> 
    19                              <2> 	%macro hashdef 2+.nolist
    20                              <2> %ifempty %2
    21                              <2>  %assign _%1 1
    22                              <2> %else
    23                              <2> %ifstr %2
    24                              <2>  %define %%string %2
    25                              <2> %elifid %2
    26                              <2>  %defstr %%string %2
    27                              <2> %elifnum %2
    28                              <2>  %defstr %%string %2
    29                              <2> %eliftok %2
    30                              <2>  %defstr %%string %2
    31                              <2> %else
    32                              <2>  %error Unknown input
    33                              <2> %endif
    34                              <2> %strlen %%length %%string
    35                              <2> %assign %%hash 1
    36                              <2> %assign %%index 1
    37                              <2> %rep %%length
    38                              <2>  %substr %%char %%string %%index
    39                              <2>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <2>  %assign %%index %%index + 1
    41                              <2> %endrep
    42                              <2> %assign _%1 %%hash
    43                              <2> %endif
    44                              <2> 	%endmacro
    45                              <2> 
    46                              <2> 
    47                              <2> %endif
    20                              <1> %include "elddata.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug data relocation macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> %include "nasmhash.mac"
     1                              <3> 
     2                              <3> %if 0
     3                              <3> 
     4                              <3> Hashing macros
     5                              <3>  by E. C. Masloch, 2019
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef __NASMHASH_MAC__
    16                              <3> %assign __NASMHASH_MAC__ 1
    17                              <3> 
    18                              <3> 
    19                              <3> 	%macro hashdef 2+.nolist
    20                              <3> %ifempty %2
    21                              <3>  %assign _%1 1
    22                              <3> %else
    23                              <3> %ifstr %2
    24                              <3>  %define %%string %2
    25                              <3> %elifid %2
    26                              <3>  %defstr %%string %2
    27                              <3> %elifnum %2
    28                              <3>  %defstr %%string %2
    29                              <3> %eliftok %2
    30                              <3>  %defstr %%string %2
    31                              <3> %else
    32                              <3>  %error Unknown input
    33                              <3> %endif
    34                              <3> %strlen %%length %%string
    35                              <3> %assign %%hash 1
    36                              <3> %assign %%index 1
    37                              <3> %rep %%length
    38                              <3>  %substr %%char %%string %%index
    39                              <3>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <3>  %assign %%index %%index + 1
    41                              <3> %endrep
    42                              <3> %assign _%1 %%hash
    43                              <3> %endif
    44                              <3> 	%endmacro
    45                              <3> 
    46                              <3> 
    47                              <3> %endif
    20                              <2> %include "eldcheck.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug relocation check macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2023 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELDCHECK_MAC
    16                              <3> %define ELDCHECK_MAC 1
    17                              <3> 
    18                              <3> %assign ELDSTRICT 0
    19                              <3> %assign ELDSTRICTCOUNTER 0
    20                              <3> 
    21                              <3> 	%imacro eldstrict 1.nolist
    22                              <3> %ifidni %1, on
    23                              <3>  %assign ELDSTRICT 1
    24                              <3>  [warning +error=reloc-abs]
    25                              <3>  [warning +reloc-abs]
    26                              <3> %elifidni %1, off
    27                              <3>  %assign ELDSTRICT 0
    28                              <3>  [warning -reloc-abs]
    29                              <3> %else
    30                              <3>  %error Unknown keyword
    31                              <3> %endif
    32                              <3> 	%endmacro
    33                              <3> 
    34                              <3> 	%imacro reloc 1+.nolist
    35                              <3> %if ELDSTRICT
    36                              <3>  %if ELDSTRICTCOUNTER
    37                              <3>   %error Missing relocation
    38                              <3>  %endif
    39                              <3>  [warning -reloc-abs]
    40                              <3>  %assign ELDSTRICTCOUNTER 1
    41                              <3> %endif
    42                              <3> %1
    43                              <3> 	%endmacro
    44                              <3> 
    45                              <3> 	%imacro reloc2 1+.nolist
    46                              <3> %if ELDSTRICT
    47                              <3>  %if ELDSTRICTCOUNTER
    48                              <3>   %error Missing relocation
    49                              <3>  %endif
    50                              <3>  [warning -reloc-abs]
    51                              <3>  %assign ELDSTRICTCOUNTER 2
    52                              <3> %endif
    53                              <3> %1
    54                              <3> 	%endmacro
    55                              <3> 
    56                              <3> 	%imacro eldstrictcheck 0.nolist
    57                              <3> %if ELDSTRICT
    58                              <3>  %ifn ELDSTRICTCOUNTER
    59                              <3>   %error Unexpected relocation
    60                              <3>  %else
    61                              <3>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <3>   %ifn ELDSTRICTCOUNTER
    63                              <3>    [warning +reloc-abs]
    64                              <3>   %endif
    65                              <3>  %endif
    66                              <3> %endif
    67                              <3> 	%endmacro
    68                              <3> 
    69                              <3> %endif
    70                              <3> 
    21                              <2> 
    22                              <2> 
    23                              <2> %assign ELDLINKER 0
    24                              <2> 
    25                              <2> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <2> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <2> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <2> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <2> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <2> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <2> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <2> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <2> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <2> %assign ELDDATA_NEXT_ENTRY -1
    37                              <2> %assign ELDDATA_NEXT_SECTION -1
    38                              <2> %assign ELDDATA_NEXT_OTHER -1
    39                              <2> 
    40                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <2> %if ELDLINKER
    43                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <2>  %else
    46                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %endif
    48                              <2> %else
    49                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <2>  %else
    52                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <2>  %endif
    54                              <2> %endif
    55                              <2> 	eldstrictcheck
    56                              <2> 	%endmacro
    57                              <2> 
    58                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <2> %if ELDLINKER
    61                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <2>  %else
    64                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %endif
    66                              <2> %else
    67                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <2>  %else
    70                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <2>  %endif
    72                              <2> %endif
    73                              <2> 	eldstrictcheck
    74                              <2> 	%endmacro
    75                              <2> 
    76                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <2> 
    85                              <2> 
    86                              <2> %define LINK_DATA_RELOCATIONS ""
    87                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_DATA_NAMES db ""
    89                              <2> %define LINK_DATA_DETECTION none, none
    90                              <2> 
    91                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <2> %define LINK_OTHER_DATA_NAMES db ""
    94                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <2> 
    96                              <2> %ifndef ELDOTHER
    97                              <2>  %assign ELDOTHER 0
    98                              <2> %endif
    99                              <2> %assign ELDOTHERLINK 0
   100                              <2> 
   101                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <2> %if ELDOTHER
   103                              <2>  %assign ELDOTHERLINK 1
   104                              <2> %endif
   105                              <2> 	linkdatarelocation %1, %2, %3
   106                              <2> %assign ELDOTHERLINK 0
   107                              <2> 	%endmacro
   108                              <2> 
   109                              <2> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <2> %ifidni %3, required
   112                              <2>  %assign %%optional 0
   113                              <2> %elifidni %3, optional
   114                              <2>  %assign %%optional 100h
   115                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <2>  %else
   119                              <2>   %error Optional data link not allowed here
   120                              <2>  %endif
   121                              <2> %elifidni %3, PM required
   122                              <2>  %assign %%optional 300h
   123                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <2>  %else
   128                              <2>   %error Optional data link not allowed here
   129                              <2>  %endif
   130                              <2> %else
   131                              <2>  %fatal Unknown optional keyword
   132                              <2> %endif
   133                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <2>  %assign %%DATASECTION 1
   135                              <2> %else
   136                              <2>  %assign %%DATASECTION 0
   137                              <2> %endif
   138                              <2> %ifidni %4, single
   139                              <2>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <2>   %error Unexpected single data link after next data link
   141                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <2>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <2>  %endif
   144                              <2>  %assign %%next 0
   145                              <2> %elifidni %4, next
   146                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <2>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <2>    %error Unexpected next data link
   157                              <2>   %endif
   158                              <2>  %else
   159                              <2>   %error Next data link not allowed here
   160                              <2>  %endif
   161                              <2>  %ifn %%optional
   162                              <2>   %error Next data link only valid as optional or PM required
   163                              <2>  %endif
   164                              <2>  %assign %%next 400h
   165                              <2>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <2>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <2>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <2> %elifidni %4, last
   169                              <2>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <2>   %error Next last data link not allowed here
   171                              <2>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <2>   %error Next last data link not allowed here
   173                              <2>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <2>   %error Next last data link not allowed here
   175                              <2>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <2>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <2>    %error Unexpected next data link
   180                              <2>   %endif
   181                              <2>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <2>  %else
   183                              <2>   %error Next data link not allowed here
   184                              <2>  %endif
   185                              <2>  %assign %%next 800h
   186                              <2>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <2>  %assign ELDDATA_NEXT_SECTION -1
   188                              <2> %else
   189                              <2>  %fatal Unknown next keyword
   190                              <2> %endif
   191                              <2> 	%if ELDOTHERLINK
   192                              <2> %if ELDLINKER
   193                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <2> %else
   195                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <2> %endif
   197                              <2> 	%else
   198                              <2> %if ELDLINKER
   199                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <2> %else
   201                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <2> %endif
   203                              <2> 	%endif
   204                              <2> %defstr %%string %1
   205                              <2> %strlen %%length %%string
   206                              <2> %if %%length > 64
   207                              <2> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <2> 	;  because flag 80h is used to mark optional links
   209                              <2> 	;  that failed to be matched.
   210                              <2>  %error Too long link name: %1
   211                              <2> %endif
   212                              <2> %define LINK_DATA_CHECK %1
   213                              <2> 	%if ELDOTHERLINK
   214                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <2> %if LINK_DATA_NEW
   216                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <2> 	hashdef HASH, %%string
   218                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <2> %else
   221                              <2>  %%name equ LINK_DATA_DUPLICATE
   222                              <2> %endif
   223                              <2> 	%else
   224                              <2> 	linkdata_detect LINK_DATA_DETECTION
   225                              <2> %if LINK_DATA_NEW
   226                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <2> 	hashdef HASH, %%string
   228                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <2> %else
   231                              <2>  %%name equ LINK_DATA_DUPLICATE
   232                              <2> %endif
   233                              <2> 	%endif
   234                              <2> 	eldstrictcheck
   235                              <2> 	%endmacro
   236                              <2> 
   237                              <2> 	%imacro linkdata_detect 2-*.nolist
   238                              <2> %assign LINK_DATA_NEW 1
   239                              <2> %rep (%0 - 2) / 2
   240                              <2>  %rotate 2
   241                              <2>  %ifidni %1, LINK_DATA_CHECK
   242                              <2>   %assign LINK_DATA_NEW 0
   243                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <2>   %exitrep
   245                              <2>  %endif
   246                              <2> %endrep
   247                              <2> 	%endmacro
   248                              <2> 
   249                              <2> 	%imacro link_data_dump_names 1-*.nolist
   250                              <2> %rep %0
   251                              <2> 	%1
   252                              <2>  %rotate 1
   253                              <2> %endrep
   254                              <2> 	%endmacro
   255                              <2> 
   256                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <2> 
   260                              <2> %endif
    21                              <1> 
    22                              <1> %assign ELDLINKER 0
    23                              <1> 
    24                              <1> [section relocatedzero nobits vstart=0]
    25                              <1> relocatedzero:
    26                              <1> __SECT__
    27                              <1> 
    28                              <1> 	numdef HOUDINI, 1
    29                              <1> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <1> 
    31                              <1> %imacro houdini 0.nolist
    32                              <1> %if _HOUDINI
    33                              <1>  %if _HOUDINI_CONDITIONAL
    34                              <1> reloc	testopt [ss:relocateddata], 100h
    35                              <1> linkdatarelocation options7, -3
    36                              <1> 	jz %%skip
    37                              <1>  %endif
    38                              <1> reloc	testopt [ss:relocateddata], 100h
    39                              <1> linkdatarelocation internalflags6, -3
    40                              <1> 	jz %%skip
    41                              <1> 	int3
    42                              <1> %%skip:
    43                              <1> %endif
    44                              <1> %endmacro
    45                              <1> 
    46                              <1> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <1> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <1> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <1> %define ELDCALL_CODE_NAMES db ""
    51                              <1> %define ELDCALL_CODE_DETECTION none, none
    52                              <1> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <1> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <1> %assign ELDCALL_NEXT_STATUS 0			; not any seen yet
    55                              <1> %assign ELDCALL_NEXT_ENTRY -1
    56                              <1> 
    57                              <1> 	%imacro extcall 1-3.nolist required, single
    58                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
    59                              <1>  %error "ELD call cannot be used in ELD data block"
    60                              <1> %endif
    61                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    62                              <1> %ifidni %2, required
    63                              <1>  %assign %%optional 0
    64                              <1> %elifidni %2, optional
    65                              <1>  %assign %%optional 100h
    66                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    67                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    68                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    69                              <1>  %else
    70                              <1>   %error Optional code link not allowed here
    71                              <1>  %endif
    72                              <1> %elifidni %2, PM required
    73                              <1>  %assign %%optional 300h
    74                              <1>  %assign ELDCALL_PMREQUIRED_STATUS 1
    75                              <1>  %if ELDCALL_OPTIONAL_STATUS == 0
    76                              <1>   %assign ELDCALL_OPTIONAL_STATUS 1
    77                              <1>  %elif ELDCALL_OPTIONAL_STATUS == 1
    78                              <1>  %else
    79                              <1>   %error Optional code link not allowed here
    80                              <1>  %endif
    81                              <1> %else
    82                              <1>  %fatal Unknown optional keyword
    83                              <1> %endif
    84                              <1> %ifidni %3, single
    85                              <1>  %if ELDCALL_NEXT_STATUS == 1		; after next ?
    86                              <1>   %error Unexpected single code link after next code link
    87                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    88                              <1>   %assign ELDCALL_NEXT_STATUS 3		; note single with next/last present
    89                              <1>  %endif
    90                              <1>  %assign %%next 0
    91                              <1> %elifidni %3, next
    92                              <1>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
    93                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    94                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
    95                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    96                              <1>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
    97                              <1>   %assign ELDCALL_NEXT_STATUS 1		; in next
    98                              <1>  %elif ELDCALL_NEXT_STATUS == 1		; repeated next ?
    99                              <1>   %if ELDCALL_NEXT_ENTRY != %%entry
   100                              <1>    %error Unexpected next code link
   101                              <1>   %endif
   102                              <1>  %else
   103                              <1>   %error Next code link not allowed here
   104                              <1>  %endif
   105                              <1>  %ifn %%optional
   106                              <1>   %error Next code link only valid as optional or PM required
   107                              <1>  %endif
   108                              <1>  %assign %%next 400h
   109                              <1>  %assign ELDCALL_NEXT_ENTRY %%entry
   110                              <1> %elifidni %3, last
   111                              <1>  %if ELDCALL_NEXT_STATUS == 0		; no next/last yet ?
   112                              <1>   %error Next last code link not allowed here
   113                              <1>  %elif ELDCALL_NEXT_STATUS == 2		; after last ?
   114                              <1>   %error Next last code link not allowed here
   115                              <1>  %elif ELDCALL_NEXT_STATUS == 3		; after single ?
   116                              <1>   %error Next last code link not allowed here
   117                              <1>  %elif ELDCALL_NEXT_STATUS == 1		; after next ?
   118                              <1>   %if ELDCALL_NEXT_ENTRY != %%entry
   119                              <1>    %error Unexpected next code link
   120                              <1>   %endif
   121                              <1>   %assign ELDCALL_NEXT_STATUS 2		; note now after last
   122                              <1>  %else
   123                              <1>   %error Next code link not allowed here
   124                              <1>  %endif
   125                              <1>  %assign %%next 800h
   126                              <1>  %assign ELDCALL_NEXT_ENTRY -1
   127                              <1>  %assign ELDCALL_NEXT_SECTION -1
   128                              <1> %else
   129                              <1>  %fatal Unknown next keyword
   130                              <1> %endif
   131                              <1> %if %%next != 400h
   132                              <1> %if 0
   133                              <1> [warning -reloc-rel-word]
   134                              <1> 	call near relocatedzero
   135                              <1> [warning +reloc-rel-word]
   136                              <1> %else
   137                              <1> 	db 0E8h
   138                              <1> reloc	dw relocatedzero
   139                              <1> 	eldstrictcheck
   140                              <1> %endif
   141                              <1> 	jmp strict short %%skipparameter
   142                              <1> 	dw 0
   143                              <1> %%skipparameter:
   144                              <1> %endif
   145                              <1> %if ELDLINKER
   146                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
   147                              <1>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   148                              <1> %else
   149                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
   150                              <1>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional + %%next, %%entry, %%name
   151                              <1> %endif
   152                              <1> %defstr %%string %1
   153                              <1> %strlen %%length %%string
   154                              <1> %if %%length > 64
   155                              <1> 	; Could be increased, but mustn't exceed 127 bytes
   156                              <1> 	;  because flag 80h is used to mark optional links
   157                              <1> 	;  that failed to be matched.
   158                              <1>  %error Too long link name: %1
   159                              <1> %endif
   160                              <1> %define ELDCALL_CODE_CHECK %1
   161                              <1> 	linkcode_detect ELDCALL_CODE_DETECTION
   162                              <1> %if ELDCALL_CODE_NEW
   163                              <1>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   164                              <1> 	hashdef HASH, %%string
   165                              <1> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   167                              <1> %else
   168                              <1>  %%name equ ELDCALL_CODE_DUPLICATE
   169                              <1> %endif
   170                              <1> 	%endmacro
   171                              <1> 
   172                              <1> 	%imacro linkcode_detect 2-*.nolist
   173                              <1> %assign ELDCALL_CODE_NEW 1
   174                              <1> %rep (%0 - 2) / 2
   175                              <1>  %rotate 2
   176                              <1>  %ifidni %1, ELDCALL_CODE_CHECK
   177                              <1>   %assign ELDCALL_CODE_NEW 0
   178                              <1>   %xdefine ELDCALL_CODE_DUPLICATE %2
   179                              <1>   %exitrep
   180                              <1>  %endif
   181                              <1> %endrep
   182                              <1> 	%endmacro
   183                              <1> 
   184                              <1> 
   185                              <1> %define ELDCALL_CALLCALL_LIST none
   186                              <1> %define ELDCALL_CALLCALL_PROCESSED_PRIOR ""
   187                              <1> 
   188                              <1> 	%imacro extcallcall 1.nolist
   189                              <1> 	call %1
   190                              <1> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   191                              <1> 	%endmacro
   192                              <1> 
   193                              <1> %assign ELDCALLCALL_DUMPED 0
   194                              <1> 
   195                              <1> 	%imacro eldcall_dump_callcall 1-*.nolist
   196                              <1> %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED_PRIOR
   197                              <1>  %rep %0 - 1
   198                              <1>   %rotate 1
   199                              <1>   %define ELDCALL_CHECK %1
   200                              <1> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   201                              <1>   %if ELDCALL_NEW
   202                              <1>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   203                              <1> 	align 8, nop
   204                              <1> %1:
   205                              <1> 	extcall %1
   206                              <1> 	retn
   207                              <1>   %endif
   208                              <1>  %endrep
   209                              <1> %assign ELDCALLCALL_DUMPED 1
   210                              <1> %define ELDCALL_CALLCALL_LIST none
   211                              <1> 	%endmacro
   212                              <1> 
   213                              <1> 	%imacro eldcall_new_callcall 0.nolist
   214                              <1> %if ELDCALLCALL_DUMPED
   215                              <1>  %xdefine ELDCALL_CALLCALL_PROCESSED_PRIOR   ELDCALL_CALLCALL_PROCESSED_PRIOR, ELDCALL_CALLCALL_PROCESSED
   217                              <1>  %assign ELDCALLCALL_DUMPED 0
   218                              <1>  %define ELDCALL_CALLCALL_LIST none
   219                              <1> %endif
   220                              <1> 	%endmacro
   221                              <1> 
   222                              <1> 	%imacro eldcall_callcall_detect 1-*.nolist
   223                              <1> %assign ELDCALL_NEW 1
   224                              <1> %rep %0
   225                              <1>  %ifidni %1, ELDCALL_CHECK
   226                              <1>   %assign ELDCALL_NEW 0
   227                              <1>   %exitrep
   228                              <1>  %endif
   229                              <1>  %rotate 1
   230                              <1> %endrep
   231                              <1> 	%endmacro
   232                              <1> 
   233                              <1> 	%imacro eldcall_dump_names 1-*.nolist
   234                              <1> %rep %0
   235                              <1> 	%1
   236                              <1>  %rotate 1
   237                              <1> %endrep
   238                              <1> 	%endmacro
   239                              <1> 
   240                              <1> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   241                              <1> ; if using optional code links:
   242                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   243                              <1> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   244                              <1> ; if not using optional code links:
   245                              <1> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   246                              <1> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   247                              <1> ; eldcall_dump_names ELDCALL_CODE_NAMES
   248                              <1> 
   249                              <1> %endif
    10                                  %include "elddata.mac"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug data relocation macros
     4                              <1> 
     5                              <1> Copyright (C) 2008-2024 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %ifndef ELDDATA_MAC
    16                              <1> %define ELDDATA_MAC 1
    17                              <1> 
    18                              <1> %include "lmacros3.mac"
    19                              <1> %include "nasmhash.mac"
    20                              <1> %include "eldcheck.mac"
    21                              <1> 
    22                              <1> 
    23                              <1> %assign ELDLINKER 0
    24                              <1> 
    25                              <1> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <1> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <1> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <1> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <1> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <1> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <1> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <1> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <1> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <1> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <1> %assign ELDDATA_NEXT_STATUS 0			; not any seen yet
    36                              <1> %assign ELDDATA_NEXT_ENTRY -1
    37                              <1> %assign ELDDATA_NEXT_SECTION -1
    38                              <1> %assign ELDDATA_NEXT_OTHER -1
    39                              <1> 
    40                              <1> 	%imacro internalcoderelocation 0-1.nolist -2
    41                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    42                              <1> %if ELDLINKER
    43                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    44                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    45                              <1>  %else
    46                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    47                              <1>  %endif
    48                              <1> %else
    49                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    50                              <1>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    51                              <1>  %else
    52                              <1>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    53                              <1>  %endif
    54                              <1> %endif
    55                              <1> 	eldstrictcheck
    56                              <1> 	%endmacro
    57                              <1> 
    58                              <1> 	%imacro internaldatarelocation 0-1.nolist -2
    59                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    60                              <1> %if ELDLINKER
    61                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    62                              <1>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    63                              <1>  %else
    64                              <1>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    65                              <1>  %endif
    66                              <1> %else
    67                              <1>  %ifidni _CURRENT_SECTION_TYPE, DATA
    68                              <1>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    69                              <1>  %else
    70                              <1>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    71                              <1>  %endif
    72                              <1> %endif
    73                              <1> 	eldstrictcheck
    74                              <1> 	%endmacro
    75                              <1> 
    76                              <1> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    77                              <1> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    78                              <1> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    79                              <1> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    80                              <1> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    81                              <1> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    82                              <1> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    83                              <1> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    84                              <1> 
    85                              <1> 
    86                              <1> %define LINK_DATA_RELOCATIONS ""
    87                              <1> %define LINK_LINKER_DATA_RELOCATIONS ""
    88                              <1> %define LINK_DATA_NAMES db ""
    89                              <1> %define LINK_DATA_DETECTION none, none
    90                              <1> 
    91                              <1> %define LINK_OTHER_DATA_RELOCATIONS ""
    92                              <1> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    93                              <1> %define LINK_OTHER_DATA_NAMES db ""
    94                              <1> %define LINK_OTHER_DATA_DETECTION none, none
    95                              <1> 
    96                              <1> %ifndef ELDOTHER
    97                              <1>  %assign ELDOTHER 0
    98                              <1> %endif
    99                              <1> %assign ELDOTHERLINK 0
   100                              <1> 
   101                              <1> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
   102                              <1> %if ELDOTHER
   103                              <1>  %assign ELDOTHERLINK 1
   104                              <1> %endif
   105                              <1> 	linkdatarelocation %1, %2, %3
   106                              <1> %assign ELDOTHERLINK 0
   107                              <1> 	%endmacro
   108                              <1> 
   109                              <1> 	%imacro linkdatarelocation 1-4.nolist -2, required, single
   110                              <1> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   111                              <1> %ifidni %3, required
   112                              <1>  %assign %%optional 0
   113                              <1> %elifidni %3, optional
   114                              <1>  %assign %%optional 100h
   115                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   116                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   117                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   118                              <1>  %else
   119                              <1>   %error Optional data link not allowed here
   120                              <1>  %endif
   121                              <1> %elifidni %3, PM required
   122                              <1>  %assign %%optional 300h
   123                              <1>  %assign ELDDATA_PMREQUIRED_STATUS 1
   124                              <1>  %if ELDDATA_OPTIONAL_STATUS == 0
   125                              <1>   %assign ELDDATA_OPTIONAL_STATUS 1
   126                              <1>  %elif ELDDATA_OPTIONAL_STATUS == 1
   127                              <1>  %else
   128                              <1>   %error Optional data link not allowed here
   129                              <1>  %endif
   130                              <1> %else
   131                              <1>  %fatal Unknown optional keyword
   132                              <1> %endif
   133                              <1> %ifidni _CURRENT_SECTION_TYPE, DATA
   134                              <1>  %assign %%DATASECTION 1
   135                              <1> %else
   136                              <1>  %assign %%DATASECTION 0
   137                              <1> %endif
   138                              <1> %ifidni %4, single
   139                              <1>  %if ELDDATA_NEXT_STATUS == 1		; after next ?
   140                              <1>   %error Unexpected single data link after next data link
   141                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   142                              <1>   %assign ELDDATA_NEXT_STATUS 3		; note single with next/last present
   143                              <1>  %endif
   144                              <1>  %assign %%next 0
   145                              <1> %elifidni %4, next
   146                              <1>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   147                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   148                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   149                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   150                              <1>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   151                              <1>   %assign ELDDATA_NEXT_STATUS 1		; in next
   152                              <1>  %elif ELDDATA_NEXT_STATUS == 1		; repeated next ?
   153                              <1>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   156                              <1>    %error Unexpected next data link
   157                              <1>   %endif
   158                              <1>  %else
   159                              <1>   %error Next data link not allowed here
   160                              <1>  %endif
   161                              <1>  %ifn %%optional
   162                              <1>   %error Next data link only valid as optional or PM required
   163                              <1>  %endif
   164                              <1>  %assign %%next 400h
   165                              <1>  %assign ELDDATA_NEXT_ENTRY %%entry
   166                              <1>  %assign ELDDATA_NEXT_SECTION %%DATASECTION
   167                              <1>  %assign ELDDATA_NEXT_OTHER ELDOTHERLINK
   168                              <1> %elifidni %4, last
   169                              <1>  %if ELDDATA_NEXT_STATUS == 0		; no next/last yet ?
   170                              <1>   %error Next last data link not allowed here
   171                              <1>  %elif ELDDATA_NEXT_STATUS == 2		; after last ?
   172                              <1>   %error Next last data link not allowed here
   173                              <1>  %elif ELDDATA_NEXT_STATUS == 3		; after single ?
   174                              <1>   %error Next last data link not allowed here
   175                              <1>  %elif ELDDATA_NEXT_STATUS == 1		; after next ?
   176                              <1>   %if ELDDATA_NEXT_ENTRY != %%entry 	|| ELDDATA_NEXT_SECTION != %%DATASECTION 	|| ELDDATA_NEXT_OTHER != ELDOTHERLINK
   179                              <1>    %error Unexpected next data link
   180                              <1>   %endif
   181                              <1>   %assign ELDDATA_NEXT_STATUS 2		; note now after last
   182                              <1>  %else
   183                              <1>   %error Next data link not allowed here
   184                              <1>  %endif
   185                              <1>  %assign %%next 800h
   186                              <1>  %assign ELDDATA_NEXT_ENTRY -1
   187                              <1>  %assign ELDDATA_NEXT_SECTION -1
   188                              <1> %else
   189                              <1>  %fatal Unknown next keyword
   190                              <1> %endif
   191                              <1> 	%if ELDOTHERLINK
   192                              <1> %if ELDLINKER
   193                              <1>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   194                              <1> %else
   195                              <1>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   196                              <1> %endif
   197                              <1> 	%else
   198                              <1> %if ELDLINKER
   199                              <1>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   200                              <1> %else
   201                              <1>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional + %%next, %%entry, %%name
   202                              <1> %endif
   203                              <1> 	%endif
   204                              <1> %defstr %%string %1
   205                              <1> %strlen %%length %%string
   206                              <1> %if %%length > 64
   207                              <1> 	; Could be increased, but mustn't exceed 127 bytes
   208                              <1> 	;  because flag 80h is used to mark optional links
   209                              <1> 	;  that failed to be matched.
   210                              <1>  %error Too long link name: %1
   211                              <1> %endif
   212                              <1> %define LINK_DATA_CHECK %1
   213                              <1> 	%if ELDOTHERLINK
   214                              <1> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   215                              <1> %if LINK_DATA_NEW
   216                              <1>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   217                              <1> 	hashdef HASH, %%string
   218                              <1>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   220                              <1> %else
   221                              <1>  %%name equ LINK_DATA_DUPLICATE
   222                              <1> %endif
   223                              <1> 	%else
   224                              <1> 	linkdata_detect LINK_DATA_DETECTION
   225                              <1> %if LINK_DATA_NEW
   226                              <1>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   227                              <1> 	hashdef HASH, %%string
   228                              <1>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   230                              <1> %else
   231                              <1>  %%name equ LINK_DATA_DUPLICATE
   232                              <1> %endif
   233                              <1> 	%endif
   234                              <1> 	eldstrictcheck
   235                              <1> 	%endmacro
   236                              <1> 
   237                              <1> 	%imacro linkdata_detect 2-*.nolist
   238                              <1> %assign LINK_DATA_NEW 1
   239                              <1> %rep (%0 - 2) / 2
   240                              <1>  %rotate 2
   241                              <1>  %ifidni %1, LINK_DATA_CHECK
   242                              <1>   %assign LINK_DATA_NEW 0
   243                              <1>   %xdefine LINK_DATA_DUPLICATE %2
   244                              <1>   %exitrep
   245                              <1>  %endif
   246                              <1> %endrep
   247                              <1> 	%endmacro
   248                              <1> 
   249                              <1> 	%imacro link_data_dump_names 1-*.nolist
   250                              <1> %rep %0
   251                              <1> 	%1
   252                              <1>  %rotate 1
   253                              <1> %endrep
   254                              <1> 	%endmacro
   255                              <1> 
   256                              <1> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   257                              <1> ; dw LINK_DATA_RELOCATIONS, 0, 0
   258                              <1> ; link_data_dump_names ELDCALL_CODE_NAMES
   259                              <1> 
   260                              <1> %endif
    11                                  
    12                                  %assign _CATCHINT0C 0
    13                                  %assign _CATCHINT0D 0
    14                                  %assign _CATCHINTFAULTCOND 0
    15                                  %assign _LOADER 0
    16                                  %assign _DEBUG 0
    17                                  %assign _DELAY_BEFORE_BP 0
    18                                  %assign _DHIGHLIGHT 0
    19                                  %assign _GETLINEHIGHLIGHT 0
    20                                  %assign _IMMASM 0
    21                                  %assign _INPUT_FILE_BOOT 0
    22                                  %assign _INPUT_FILE_HANDLES 0
    23                                  %assign _MS_0RANGE_COMPAT 0
    24                                  %assign _PM 0
    25                                  %assign _RH 0
    26                                  %assign _SYMBOLIC 0
    27                                  %assign _VXCHG 0
    28                                  %include "options.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug options and internal flags
     5                              <1> 
     6                              <1> Copyright (C) 2008-2025 E. C. Masloch
     7                              <1> 
     8                              <1> Usage of the works is permitted provided that this
     9                              <1> instrument is retained with the works, so that any entity
    10                              <1> that uses the works is notified of this instrument.
    11                              <1> 
    12                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <1> 
    14                              <1> %endif
    15                              <1> 
    16                              <1> 
    17                              <1> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <1> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <1> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <1> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <1> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <1> 	; This option was never used anywhere:
    23                              <1> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <1> 				; paged output is by default on if the output device is StdOut, else off
    25                              <1> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <1> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <1> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <1> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <1> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <1> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <1> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <1> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <1> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <1> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <1> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <1> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <1> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <1> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <1> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <1> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <1> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <1> ss_no_dump:		equ 80_0000h
    43                              <1> %if _SYMBOLIC
    44                              <1> dd_no_blanks_sym:	equ 100_0000h
    45                              <1> zz_no_pm_xms:		equ 200_0000h
    46                              <1> %endif
    47                              <1> rr_disasm_no_rept:	equ 1000_0000h
    48                              <1> rr_disasm_no_show:	equ 2000_0000h
    49                              <1> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <1> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <1> %if _SYMBOLIC
    52                              <1> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <1> %else
    54                              <1> DEFAULTOPTIONS	equ 0
    55                              <1> %endif
    56                              <1> 
    57                              <1> 
    58                              <1> opt2_db_header:		equ 1
    59                              <1> opt2_db_trailer:	equ 2
    60                              <1> opt2_dw_header:		equ 10h
    61                              <1> opt2_dw_trailer:	equ 20h
    62                              <1> opt2_dd_header:		equ 100h
    63                              <1> opt2_dd_trailer:	equ 200h
    64                              <1> opt2_getinput_dpmi:	equ 800h
    65                              <1> opt2_hh_compat:		equ 1000h
    66                              <1> opt2_getc_idle:		equ 2000h
    67                              <1> opt2_getc_idle_dpmi:	equ 4000h
    68                              <1> opt2_re_cancel_tpg:	equ 8000h
    69                              <1> opt2_nn_compat:		equ 1_0000h
    70                              <1> opt2_nn_capitalise:	equ 2_0000h
    71                              <1> %if _MS_0RANGE_COMPAT
    72                              <1> opt2_0range_compat:	equ 4_0000h
    73                              <1> %endif
    74                              <1> opt2_rr16_compat:	equ 8_0000h
    75                              <1> opt2_r_prompt_compat:	equ 10_0000h
    76                              <1> opt2_r_separate:	equ 20_0000h
    77                              <1> opt2_r_linebreak_always:equ 40_0000h
    78                              <1> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <1> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <1> 
    81                              <1> 
    82                              <1> opt3_tt_no_paging:	equ 1
    83                              <1> opt3_tp_no_paging:	equ 2
    84                              <1> opt3_pp_no_paging:	equ 4
    85                              <1> opt3_gg_no_paging:	equ 8
    86                              <1> opt3_silence_paging_set:equ 100h
    87                              <1> opt3_silence_paging_on:	equ 200h
    88                              <1> opt3_paging_rc:		equ 1000h
    89                              <1> opt3_paging_yy:		equ 2000h
    90                              <1> opt3_paging_re:		equ 4000h
    91                              <1> opt3_r_highlight_diff:	equ 10000h
    92                              <1> opt3_r_highlight_dumb:	equ 20000h
    93                              <1> opt3_r_highlight_full:	equ 40000h
    94                              <1> opt3_r_highlight_eip:	equ 80000h
    95                              <1> %if _PM
    96                              <1> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <1>  %if _BREAK_INSTALLDPMI
    98                              <1> opt3_break_installdpmi:	equ   20_0000h
    99                              <1>  %endif
   100                              <1> %endif
   101                              <1> %if _DHIGHLIGHT
   102                              <1> opt3_d_highlight:	equ   80_0000h
   103                              <1> %endif
   104                              <1> %if _GETLINEHIGHLIGHT
   105                              <1> opt3_getline_highlight:	equ  100_0000h
   106                              <1> %endif
   107                              <1> opt3_no_idle_2F:	equ  200_0000h
   108                              <1> %if _DELAY_BEFORE_BP
   109                              <1> opt3_delay_before_bp:	equ  400_0000h
   110                              <1> %endif
   111                              <1> opt3_no_call_amis:	equ  800_0000h
   112                              <1> opt3_disable_autorepeat:equ 1000_0000h
   113                              <1> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <1> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <1> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <1> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <1> 
   120                              <1> 
   121                              <1> opt4_int_2F_hook:	equ 2
   122                              <1> opt4_int_08_hook:	equ 4
   123                              <1> opt4_int_2D_hook:	equ 8
   124                              <1> %if _CATCHINTFAULTCOND
   125                              <1> opt4_int_fault_hook:	equ 10h
   126                              <1> %endif
   127                              <1> opt4_int_serial_force:	equ 1_0000h
   128                              <1> opt4_int_2F_force:	equ 2_0000h
   129                              <1> opt4_int_08_force:	equ 4_0000h
   130                              <1> opt4_int_2D_force:	equ 8_0000h
   131                              <1> %if _CATCHINT0D
   132                              <1> opt4_int_0D_force:	equ   10_0000h
   133                              <1> %endif
   134                              <1> %if _CATCHINT0C
   135                              <1> opt4_int_0C_force:	equ   20_0000h
   136                              <1> %endif
   137                              <1> opt4_int_00_force:	equ  100_0000h
   138                              <1> opt4_int_01_force:	equ  200_0000h
   139                              <1> opt4_int_03_force:	equ  400_0000h
   140                              <1> opt4_int_06_force:	equ  800_0000h
   141                              <1> opt4_int_18_force:	equ 1000_0000h
   142                              <1> opt4_int_19_force:	equ 2000_0000h
   143                              <1> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <1> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <1> opt4_int_07_force:	equ 8000_0000h
   146                              <1> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <1> 
   148                              <1> 
   149                              <1> %if _VXCHG
   150                              <1> opt6_vv_mode:		equ 1
   151                              <1> opt6_vv_keep:		equ 2
   152                              <1> opt6_vv_int16:		equ 10h
   153                              <1>  %if _VXCHG_DEFAULT_ON
   154                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <1>  %else
   156                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <1>  %endif
   158                              <1> %else
   159                              <1> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <1> %endif
   161                              <1> %if _DEBUG
   162                              <1> opt6_debug_exception_late:	equ  20h
   163                              <1> opt6_debug_exception_early:	equ  40h
   164                              <1>  %if _DEBUG_COND
   165                              <1> opt6_debug_exception:	equ  80h
   166                              <1> opt6_debug_mode:	equ 100h
   167                              <1>  %endif
   168                              <1> %endif
   169                              <1> opt6_bios_output:	equ 200h
   170                              <1> opt6_flat_binary:	equ 400h
   171                              <1> opt6_big_stack:		equ 800h
   172                              <1> opt6_40_columns:	equ 1000h
   173                              <1> opt6_40_indent_odd:	equ 2000h
   174                              <1> opt6_40_dash:		equ 4000h
   175                              <1> opt6_share_serial_irq:	equ 1_0000h
   176                              <1> opt6_serial_EOI_call:	equ 2_0000h
   177                              <1> %if _RH
   178                              <1> opt6_rh_mode:		equ 10_0000h
   179                              <1> %endif
   180                              <1> %if _DEBUG
   181                              <1> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <1>  %if _DEBUG_COND
   183                              <1> opt6_debug_putrunint:		equ  80_0000h
   184                              <1>  %endif
   185                              <1> %endif
   186                              <1> opt6_bios_io:		equ 100_0000h
   187                              <1> opt6_immasm_display_uu:	equ 200_0000h
   188                              <1> opt6_immasm_debug:	equ 400_0000h
   189                              <1> opt6_immasm_flag:	equ 800_0000h
   190                              <1> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <1> opt6_r_flags_style2:	equ 2000_0000h
   192                              <1> opt6_r_flags_style3:	equ 4000_0000h
   193                              <1> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <1> 
   195                              <1> 
   196                              <1> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <1> opt7_no_free_oneshot_eld:	equ 1
   198                              <1> opt7_debug_optional_link:	equ 2
   199                              <1> opt7_quiet_install:		equ 4
   200                              <1> opt7_quick_run:			equ 8
   201                              <1> opt7_houdini:			equ 100h
   202                              <1> opt7_debug_run:			equ 200h
   203                              <1> opt7_no_ensure:			equ 1000h
   204                              <1> opt7_no_tsr_ll:			equ 2000h
   205                              <1> 
   206                              <1> 
   207                              <1> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   208                              <1> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   209                              <1> ntpacket	equ	  4	; VDD registered and usable (L, W)
   210                              <1> pagedcommand	equ	  8	; allows paging in puts
   211                              <1> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   212                              <1> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   213                              <1> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   214                              <1> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   215                              <1> hooked2F	equ	 100h	; Int2F hooked
   216                              <1> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   217                              <1> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   218                              <1> protectedmode	equ	 800h	; in (DPMI) protected mode
   219                              <1> debuggeeA20	equ	1000h	; state of debuggee's A20
   220                              <1> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   221                              <1> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   222                              <1> has386		equ	8000h	; CPU is a 386
   223                              <1> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   224                              <1> runningnt	equ    2_0000h	; running in NTVDM
   225                              <1> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   226                              <1> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   227                              <1> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   228                              <1> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   229                              <1> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   230                              <1> attachedterm	equ   80_0000h	; the attached process terminated
   231                              <1> runningdosemu	equ  100_0000h	; running in dosemu
   232                              <1> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   233                              <1> tt_while:	equ  400_0000h	; tt: while condition specified
   234                              <1> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   235                              <1> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   236                              <1> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   237                              <1> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   238                              <1> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   239                              <1> 
   240                              <1> 
   241                              <1> dif2_gg_is_first:	equ   1
   242                              <1> dif2_gg_skip_non_cseip:	equ   2
   243                              <1> dif2_gg_skip_cseip:	equ   4
   244                              <1> dif2_gg_is_gg:		equ   8
   245                              <1> dif2_gg_first_detected:	equ  10h
   246                              <1> dif2_gg_again:		equ  20h
   247                              <1> dif2_tpg_proceed_bp_set:equ  40h
   248                              <1> dif2_tpg_keep_proceed_bp: equ 80h
   249                              <1> dif2_tpg_have_bp:	equ 100h
   250                              <1> dif2_tpg_adjusted_cseip:equ 200h
   251                              <1> dif2_tpg_do_not_adjust:	equ 400h
   252                              <1> dif2_bp_failure:	equ 800h
   253                              <1> dif2_is_pp:		equ 1000h
   254                              <1> %if _SYMBOLIC
   255                              <1> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   256                              <1> dif2_sym_req_xms:	equ 2000h
   257                              <1> dif2_sym_req_86mm:	equ 4000h
   258                              <1> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   259                              <1> dif2_no_pm_xms:		equ 1_0000h
   260                              <1> dif2_xms_detection_done:equ 2_0000h
   261                              <1> %endif
   262                              <1> %if _INPUT_FILE_HANDLES
   263                              <1> dif2_input_file:	equ 10_0000h
   264                              <1> dif2_closed_input_file:	equ 20_0000h
   265                              <1> %endif
   266                              <1> dif2_did_getline_file:	equ 40_0000h
   267                              <1> %if _SYMBOLIC
   268                              <1> dif2_poison:		equ 80_0000h
   269                              <1> %endif
   270                              <1> dif2_boot_loaded_kernel:equ 100_0000h
   271                              <1> %if _INPUT_FILE_BOOT
   272                              <1> dif2_input_file_boot:	equ 200_0000h
   273                              <1> dif2_closed_input_file_boot:	equ 400_0000h
   274                              <1> %endif
   275                              <1> dif2_in_silence_dump:	equ 1000_0000h
   276                              <1> dif2_int31_segment:	equ 2000_0000h
   277                              <1> dif2_nn_compat:		equ 4000_0000h
   278                              <1> dif2_nn_capitalise:	equ 8000_0000h
   279                              <1> 
   280                              <1> 
   281                              <1> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   282                              <1> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   283                              <1> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   284                              <1> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   287                              <1> dif3_load_dir_dir:	equ 8
   288                              <1> dif3_input_terminal_override:	equ 10h
   289                              <1> dif3_input_serial_override:	equ 20h
   290                              <1> dif3_if_not:		equ 40h
   291                              <1> dif3_partition_changed:	equ 80h
   292                              <1> ;
   293                              <1> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   294                              <1> dif3_input_cmdline_closed: equ 200h
   295                              <1> dif3_at_line_end:	equ 400h
   296                              <1> dif3_quiet_input_single:equ 800h
   297                              <1> dif3_quiet_output:	equ 1000h
   298                              <1> dif3_unquiet_error:	equ 2000h
   299                              <1> dif3_unquiet_prompt:	equ 4000h
   300                              <1> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   301                              <1> dif3_return_eof:	equ 8000h
   302                              <1> dif3_highlighting:	equ 1_0000h
   303                              <1> dif3_do_not_highlight:	equ 2_0000h
   304                              <1> dif3_int10_highlight:	equ 2_0000h
   305                              <1> dif3_nosymbols_1:	equ 4_0000h
   306                              <1> dif3_nosymbols_2:	equ 8_0000h
   307                              <1> %if _PM
   308                              <1> dif3_ss_b_bit_set:	equ  10_0000h
   309                              <1> %endif
   310                              <1> dif3_gotint19:		equ  20_0000h
   311                              <1> dif3_prior_pm:		equ  40_0000h
   312                              <1> %if _DELAY_BEFORE_BP
   313                              <1> dif3_delayed		equ  80_0000h
   314                              <1> %endif
   315                              <1> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   316                              <1> dif3_input_re_closed:	equ 200_0000h
   317                              <1> dif3_accept_getrange_0:	equ 400_0000h
   318                              <1> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   319                              <1> dif3_in_if:		equ 800_0000h
   320                              <1> %endif
   321                              <1> dif3_auxbuff_guarded_1:	equ 1000_0000h
   322                              <1> dif3_auxbuff_guarded_2:	equ 2000_0000h
   323                              <1> dif3_auxbuff_guarded_3:	equ 4000_0000h
   324                              <1> dif3_sss_is_reverse:	equ 8000_0000h
   325                              <1> 
   326                              <1> 
   327                              <1> dif4_int_serial_hooked:	equ 1
   328                              <1> dif4_int_2F_hooked:	equ 2
   329                              <1> dif4_int_08_hooked:	equ 4
   330                              <1> dif4_int_2D_hooked:	equ 8
   331                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0D
   332                              <1> dif4_int_0D_hooked:	equ 10h
   333                              <1> %endif
   334                              <1> %if _CATCHINTFAULTCOND && _CATCHINT0C
   335                              <1> dif4_int_0C_hooked:	equ 20h
   336                              <1> %endif
   337                              <1> %if _LOADER
   338                              <1> dif4_int_18_hooked:	equ 1000h
   339                              <1> dif4_int_19_hooked:	equ 2000h
   340                              <1> %endif
   341                              <1> 
   342                              <1> 
   343                              <1> %if _VXCHG
   344                              <1> dif6_vv_mode:		equ 1
   345                              <1> %endif
   346                              <1> dif6_in_hook2F:		equ 2
   347                              <1> dif6_in_amis_hook2F:	equ 4
   348                              <1> dif6_debug_mode:	equ 100h
   349                              <1> dif6_locked:		equ 200h
   350                              <1> dif6_mcp:		equ 400h
   351                              <1> %if _RH
   352                              <1> dif6_rh_mode_was:	equ  8_0000h
   353                              <1> dif6_rh_mode:		equ 10_0000h
   354                              <1> dif6_rh_mode_2:		equ 20_0000h
   355                              <1> %endif
   356                              <1> dif6_device_mode:	equ 40_0000h
   357                              <1> dif6_cpdepchars:	equ 80_0000h
   358                              <1> %if _IMMASM
   359                              <1> dif6_immasm_no_output:	equ 100_0000h
   360                              <1> dif6_immasm:		equ 200_0000h
   361                              <1> dif6_immasm_rel8:	equ 400_0000h
   362                              <1> %endif
   363                              <1> 
   364                              <1> 
   365                              <1> disasm_lowercase	equ 1
   366                              <1> disasm_commablank	equ 2
   367                              <1> disasm_nasm		equ 4
   368                              <1> disasm_lowercase_refmem:equ 8
   369                              <1> disasm_show_short:	equ 10h
   370                              <1> disasm_show_near:	equ 20h
   371                              <1> disasm_show_far:	equ 40h
   372                              <1> disasm_nec:		equ 80h
   373                              <1> disasm_40_columns:	equ 100h
   374                              <1> disasm_no_indent:	equ 200h
   375                              <1> disasm_msdebug_mnemonofs: equ 400h
   376                              <1> disasm_a16_memref:	equ 1000h
   377                              <1> disasm_a32_memref:	equ 2000h
   378                              <1> disasm_a16_string:	equ 4000h
   379                              <1> disasm_a32_string:	equ 8000h
   380                              <1> disasm_hide_modrm:	equ 10000h
   381                              <1> disasm_asize_loop_nasm:	equ 20000h
   382                              <1> disasm_modrm_always:	equ 40000h
   383                              <1> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
    29                                  
    30                                  
    31                                  	cpu 8086
    32                                  
    33                                  	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    34                                  relocateddata:
    35                                  
    36                                  	addsection HEADER, start=0
    37                                  
    38                                  	istruc ELD_HEADERX
    39                                  at eldhxHeader
    40                                  		; ELD executable header
    41                                  	istruc ELD_HEADER
    42 00000000 454C4431                at eldhSignature,	db "ELD1"
    43 00000004 000000                  			db 0,0,0
    44 00000007 1A                      			db 26
    45 00000008 60000000                at eldhCodeOffset,	dd CODEOFFSET
    46 0000000C 9014                    at eldhCodeImageLength,	dw code_size
    47 0000000E 0000                    at eldhCodeAllocLength,	dw 0
    48 00000010 F0140000                at eldhDataOffset,	dd DATAOFFSET
    49 00000014 A000                    at eldhDataImageLength,	dw data_size
    50 00000016 5001                    at eldhDataAllocLength,	dw total_data_size - data_size
    51 00000018 A009                    at eldhCodeEntrypoint,	dw linker - code
    52                                  at eldhReserved
    53 0000001A 00<rep 4h>2400          at eldhExtensionSize,	dw header_extension_end - $$
    54                                  	iend
    55 00000020 [30000000]              at eldhxDescriptionOffset,	dd description
    56                                  PUT_ELDHX_DATETIME_OFFSET
    57                                  header_extension_end:
    58 00000024 00<rep Ch>              	iend
    59                                  
    60 00000030 50726F766964652053-     description:		asciz "Provide S (search memory) command."
    60 00000039 202873656172636820-
    60 00000042 6D656D6F7279292063-
    60 0000004B 6F6D6D616E642E00   
    61                                  
    62                                  
    63 00000053 00<rep Dh>              	align 16, db 0
    64                                  
    65                                  	eldstrict on
    66                                  
    67                                  CODEOFFSET equ $ - $$
    68                                  	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    69                                  %define CODEFIXUP - code + 0
    70                                  code:
    71                                  code_start:
    72                                  		; ELD instance header
    73                                  	istruc ELD_INSTANCE
    74                                  at eldiStartCode
    75 00000000 00<rep 2h>              at eldiEndCode
    76 00000002 00<rep 2h>              at eldiStartData
    77 00000004 00<rep 2h>              at eldiEndData
    78 00000006 00<rep 2h>5320636D-     at eldiIdentifier,	fill 8, 32, db "S cmd"
    78 0000000C 6420<rep 3h>       
    79 00000010 00<rep 2h>732E6C73-     at eldiListing,		asciz _ELD_LISTING
    79 00000016 7400               
    80 00000018 00<rep 8h>              	iend
    81                                  
    82                                  
    83                                  DATAOFFSET equ CODEOFFSET + code_size
    84                                  	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
    85                                  %define DATAFIXUP - datastart + 0
    86                                  datastart:
    87                                  PUT_ELD_DATETIME
    88                                  
    89                                  
    90                                  	usesection CODE
    91                                  
    92                                  command:
    93 00000020 EB08                    	jmp strict short .entry
    94                                  .chain:
    95 00000022 E8[0000]EB020000        	extcall cmd3_not_ext, required	; must NOT be extcallcall
    96 00000029 90                      	times 10 - ($ - command) nop
    97                                  .entry:
    98 0000002A 56                      	push si
    99 0000002B 3C2D                    	cmp al, '-'
   100 0000002D 7503                    	jne @F
   101 0000002F E89E07                  	extcallcall skipcomma
   102                                  @@:
   103 00000032 4E                      	dec si
   104                                  
   105                                  %if 0
   106                                  	lodsb
   107                                  	extcallcall uppercase
   108                                  	cmp al, 'S'
   109                                  	je @F
   110                                  .transfer_to_chain:
   111                                  	pop si
   112                                  	dec si
   113                                  	lodsb
   114                                  	jmp .chain
   115                                  
   116                                  @@:
   117                                  	dec si			; -> at 'S'
   118                                  reloc	mov dx, msg.sleep
   119                                  internaldatarelocation
   120                                  	extcallcall isstring?	; check for "SLEEP"
   121                                  	je .transfer_to_chain
   122                                  	inc si			; skip 'S'
   123                                  %else
   124                                  		; better detection: require S to match as
   125                                  		;  a string, so cannot mean any ELDs.
   126                                  		;  implies that it is not handled if the user
   127                                  		;  enters S with the address immediately behind
   128                                  		;  the S without a blank or comma.
   129 00000033 BA[1A00]                reloc	mov dx, msg.s
   130                                  internaldatarelocation
   131 00000036 E89F07                  	extcallcall isstring?
   132 00000039 7405                    	je .ours
   133                                  .transfer_to_chain:
   134 0000003B 5E                      	pop si
   135 0000003C 4E                      	dec si
   136 0000003D AC                      	lodsb
   137 0000003E EBE2                    	jmp .chain
   138                                  %endif
   139                                  
   140                                  .ours:
   141 00000040 58                      	pop ax
   142 00000041 E88C07                  	extcallcall skipcomma
   143 00000044 4E                      	dec si
   144 00000045 C706[0000][0000]        reloc2	mov word [relocateddata], relocateddata
   145                                  linkdatarelocation lastcmd, -4
   146                                  linkdatarelocation dmycmd
   147 0000004B BA[0000]                reloc	mov dx, relocateddata
   148                                  linkdatarelocation msg.uninstall
   149 0000004E E88707                  	extcallcall isstring?
   150 00000051 7407                    	je uninstall
   151 00000053 AC                      	lodsb
   152 00000054 E87F00                  	call sss
   153 00000057 E88607                  	extcallcall cmd3
   154                                  
   155                                  uninstall:
   156 0000005A AC                      	lodsb
   157 0000005B E88A07                  	extcallcall chkeol
   158                                  
   159 0000005E 8E06[0000]              reloc	mov es, word [relocateddata]
   160                                  linkdatarelocation extdssel
   161 00000062 E88B07                  	extcallcall ispm
   162 00000065 7404                    	jz @F
   163 00000067 8E06[0000]              reloc	mov es, word [relocateddata]
   164                                  linkdatarelocation extseg
   165                                  @@:
   166 0000006B 06                      	push es
   167 0000006C 1F                      	pop ds
   168 0000006D 31DB                    	xor bx, bx		; = 0 (no prior, modify ext_command_handler)
   169 0000006F BF[2000]                reloc	mov di, command		; di -> us
   170                                  internalcoderelocation
   171 00000072 368B36[0000]            reloc	mov si, word [ss:relocateddata]
   172                                  linkdatarelocation ext_command_handler
   173                                  				; si -> first
   174 00000077 85F6                    	test si, si		; none installed ?
   175 00000079 7450                    	jz .error		; error -->
   176                                  
   177                                  .loop:
   178 0000007B 39F7                    	cmp di, si		; found ?
   179 0000007D 740D                    	je .bx			; yes, use bx -->
   180 0000007F 89F3                    	mov bx, si		; bx -> prior handler
   181 00000081 AD                      	lodsw			; skip entrypoint jmp strict short
   182 00000082 AC                      	lodsb			; get first byte of chainer
   183 00000083 3CE9                    	cmp al, 0E9h		; expecting jmp near ?
   184 00000085 7544                    	jne .error		; no, error -->
   185 00000087 AD                      	lodsw			; get rel16 displacement
   186 00000088 01C6                    	add si, ax		; -> next handler
   187 0000008A EBEF                    	jmp .loop
   188                                  
   189                                  .bx:
   190 0000008C 85DB                    	test bx, bx		; any prior ?
   191 0000008E 751A                    	jnz .bxnz		; yes -->
   192 00000090 AF                      	scasw			; skip entrypoint jmp strict short
   193 00000091 803DE8                  	cmp byte [di], 0E8h	; is it a call to cmd3_not_ext ?
   194 00000094 7507                    	jne @F			; no -->
   195                                  				; yes, reset ext_command_handler to zero
   196                                  .setbx:
   197 00000096 36891E[0000]            reloc	mov word [ss:relocateddata], bx
   198                                  linkdatarelocation ext_command_handler
   199 0000009B EB1E                    	jmp .done
   200                                  
   201                                  @@:
   202 0000009D 803DE9                  	cmp byte [di], 0E9h	; validate
   203 000000A0 7529                    	jne .error		; failure -->
   204 000000A2 47                      	inc di			; -> rel16 displacement
   205 000000A3 8B1D                    	mov bx, word [di]	; get displacement
   206 000000A5 AF                      	scasw			; -> after jmp near
   207 000000A6 01FB                    	add bx, di		; -> next handler
   208 000000A8 EBEC                    	jmp .setbx		; set ext_command_handler to next
   209                                  
   210                                  .bxnz:
   211 000000AA 89DE                    	mov si, bx		; -> prior handler with us as downlink
   212 000000AC 87FE                    	xchg di, si		; si -> ours, di -> prior
   213 000000AE A7                      	cmpsw			; skip entrypoint jmp strict short
   214 000000AF A4                      	movsb			; copy 0E8h/0E9h
   215 000000B0 AD                      	lodsw			; ax = near rel16 displacement
   216 000000B1 01F0                    	add ax, si		; add in our base (= absolute offset)
   217 000000B3 29F8                    	sub ax, di
   218 000000B5 48                      	dec ax
   219 000000B6 48                      	dec ax			; subtract new base (= relative displacement)
   220 000000B7 AB                      	stosw			; store new rel16 displacement
   221 000000B8 A5                      	movsw			; jmp strict short
   222 000000B9 A5                      	movsw			; linkcall target
   223 000000BA A4                      	movsb			; trailer
   224                                  .done:
   225 000000BB 8026[1000]FE            reloc	clropt [code + eldiFlags], eldifResident
   226                                  internalcoderelocation -3	; mark block as free
   227 000000C0 BA[4F00]                reloc	mov dx, msg.uninstall_done
   228                                  internaldatarelocation
   229                                  @@:
   230 000000C3 16                      	push ss
   231 000000C4 1F                      	pop ds
   232 000000C5 E83007                  	extcallcall putsz
   233 000000C8 E81507                  	extcallcall cmd3	; return
   234                                  
   235                                  .error:
   236 000000CB B8010E                  	mov ax, 0E01h
   237 000000CE E82F07                  	extcallcall setrc
   238 000000D1 BA[6800]                reloc	mov dx, msg.uninstall_error
   239                                  internaldatarelocation
   240 000000D4 EBED                    	jmp @B
   241                                  
   242                                  
   243                                  %define relocated(address) relocateddata
   244                                  %assign ELD 1
   245                                  %assign _PM 1
   246                                  %assign _LOADER 0
   247                                  %assign _ONLY386 0
   248                                  %assign _ONLYNON386 0
   249                                  %assign _SWHILEBUFFER 0
   250                                  %assign _SCOUNT 1
   251                                  %assign _SDUMP 1
   252                                  %assign _SDUMPDISPLACEMENT 1
   253                                  %assign _SREVERSE 1
   254                                  %assign _AUXBUFFSIZE 8192 + 16
   255                                  %define lDEBUG_CODE CODE
   256                                  %define lDEBUG_DATA_ENTRY DATA
   257                                  %define dualcall call
   258                                  	cpu 8086
   259                                  %assign _WPT_LABELS 0
   260                                  
   261                                  %include "386.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug 386 patch macros
     5                              <1> 
     6                              <1> Copyright (C) 2008-2023 E. C. Masloch
     7                              <1> 
     8                              <1> Usage of the works is permitted provided that this
     9                              <1> instrument is retained with the works, so that any entity
    10                              <1> that uses the works is notified of this instrument.
    11                              <1> 
    12                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <1> 
    14                              <1> %endif
    15                              <1> 
    16                              <1> 	numdef WPT_LABELS, 0
    17                              <1> 		; This used to be required, because CODESECTIONFIXUP used
    18                              <1> 		;  ldebug_data_entry_size, which is not yet defined during
    19                              <1> 		;  assembling of (most) lDEBUG_CODE fragments.
    20                              <1> 		; However, assembling DebugX with this option selected
    21                              <1> 		;  took more than 2 minutes, so the non-label variant
    22                              <1> 		;  is clearly to be preferred when available.
    23                              <1> 		; Now that lDEBUG_CODE has vstart=0 we can use the
    24                              <1> 		;  CODESECTIONFIXUP again and thus disable this option.
    25                              <1> 
    26                              <1> %define PATCH_NO386_TABLE ""
    27                              <1> %define PATCH_386_TABLE ""
    28                              <1> %define PATCH_NO386_TABLE2 ""
    29                              <1> %define PATCH_386_TABLE2 ""
    30                              <1> %define PATCH_NO386_TABLEENTRY ""
    31                              <1> %define PATCH_386_TABLEENTRY ""
    32                              <1> 
    33                              <1> %if _ONLY386
    34                              <1> 		; Default patch macros if only running on 386+.
    35                              <1> %define _386_o32 o32
    36                              <1> %define _386_a32 a32
    37                              <1> %define _386_jmps jmp short
    38                              <1> %define _386_jmpn jmp near
    39                              <1> %define _no386_jmps comment
    40                              <1> %define _no386_jmpn comment
    41                              <1> 	%macro _386 0-1+.nolist
    42                              <1> [cpu 386]			; change CPU type
    43                              <1> 		%1		; write instruction
    44                              <1> __CPU__				; reset CPU type
    45                              <1> 	%endmacro
    46                              <1> %define _no386 comment
    47                              <1> %elif _ONLYNON386
    48                              <1> 		; Default patch macros if only running on non-386.
    49                              <1> %define _386_o32
    50                              <1> %define _386_a32
    51                              <1> %define _386_jmps comment
    52                              <1> %define _386_jmpn comment
    53                              <1> %define _no386_jmps jmp short
    54                              <1> %define _no386_jmpn jmp near
    55                              <1> %define _386 comment
    56                              <1> %define _no386
    57                              <1> %else
    58                              <1> 
    59                              <1> ; These macros are to make DEBUG's 386 support as small as
    60                              <1> ; possible. To achieve this, two patch tables are created
    61                              <1> ; in the initialisation code. One of the tables is used if
    62                              <1> ; the CPU is a 386+, the other one if it isn't. The bytes
    63                              <1> ; pointed to in the used table are over-written with NOP
    64                              <1> ; instructions. (The patched bytes are usually address or
    65                              <1> ; operand size prefixes or jumps that branch to 386/non-386
    66                              <1> ; code.)
    67                              <1> 
    68                              <1> ; There are a few special patches that require the
    69                              <1> ; initialisation code to write specific bytes other than
    70                              <1> ; NOP instructions for lower resident memory usage.
    71                              <1> ; Two are in the run: code, three in pmentry.asm.
    72                              <1> 
    73                              <1> 	%macro patch386 2+.nolist
    74                              <1> %ifidn _CURRENT_SECTION, lDEBUG_CODE
    75                              <1>  %define PATCH_%{1}386_TABLE %[PATCH_%{1}386_TABLE], %2
    76                              <1> %elifidn _CURRENT_SECTION, lDEBUG_CODE2
    77                              <1>  %define PATCH_%{1}386_TABLE2 %[PATCH_%{1}386_TABLE2], %2
    78                              <1> %elifidn _CURRENT_SECTION, lDEBUG_DATA_ENTRY
    79                              <1>  %define PATCH_%{1}386_TABLEENTRY %[PATCH_%{1}386_TABLEENTRY], %2
    80                              <1> %else
    81                              <1>  %error Wrong section
    82                              <1> %endif
    83                              <1> 	%endmacro
    84                              <1> 
    85                              <1> %if _WPT_LABELS
    86                              <1> 	; These forms provide verbose info by defining a
    87                              <1> 	; meaningful label for each patch. That fills up
    88                              <1> 	; the map file and might take longer though.
    89                              <1> 		; Operand size 32-bit prefix if 386+ CPU
    90                              <1> 	%macro _386_o32 0-1+.nolist
    91                              <1> %%386_o32:	o32
    92                              <1> patch386 NO, %%386_o32
    93                              <1> 		%1
    94                              <1> 	%endmacro
    95                              <1> 
    96                              <1> 		; Address size 32-bit prefix if 386+ CPU
    97                              <1> 	%macro _386_a32 0-1+.nolist
    98                              <1> %%386_a32:	a32
    99                              <1> patch386 NO, %%386_a32
   100                              <1> 		%1
   101                              <1> 	%endmacro
   102                              <1> 
   103                              <1> 		; Short jump if 386+ CPU
   104                              <1> 	%macro _386_jmps 1.nolist
   105                              <1> %%386_jmps:	jmp short %1
   106                              <1> patch386 NO, %%386_jmps,%%386_jmps+1
   107                              <1> 	%endmacro
   108                              <1> 
   109                              <1> 		; Near jump if 386+ CPU
   110                              <1> 	%macro _386_jmpn 1.nolist
   111                              <1> %%386_jmpn:	jmp near %1
   112                              <1> patch386 NO, %%386_jmpn,%%386_jmpn+1,%%386_jmpn+2
   113                              <1> 	%endmacro
   114                              <1> 
   115                              <1> 		; Short jump if no 386+ CPU
   116                              <1> 	%macro _no386_jmps 1.nolist
   117                              <1> %%no386_jmps:	jmp short %1
   118                              <1> patch386 , %%no386_jmps,%%no386_jmps+1
   119                              <1> 	%endmacro
   120                              <1> 
   121                              <1> 		; Near jump if no 386+ CPU
   122                              <1> 	%macro _no386_jmpn 1.nolist
   123                              <1> %%no386_jmpn:	jmp near %1
   124                              <1> patch386 , %%no386_jmpn,%%no386_jmpn+1,%%no386_jmpn+2
   125                              <1> 	%endmacro
   126                              <1> 
   127                              <1> 		; Instruction if 386+ CPU
   128                              <1> 	%macro _386 0-1+.nolist
   129                              <1> [cpu 386]			; change CPU type
   130                              <1> %%386_instr:	%1		; write instruction
   131                              <1> __CPU__				; reset CPU type
   132                              <1> 
   133                              <1> %assign %%INSTRCOUNT 0
   134                              <1> %rep $-%%386_instr		; count size of instruction
   135                              <1>  patch386 NO, %%386_instr+%[%%INSTRCOUNT]
   136                              <1> 				; write a patch for each byte
   137                              <1>  %assign %%INSTRCOUNT %%INSTRCOUNT+1
   138                              <1> %endrep
   139                              <1> %undef %%INSTRCOUNT
   140                              <1> 	%endmacro
   141                              <1> 
   142                              <1> 		; Instruction if no 386+ CPU
   143                              <1> 	%macro _no386 0-1+.nolist
   144                              <1> %%no386_instr:	%1		; write instruction
   145                              <1> 
   146                              <1> %assign %%INSTRCOUNT 0
   147                              <1> %rep $-%%no386_instr		; count size of instruction
   148                              <1>  patch386 , %%no386_instr+%[%%INSTRCOUNT]
   149                              <1> 				; write a patch for each byte
   150                              <1>  %assign %%INSTRCOUNT %%INSTRCOUNT+1
   151                              <1> %endrep
   152                              <1> %undef %%INSTRCOUNT
   153                              <1> 	%endmacro
   154                              <1> %else	; 0
   155                              <1> 		; Operand size 32-bit prefix if 386+ CPU
   156                              <1> 	%macro _386_o32 0-1+.nolist
   157                              <1> _386		o32
   158                              <1> 		%1
   159                              <1> 	%endmacro
   160                              <1> 
   161                              <1> 		; Address size 32-bit prefix if 386+ CPU
   162                              <1> 	%macro _386_a32 0-1+.nolist
   163                              <1> _386		a32
   164                              <1> 		%1
   165                              <1> 	%endmacro
   166                              <1> 
   167                              <1> 		; Short jump if 386+ CPU
   168                              <1> 	%macro _386_jmps 1.nolist
   169                              <1> _386		jmp short %1
   170                              <1> 	%endmacro
   171                              <1> 
   172                              <1> 		; Near jump if 386+ CPU
   173                              <1> 	%macro _386_jmpn 1.nolist
   174                              <1> _386		jmp near %1
   175                              <1> 	%endmacro
   176                              <1> 
   177                              <1> 		; Short jump if no 386+ CPU
   178                              <1> 	%macro _no386_jmps 1.nolist
   179                              <1> _no386		jmp short %1
   180                              <1> 	%endmacro
   181                              <1> 
   182                              <1> 		; Near jump if no 386+ CPU
   183                              <1> 	%macro _no386_jmpn 1.nolist
   184                              <1> _no386		jmp near %1
   185                              <1> 	%endmacro
   186                              <1> 
   187                              <1> 		; Instruction if 386+ CPU
   188                              <1> 	%macro _386 0-1+.nolist
   189                              <1> %push
   190                              <1> [cpu 386]			; change CPU type
   191                              <1> %assign %$entry $ + _CURRENT_SECTION %+ FIXUP
   192                              <1> 		%1		; write instruction
   193                              <1> __CPU__				; reset CPU type
   194                              <1> 
   195                              <1> %rep ($ + _CURRENT_SECTION %+ FIXUP) - %$entry
   196                              <1> 				; count size of instruction
   197                              <1>  patch386 NO, %[%$entry]	; write a patch for each byte
   198                              <1>  %assign %$entry %$entry+1
   199                              <1> %endrep
   200                              <1> %pop
   201                              <1> 	%endmacro
   202                              <1> 
   203                              <1> 		; Instruction if no 386+ CPU
   204                              <1> 	%macro _no386 0-1+.nolist
   205                              <1> %push
   206                              <1> %assign %$entry $ + _CURRENT_SECTION %+ FIXUP
   207                              <1> 		%1		; write instruction
   208                              <1> 
   209                              <1> %rep ($ + _CURRENT_SECTION %+ FIXUP) - %$entry
   210                              <1> 				; count size of instruction
   211                              <1>  patch386 , %[%$entry]		; write a patch for each byte
   212                              <1>  %assign %$entry %$entry+1
   213                              <1> %endrep
   214                              <1> %pop
   215                              <1> 	%endmacro
   216                              <1> %endif	; 1
   217                              <1> 
   218                              <1> 
   219                              <1> %endif
   220                              <1> 
   221                              <1> 		; Patch macros but for cases where the 386+
   222                              <1> 		; instructions should only be generated for
   223                              <1> 		; DEBUGX (i.e. for 32-bit DPMI addressing code).
   224                              <1> %if _PM
   225                              <1> %define _386_PM_o32	_386_o32
   226                              <1> %define _386_PM_a32	_386_a32
   227                              <1> %define _386_PM_jmps	_386_jmps
   228                              <1> %define _386_PM_jmpn	_386_jmpn
   229                              <1> %define _386_PM		_386
   230                              <1> %else
   231                              <1> %define _386_PM_o32
   232                              <1> %define _386_PM_a32
   233                              <1> %define _386_PM_jmps	comment
   234                              <1> %define _386_PM_jmpn	comment
   235                              <1> %define _386_PM		comment
   236                              <1> %endif
   237                              <1> 
   238                              <1> 
   239                              <1> %macro __writepatchtable2 0-*.nolist
   240                              <1> %if %0 & 1
   241                              <1>  %fatal Expected even number of arguments
   242                              <1> %endif
   243                              <1> %rep %0 >> 1
   244                              <1> 	%1 %2
   245                              <1> %rotate 2
   246                              <1> %endrep
   247                              <1> %endmacro
   248                              <1> 
   249                              <1> %macro __patchtable2_entry 0.nolist
   250                              <1>   ; only if this isn't the first (pseudo-)entry
   251                              <1>   %if %$lastcount != 0
   252                              <1>     %assign %$runscount %[%$runscount]+1
   253                              <1>    ; if the offset from %$previous is less than 255
   254                              <1>    %if (%$last-%$previous) < 255
   255                              <1>     %assign %$$method2tablesize %$$method2tablesize+1
   256                              <1>     ; then write a single byte (number of bytes not to patch between)
   257                              <1>     %xdefine %$$method2list %$$method2list,db,%$last-%$previous
   258                              <1>    %else
   259                              <1>     ; otherwise write a 255 ("reposition") and write the 16-bit address afterwards
   260                              <1>     %assign %$$method2tablesize %$$method2tablesize+3
   261                              <1>     %xdefine %$$method2list %$$method2list,db,255,dw,%$last
   262                              <1>     %assign %$reposcount %[%$reposcount]+1
   263                              <1>    %endif
   264                              <1>    %if %$lastcount == 1
   265                              <1>     %assign %$onecount %[%$onecount]+1
   266                              <1>    %endif
   267                              <1>    %assign %$$method2tablesize %$$method2tablesize+1
   268                              <1>    ; and write the number of bytes to be patched
   269                              <1>    %xdefine %$$method2list %$$method2list,db,%$lastcount
   270                              <1>    ; define %$previous for the next entry: it points to the next non-patched byte
   271                              <1>    %define %$previous (%[%$last]+%[%$lastcount])
   272                              <1>   %endif
   273                              <1> %endmacro
   274                              <1> 
   275                              <1> %macro writepatchtable 2-*.nolist
   276                              <1> 
   277                              <1> 	numdef %{1}_FORCE_METHOD, 0
   278                              <1> %push
   279                              <1> 		; Determine length of simple table:
   280                              <1> %assign %$method1tablesize (%0 - 2)*2
   281                              <1> 
   282                              <1> %if !_%{1}_FORCE_METHOD || _%{1}_FORCE_METHOD == 2
   283                              <1> 		; Determine length of complicated table:
   284                              <1> %assign %$method2tablesize 0
   285                              <1> %define %$method2list db,""
   286                              <1> %push
   287                              <1> %if _WPT_LABELS
   288                              <1>  %define %$previous code_start	; if list contains labels
   289                              <1> %else
   290                              <1>  %define %$previous 0
   291                              <1> %endif
   292                              <1> %define %$last %[%$previous]
   293                              <1> %assign %$lastcount 0
   294                              <1> %assign %$onecount 0
   295                              <1> %assign %$reposcount 0
   296                              <1> %assign %$bytescount %0 - 2
   297                              <1> %assign %$runscount 0
   298                              <1> %rotate 1
   299                              <1> %rep %0 - 2
   300                              <1>  %rotate 1
   301                              <1>  ;if  it continues the previous patch   and not too long   and this isn't the first
   302                              <1>  %if ((%$last+%$lastcount) == %1) && (%$lastcount < 255) && (%$lastcount != 0)
   303                              <1>   ; then do not write an entry, just increase the patch's size
   304                              <1>   %assign %$lastcount %[%$lastcount]+1
   305                              <1>  %else
   306                              <1>   ; otherwise write the last entry
   307                              <1>   __patchtable2_entry
   308                              <1>   ; define new %$last to this parameter, %$lastcount to one
   309                              <1>   %define %$last %1
   310                              <1>   %assign %$lastcount 1
   311                              <1>  %endif
   312                              <1> %endrep
   313                              <1> __patchtable2_entry
   314                              <1> 
   315                              <1> ; at the end, there's a patch with offset 0, size 0
   316                              <1> %assign %$$method2tablesize %$$method2tablesize+2
   317                              <1> %xdefine %$$method2list %$$method2list,db,0,db,0
   318                              <1> 
   319                              <1> %assign %$$onecount %$onecount
   320                              <1> %assign %$$reposcount %$reposcount
   321                              <1> %assign %$$bytescount %$bytescount
   322                              <1> %assign %$$runscount %$runscount
   323                              <1> %pop
   324                              <1> %rotate 1
   325                              <1> %endif
   326                              <1> 
   327                              <1> %if _%{1}_FORCE_METHOD == 2
   328                              <1>  %define __%{1}_method 2
   329                              <1> %elif _%{1}_FORCE_METHOD == 1
   330                              <1>  %define __%{1}_method 1
   331                              <1> %else
   332                              <1>  %if _%{1}_FORCE_METHOD
   333                              <1>   %fatal Invalid forced method selected: _%{1}_FORCE_METHOD
   334                              <1>  %endif
   335                              <1>  %if %$method1tablesize > (%$method2tablesize+20)
   336                              <1>   %define __%{1}_method 2
   337                              <1>  %else
   338                              <1>   %define __%{1}_method 1
   339                              <1>  %endif
   340                              <1> %endif
   341                              <1> 
   342                              <1> 
   343                              <1> %1:
   344                              <1> %if __%{1}_method == 2
   345                              <1> 	__writepatchtable2 %$method2list
   346                              <1> 	endarea %1
   347                              <1> %assign %$size %1_size
   348                              <1> %warning %1: %$size bytes (Method 2)
   349                              <1> %warning 1B=%$onecount repo=%$reposcount run=%$runscount byte=%$bytescount
   350                              <1> %else
   351                              <1> %rotate 1
   352                              <1> %rep %0 - 2
   353                              <1> %rotate 1
   354                              <1> 	dw %1
   355                              <1> %endrep
   356                              <1> %rotate 1
   357                              <1> 	endarea %1
   358                              <1> %assign %$size %1_size
   359                              <1> %warning %1: %$size bytes (Method 1)
   360                              <1> %endif
   361                              <1> %pop
   362                              <1> %endmacro
   262                                  
   263                                  %include "ssshared.asm"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug S commands (search, sleep)
     5                              <1> 
     6                              <1> Copyright (C) 1995-2003 Paul Vojta
     7                              <1> Copyright (C) 2008-2025 E. C. Masloch
     8                              <1> 
     9                              <1> Usage of the works is permitted provided that this
    10                              <1> instrument is retained with the works, so that any entity
    11                              <1> that uses the works is notified of this instrument.
    12                              <1> 
    13                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                              <1> 
    15                              <1> %endif
    16                              <1> 
    17                              <1> 
    18                              <1> 	usesection lDEBUG_CODE
    19                              <1> 
    20                              <1> ..@sss_access_start:
    21                              <1> 
    22                              <1> 		; S command - search for a string of bytes.
    23                              <1> sss:
    24                              <1>  %ifn ELD
    25                              <1> 	dec si
    26                              <1> 	dec si			; -> at 'S'
    27                              <1> 	mov dx, msg.sleep
    28                              <1> 	call isstring?		; check for "SLEEP"
    29                              <1> 	je sleepcmd
    30                              <1> 	inc si			; skip 'S'
    31                              <1> 	lodsb			; load next
    32                              <1>  %endif
    33                              <1> 
    34                              <1> %if _LOADER
    35                              <1> 	jmp error
    36                              <1> %else
    37                              <1> %if _SREVERSE
    38 000000D6 8026[0300]7F        <1> reloc	clropt [relocated(internalflags3)], dif3_sss_is_reverse
    39                              <1> linkdatarelocation internalflags3, -3
    40                              <1> %endif
    41                              <1> 
    42 000000DB 8B1E[0000]          <1> reloc	mov bx, word [relocated(reg_ds)]	; get search range
    43                              <1> linkdatarelocation reg_ds
    44 000000DF 66                  <1> 	_386_PM_o32		; xor ecx, ecx
    45 000000E0 31C9                <1> 	xor cx, cx
    46 000000E2 E82307              <1> 	extcallcall getrangeX	; get address range into BX:(E)DX..BX:(E)CX
    47 000000E5 E82807              <1> 	extcallcall skipcomm0
    48 000000E8 66                  <1> 	_386_PM_o32		; push edx
    49 000000E9 52                  <1> 	push dx
    50 000000EA 66                  <1> 	_386_PM_o32		; push ecx
    51 000000EB 51                  <1> 	push cx
    52 000000EC 53                  <1> 	push bx
    53                              <1> 
    54 000000ED C606[0000]00        <1> reloc	mov byte [relocated(sss_silent_count_used)], 0
    55                              <1> linkdatarelocation sss_silent_count_used, -3
    56                              <1> %if ELD
    57 000000F2 C606[8A00]00        <1> reloc	mov byte [tagbuffer], 0	; clear caps and wild flags for scasb
    58                              <1> internaldatarelocation -3
    59 000000F7 C606[E601]00        <1> reloc	mov byte [sss_range_used], 0
    60                              <1> internaldatarelocation -3
    61 000000FC C706[E401][8605]    <1> reloc2	mov word [sss_repe_cmpsb_for_range], do_repe_cmpsb
    62                              <1> internaldatarelocation -4
    63                              <1> internalcoderelocation
    64                              <1> %endif
    65                              <1> 
    66                              <1> %if _SREVERSE
    67 00000102 BA[3C00]            <1> reloc	mov dx, msg.reverse
    68                              <1> internaldatarelocation
    69 00000105 4E                  <1> 	dec si
    70 00000106 E8CF06              <1> 	extcallcall isstring?
    71 00000109 7509                <1> 	jne @F
    72                              <1> 
    73 0000010B 800E[0300]80        <1> reloc	setopt [relocated(internalflags3)], dif3_sss_is_reverse
    74                              <1> linkdatarelocation internalflags3, -3
    75 00000110 E8BD06              <1> 	extcallcall skipcomma
    76 00000113 4E                  <1> 	dec si
    77                              <1> @@:
    78                              <1> %else
    79                              <1> 	dec si
    80                              <1> %endif
    81                              <1> 
    82 00000114 BA[2F00]            <1> reloc	mov dx, msg.silent
    83                              <1> internaldatarelocation
    84 00000117 E8BE06              <1> 	extcallcall isstring?
    85 0000011A 7516                <1> 	jne @F
    86 0000011C E8F906              <1> 	extcallcall skipequals
    87 0000011F E8FE06              <1> 	extcallcall getdword
    88 00000122 8916[0000]          <1> reloc	mov word [relocated(sss_silent_count)], dx
    89                              <1> linkdatarelocation sss_silent_count
    90 00000126 891E[0200]          <1> reloc	mov word [relocated(sss_silent_count) + 2], bx
    91                              <1> linkdatarelocation sss_silent_count
    92 0000012A F616[0000]          <1> reloc	not byte [relocated(sss_silent_count_used)]
    93                              <1> linkdatarelocation sss_silent_count_used
    94 0000012E E8DF06              <1> 	extcallcall skipcomm0
    95 00000131 4E                  <1> 	dec si
    96                              <1> @@:
    97                              <1> 
    98 00000132 BA[3600]            <1> reloc	mov dx, msg.range
    99                              <1> internaldatarelocation
   100 00000135 E8A006              <1> 	extcallcall isstring?
   101 00000138 AC                  <1> 	lodsb
   102 00000139 7534                <1> 	jne .notrange
   103                              <1> 
   104                              <1> %if ELD
   105 0000013B E8D206              <1> 	extcallcall skipcomm0
   106 0000013E 4E                  <1> 	dec si
   107 0000013F BA[2A00]            <1> reloc	mov dx, msg.caps
   108                              <1> internaldatarelocation
   109 00000142 E89306              <1> 	extcallcall isstring?
   110 00000145 AC                  <1> 	lodsb
   111 00000146 750E                <1> 	jne .notrangecaps
   112 00000148 E8C506              <1> 	extcallcall skipcomm0
   113                              <1> 
   114 0000014B 800E[8A00]02        <1> reloc	or byte [tagbuffer], 2	; set caps flag for scasb
   115                              <1> internaldatarelocation -3
   116 00000150 C706[E401][8D05]    <1> reloc2	mov word [sss_repe_cmpsb_for_range], do_repe_cmpsb_caps
   117                              <1> internaldatarelocation -4
   118                              <1> internalcoderelocation
   119                              <1> .notrangecaps:
   120                              <1> %endif
   121                              <1> 
   122 00000156 8B1E[0000]          <1> reloc	mov bx, word [relocated(reg_ds)]	; get search range
   123                              <1> linkdatarelocation reg_ds
   124 0000015A 31C9                <1> 	xor cx, cx
   125 0000015C E8A906              <1> 	extcallcall getrangeX	; try to get second range
   126 0000015F 56                  <1> 	push si
   127 00000160 E88506              <1> 	extcallcall chkeol	; and insure end-of-line
   128                              <1> 				; successful if it returned
   129 00000163 66                  <1> 	_386_PM_o32		; mov esi, edx
   130 00000164 89D6                <1> 	mov si, dx		; bx:esi-> source string
   131 00000166 66                  <1> 	_386_PM_o32		; sub ecx, edx
   132 00000167 29D1                <1> 	sub cx, dx		; ecx = count - 1
   133                              <1> %if ELD
   134 00000169 F616[E601]          <1> reloc	not byte [sss_range_used]
   135                              <1> internaldatarelocation
   136                              <1> %endif
   137 0000016D EB2F                <1> 	jmp short .setesedi
   138                              <1> 
   139                              <1> .notrange:
   140                              <1> %if ELD
   141 0000016F E83A05              <1> 	call getstr_sss		; get string of bytes
   142                              <1> %else
   143                              <1> 	nearcall getstr
   144                              <1> %endif
   145 00000172 56                  <1> 	push si
   146 00000173 81EF[0000]          <1> reloc	sub di, strict word relocated(line_out)
   147                              <1> 				; di = number of bytes to look for
   148                              <1> linkdatarelocation line_out
   149 00000177 7503E94706          <1> 	jz error
   150 0000017C 89F9                <1> 	mov cx, di
   151 0000017E 4F                  <1> 	dec di			;     minus one
   152 0000017F BE[0000]            <1> reloc	mov si, relocated(line_out)
   153                              <1> linkdatarelocation line_out
   154 00000182 57                  <1> 	push di
   155                              <1> 
   156                              <1> %if _SWHILEBUFFER && ! ELD
   157                              <1>  %if _WHILEBUFFSIZE < 264
   158                              <1>   %error WHILE buffer not large enough for search pattern
   159                              <1>  %endif
   160                              <1> 	testopt [internalflags], tt_while
   161                              <1> 	jnz .use_auxbuff
   162                              <1> 	mov di, while_buffer
   163                              <1> 	push di
   164                              <1> 	rep movsb
   165                              <1> 	pop si
   166                              <1> _386_PM	movzx esi, si
   167                              <1> 	jmp .use_whilebuffer
   168                              <1> %endif
   169                              <1> 
   170                              <1> %if 1 && ELD
   171 00000183 81F90801            <1> 	cmp cx, patternbuffer.size
   172 00000187 7603E93706          <1> 	ja error
   173 0000018C BF[D600]            <1> reloc	mov di, patternbuffer
   174                              <1> internaldatarelocation
   175 0000018F 57                  <1> 	push di
   176 00000190 F3A4                <1> 	rep movsb
   177 00000192 5E                  <1> 	pop si
   178 00000193 660FB7F6            <1> _386_PM	movzx esi, si
   179                              <1> 	; jmp .use_whilebuffer
   180                              <1> %else
   181                              <1> .use_auxbuff:
   182                              <1> 	extcallcall guard_auxbuff
   183                              <1> reloc	mov es, word [relocated(auxbuff_segorsel)]
   184                              <1> linkdatarelocation auxbuff_segorsel
   185                              <1> 	xor di, di
   186                              <1> 	rep movsb		; move to auxbuff
   187                              <1> 	_386_PM_o32	; xor esi, esi
   188                              <1> 	xor si, si
   189                              <1> %endif
   190                              <1> .use_whilebuffer:
   191 00000197 8CC3                <1> 	mov bx, es		; bx:esi -> auxbuff
   192 00000199 59                  <1> 	pop cx
   193 0000019A 660FB7C9            <1> _386_PM	movzx ecx, cx		; ecx = count - 1
   194                              <1> .setesedi:
   195                              <1> %if _SCOUNT || ELD
   196 0000019E 53                  <1> 	push bx
   197 0000019F E8[0000]EB020000    <1> 	extcall count_store, optional
   198 000001A6 5B                  <1> 	pop bx
   199                              <1> %endif
   200 000001A7 16                  <1> 	push ss
   201 000001A8 07                  <1> 	pop es
   202 000001A9 BF[0000]            <1> reloc	mov di, relocated(search_results)
   203                              <1> linkdatarelocation search_results
   204 000001AC 51                  <1> 	push cx
   205                              <1> %if ELD
   206                              <1> 	houdini
   207 000001AD B9[0000]            <1> reloc	mov cx, relocated(search_results_amount)
   208                              <1> linkdatarelocation search_results_amount
   209 000001B0 B8[0000]            <1> reloc	mov ax, relocated(0)
   210                              <1> linkdatarelocation build_option_PM
   211 000001B3 85C0                <1> 	test ax, ax
   212 000001B5 7402                <1> 	jz @F
   213 000001B7 89C8                <1> 	mov ax, cx
   214                              <1> @@:
   215 000001B9 01C9                <1> 	add cx, cx		; times 2
   216 000001BB 01C1                <1> 	add cx, ax		; PM: times 3, else: times 2
   217                              <1> %elif _PM
   218                              <1> 	mov cx, (6 * search_results_amount) >> 1
   219                              <1> %else
   220                              <1> 	mov cx, (4 * search_results_amount) >> 1
   221                              <1> %endif
   222 000001BD 31C0                <1> 	xor ax, ax
   223 000001BF A3[0000]            <1> reloc	mov word [relocated(sscounter)], ax
   224                              <1> linkdatarelocation sscounter
   225 000001C2 A3[0200]            <1> reloc	mov word [relocated(sscounter) + 2], ax
   226                              <1> linkdatarelocation sscounter
   227 000001C5 F3AB                <1> 	rep stosw
   228 000001C7 59                  <1> 	pop cx
   229                              <1> 
   230                              <1>  %if ELD
   231 000001C8 F606[8A00]03        <1> reloc	test byte [tagbuffer + 0], 3
   232                              <1> internaldatarelocation -3
   233 000001CD 7408                <1> 	jz .simple
   234                              <1> .difficult:
   235 000001CF B8[E405]            <1> reloc	mov ax, difficult_scasb
   236                              <1> internalcoderelocation
   237 000001D2 BF[D305]            <1> reloc	mov di, difficult_repne_scasb
   238                              <1> internalcoderelocation
   239 000001D5 EB06                <1> 	jmp @F
   240                              <1> 
   241                              <1> .simple:
   242 000001D7 B8[8005]            <1> reloc	mov ax, do_scasb
   243                              <1> internalcoderelocation
   244 000001DA BF[7905]            <1> reloc	mov di, do_repne_scasb
   245                              <1> internalcoderelocation
   246                              <1> @@:
   247 000001DD A3[E001]            <1> reloc	mov word [sss_scasb], ax
   248                              <1> internaldatarelocation
   249 000001E0 893E[DE01]          <1> reloc	mov word [sss_repne_scasb], di
   250                              <1> internaldatarelocation
   251                              <1> 
   252 000001E4 D006[E601]          <1> reloc	rol byte [sss_range_used], 1
   253                              <1> internaldatarelocation
   254 000001E8 7216                <1> 	jc .simple_match
   255 000001EA 31C0                <1> 	xor ax, ax
   256 000001EC BF[8A00]            <1> reloc	mov di, tagbuffer
   257                              <1> internaldatarelocation
   258 000001EF 51                  <1> 	push cx
   259 000001F0 B92600              <1> 	mov cx, words(tagbuffer.size)
   260 000001F3 F3AF                <1> 	repe scasw
   261 000001F5 59                  <1> 	pop cx
   262 000001F6 7408                <1> 	je .simple_match
   263                              <1> 
   264                              <1> .difficult_match:
   265 000001F8 C706[E201][9C05]    <1> reloc2	mov word [sss_repe_cmpsb], difficult_repe_cmpsb
   266                              <1> internaldatarelocation -4
   267                              <1> internalcoderelocation
   268 000001FE EB06                <1> 	jmp @F
   269                              <1> 
   270                              <1> .simple_match:
   271 00000200 A1[E401]            <1> reloc	mov ax, word [sss_repe_cmpsb_for_range]
   272                              <1> internaldatarelocation
   273 00000203 A3[E201]            <1> reloc	mov word [sss_repe_cmpsb], ax
   274                              <1> internaldatarelocation
   275                              <1> @@:
   276                              <1>  %endif
   277 00000206 E8[0000]EB020000    <1> 	extcall prephack	; set up for the interrupt vector hack
   278 0000020D E81806              <1> 	extcallcall dohack
   279 00000210 8EDB                <1> 	mov ds, bx
   280 00000212 5F                  <1> 	pop di			; original si
   281 00000213 07                  <1> 	pop es
   282                              <1>  %if ELD
   283 00000214 B8[0000]            <1> reloc	mov ax, relocated(0)
   284                              <1> linkdatarelocation build_option_PM
   285 00000217 85C0                <1> 	test ax, ax
   286 00000219 7403                <1> 	jz @F
   287                              <1>  %endif
   288 0000021B E97B01              <1> 	_386_PM_jmpn .386init	; 386 -->
   289                              <1> @@:
   290                              <1> .init:
   291                              <1>  %if ELD
   292 0000021E 66                  <1> 	_386_PM_o32		; pop ebx
   293 0000021F 5B                  <1> 	pop bx
   294 00000220 66                  <1> 	_386_PM_o32		; pop edx
   295 00000221 5A                  <1> 	pop dx
   296                              <1>  %else
   297                              <1> 	pop bx
   298                              <1> 	pop dx
   299                              <1>  %endif
   300                              <1> .init_popped:
   301 00000222 29D3                <1> 	sub bx, dx		; bx = number of bytes in search range minus one
   302 00000224 29CB                <1> 	sub bx, cx		; = number of possible positions of string minus 1
   303 00000226 7303E96401          <1> 	jb .error_unhack_di
   304 0000022B 89D7                <1> 	mov di, dx
   305 0000022D 89CA                <1> 	mov dx, cx
   306 0000022F 89D9                <1> 	mov cx, bx
   307                              <1> 
   308                              <1> 		; ds:si-> search string, length (dx+1)
   309                              <1> 		; es:di-> data to search in, (cx+1) bytes
   310                              <1> %if _SREVERSE
   311 00000231 36F606[0300]80      <1> reloc	testopt [ss:relocated(internalflags3)], dif3_sss_is_reverse
   312                              <1> linkdatarelocation internalflags3, -3
   313 00000237 751F                <1> 	jnz .reverse
   314                              <1> %endif
   315                              <1> .loop:
   316 00000239 0C01                <1> 	or al, 1		; NZ (iff cx==0, repne scasb doesn't change ZF)
   317 0000023B 56                  <1> 	push si
   318 0000023C AC                  <1> 	lodsb			; first character in al
   319                              <1>  %if ELD
   320 0000023D F8                  <1> _386_PM	clc
   321 0000023E 36FF16[DE01]        <1> reloc	call near [ss:sss_repne_scasb]
   322                              <1> internaldatarelocation
   323                              <1>  %else
   324                              <1> 	repne scasb		; look for first byte
   325                              <1>  %endif
   326 00000243 740D                <1> 	je .foundbyte
   327                              <1>  %if ELD
   328 00000245 F8                  <1> _386_PM	clc
   329 00000246 36FF16[E001]        <1> reloc	call near [ss:sss_scasb]
   330                              <1> internaldatarelocation
   331                              <1>  %else
   332                              <1> 	scasb			; count in cx was cnt-1
   333                              <1>  %endif
   334 0000024B 753F                <1> 	jne .done
   335                              <1> .found_last_byte:
   336 0000024D E86000              <1> 	call .handle_found_byte
   337 00000250 EB3A                <1> 	jmp .done
   338                              <1> 
   339                              <1> .foundbyte:
   340 00000252 E85B00              <1> 	call .handle_found_byte
   341 00000255 5E                  <1> 	pop si
   342 00000256 EBE1                <1> 	jmp .loop		; cx = 0 if one to search,
   343                              <1> 				;  cx = 1 if two to search, etc
   344                              <1> 
   345                              <1> %if _SREVERSE
   346                              <1> .reverse:
   347 00000258 01CF                <1> 	add di, cx		; -> last position to check
   348                              <1> .reverseloop:
   349 0000025A 0C01                <1> 	or al, 1		; NZ (iff cx==0, repne scasb doesn't change ZF)
   350 0000025C 56                  <1> 	push si
   351 0000025D AC                  <1> 	lodsb			; first character in al
   352 0000025E FD                  <1> 	std			; no AMD erratum workaround needed
   353                              <1>  %if ELD
   354 0000025F F8                  <1> _386_PM	clc
   355 00000260 36FF16[DE01]        <1> reloc	call near [ss:sss_repne_scasb]
   356                              <1> internaldatarelocation
   357                              <1>  %else
   358                              <1> 	repne scasb		; look for first byte
   359                              <1>  %endif
   360 00000265 7416                <1> 	je .reversefoundbyte
   361                              <1>  %if ELD
   362 00000267 F8                  <1> _386_PM	clc
   363 00000268 36FF16[E001]        <1> reloc	call near [ss:sss_scasb]
   364                              <1> internaldatarelocation
   365                              <1>  %else
   366                              <1> 	scasb			; count in cx was cnt-1
   367                              <1>  %endif
   368 0000026D 751D                <1> 	jne .done
   369                              <1> .reversefound_last_byte:
   370 0000026F FC                  <1> 	cld
   371 00000270 83C702              <1> 	add di, 2
   372 00000273 38C0                <1> 	cmp al, al		; ZR for case if dx = 0
   373 00000275 E83800              <1> 	call .handle_found_byte
   374 00000278 83EF02              <1> 	sub di, 2
   375 0000027B EB0F                <1> 	jmp .done
   376                              <1> 
   377                              <1> .reversefoundbyte:
   378 0000027D FC                  <1> 	cld
   379 0000027E 83C702              <1> 	add di, 2
   380 00000281 38C0                <1> 	cmp al, al		; ZR for case if dx = 0
   381 00000283 E82A00              <1> 	call .handle_found_byte
   382 00000286 83EF02              <1> 	sub di, 2
   383 00000289 5E                  <1> 	pop si
   384 0000028A EBCE                <1> 	jmp .reverseloop	; cx = 0 if one to search,
   385                              <1> 				;  cx = 1 if two to search, etc
   386                              <1> %endif
   387                              <1> 
   388                              <1> .done:
   389 0000028C 5E                  <1> 	pop si			; discard
   390                              <1> .commondone:
   391 0000028D FC                  <1> 	cld
   392 0000028E 16                  <1> 	push ss
   393 0000028F 1F                  <1> 	pop ds
   394 00000290 E89D05              <1> 	extcallcall unhack
   395 00000293 BF[0000]            <1> reloc	mov di, relocated(line_out)
   396                              <1> linkdatarelocation line_out
   397                              <1> 
   398 00000296 A1[0200]            <1> reloc	mov ax, word [relocated(sscounter) + 2]
   399                              <1> linkdatarelocation sscounter
   400 00000299 85C0                <1> 	test ax, ax
   401 0000029B 7403                <1> 	jz .nohighcounter
   402 0000029D E89805              <1> 	extcallcall hexword
   403                              <1> .nohighcounter:
   404                              <1> 
   405 000002A0 A1[0000]            <1> reloc	mov ax, word [relocated(sscounter)]
   406                              <1> linkdatarelocation sscounter
   407 000002A3 E89205              <1> 	extcallcall hexword
   408 000002A6 E89705              <1> 	extcallcall putsline
   409 000002A9 BA[4400]            <1> reloc	mov dx, msg.matches
   410                              <1> internaldatarelocation
   411                              <1> %if ELD
   412 000002AC E84905              <1> 	extcallcall putsz
   413 000002AF C3                  <1> 	retn
   414                              <1> %else
   415                              <1> 	jmp putsz
   416                              <1> %endif
   417                              <1> 
   418                              <1> 
   419                              <1> 		; INP:	ZR
   420                              <1> .handle_found_byte:
   421 000002B0 51                  <1> 	push cx
   422 000002B1 57                  <1> 	push di
   423 000002B2 89D1                <1> 	mov cx, dx
   424                              <1>  %if ELD
   425 000002B4 F8                  <1> _386_PM	clc
   426 000002B5 36FF16[E201]        <1> reloc	call near [ss:sss_repe_cmpsb]
   427                              <1> internaldatarelocation
   428                              <1>  %else
   429                              <1> 	repe cmpsb		; compare string behind first byte
   430                              <1>  %endif
   431                              <1> 		; If we're searching for a single-byte value then
   432                              <1> 		;  dx is equal to zero here. In that case cx gets
   433                              <1> 		;  the value zero and then repe cmpsb does not
   434                              <1> 		;  alter ZF, meaning it will stay ZR (as noted for
   435                              <1> 		;  the comment INP section).
   436 000002BA 5F                  <1> 	pop di
   437 000002BB 7402                <1> 	je .display		; if equal
   438                              <1> .next:
   439 000002BD 59                  <1> 	pop cx
   440 000002BE C3                  <1> 	retn
   441                              <1> 
   442                              <1> .display:
   443 000002BF 8CC3                <1> 	mov bx, es
   444 000002C1 57                  <1> 	push di
   445 000002C2 1E                  <1> 	push ds
   446 000002C3 06                  <1> 	push es
   447 000002C4 16                  <1> 	 push ss
   448 000002C5 1F                  <1> 	 pop ds
   449 000002C6 E86705              <1> 	extcallcall unhack	; undo the interrupt vector hack and restore es
   450 000002C9 57                  <1> 	push di
   451 000002CA 833E[0200]00        <1> reloc	cmp word [relocated(sscounter) + 2], strict byte 0
   452                              <1> linkdatarelocation sscounter, -3
   453 000002CF 752E                <1> 	jne @F
   454 000002D1 8B3E[0000]          <1> reloc	mov di, word [relocated(sscounter)]
   455                              <1> linkdatarelocation sscounter
   456 000002D5 81FF[0000]          <1> reloc	cmp di, strict word relocated(search_results_amount)
   457                              <1> linkdatarelocation search_results_amount
   458 000002D9 7324                <1> 	jae @F
   459                              <1> %if ELD && _PM
   460 000002DB B8[0000]            <1> reloc	mov ax, relocated(0)
   461                              <1> linkdatarelocation build_option_PM
   462 000002DE 01FF                <1> 	add di, di		; times 2
   463 000002E0 85C0                <1> 	test ax, ax		; PM build ?
   464 000002E2 7402                <1> 	jz .idxnotpm		; no --> (ax == zero)
   465 000002E4 89F8                <1> 	mov ax, di		; = times 2
   466                              <1> .idxnotpm:
   467 000002E6 01FF                <1> 	add di, di		; times 4
   468 000002E8 01C7                <1> 	add di, ax		; _PM: times 4 + times 2 = times 6, else: times 4
   469                              <1> %elif _PM
   470                              <1> 	add di, di		; times 2
   471                              <1> 	mov ax, di		; = times 2
   472                              <1> 	add di, di		; times 4
   473                              <1> 	add di, ax		; times 4 + times 2 = times 6
   474                              <1> %else
   475                              <1> 	add di, di		; times 2
   476                              <1> 	add di, di		; times 4
   477                              <1> %endif
   478 000002EA 81C7[0000]          <1> reloc	add di, strict word relocated(search_results)
   479                              <1> linkdatarelocation search_results
   480                              <1> 
   481 000002EE 58                  <1> 	pop ax
   482 000002EF 50                  <1> 	push ax
   483 000002F0 48                  <1> 	dec ax
   484 000002F1 AB                  <1> 	stosw
   485                              <1> %if _PM
   486                              <1>  %if ELD
   487 000002F2 B8[0000]            <1> reloc	mov ax, relocated(0)
   488                              <1> linkdatarelocation build_option_PM
   489 000002F5 85C0                <1> 	test ax, ax
   490 000002F7 7403                <1> 	jz .storenotpm
   491                              <1>  %endif
   492 000002F9 31C0                <1> 	xor ax, ax
   493 000002FB AB                  <1> 	stosw
   494                              <1> .storenotpm:
   495                              <1> %endif
   496 000002FC 89D8                <1> 	mov ax, bx
   497 000002FE AB                  <1> 	stosw
   498                              <1> 
   499                              <1> @@:
   500 000002FF 8306[0000]01        <1> reloc	add word [relocated(sscounter)], strict byte 1
   501                              <1> linkdatarelocation sscounter, -3
   502 00000304 8316[0200]00        <1> reloc	adc word [relocated(sscounter) + 2], strict byte 0
   503                              <1> linkdatarelocation sscounter, -3
   504 00000309 D006[0000]          <1> reloc	rol byte [relocated(sss_silent_count_used)], 1
   505                              <1> linkdatarelocation sss_silent_count_used
   506 0000030D 7317                <1> 	jnc @F
   507 0000030F A1[0000]            <1> reloc	mov ax, word [relocated(sss_silent_count)]
   508                              <1> linkdatarelocation sss_silent_count
   509 00000312 0B06[0200]          <1> reloc	or ax, word [relocated(sss_silent_count) + 2]
   510                              <1> linkdatarelocation sss_silent_count
   511 00000316 58                  <1> 	pop ax
   512 00000317 52                  <1> 	push dx
   513 00000318 746B                <1> 	jz .nodisplay
   514 0000031A 5A                  <1> 	pop dx
   515 0000031B 50                  <1> 	push ax
   516 0000031C 832E[0000]01        <1> reloc	sub word [relocated(sss_silent_count)], strict byte 1
   517                              <1> linkdatarelocation sss_silent_count, -3
   518 00000321 831E[0200]00        <1> reloc	sbb word [relocated(sss_silent_count) + 2], strict byte 0
   519                              <1> linkdatarelocation sss_silent_count, -3
   520                              <1> @@:
   521 00000326 89D8                <1> 	mov ax, bx
   522 00000328 BF[0000]            <1> reloc	mov di, relocated(line_out)
   523                              <1> linkdatarelocation line_out
   524 0000032B E80A05              <1> 	extcallcall hexword	; 4 (segment)
   525 0000032E B03A                <1> 	mov al, ':'
   526 00000330 AA                  <1> 	stosb			; +1=5
   527 00000331 58                  <1> 	pop ax
   528 00000332 48                  <1> 	dec ax
   529 00000333 E80205              <1> 	extcallcall hexword
   530                              <1> %if _SDUMP
   531 00000336 F606[0200]80        <1> reloc	testopt [relocated(options)], ss_no_dump
   532                              <1> linkdatarelocation options, -3
   533 0000033B 7544                <1> 	jnz .no_dump
   534 0000033D F9                  <1> 	stc
   535 0000033E 11D0                <1> 	adc ax, dx		; -> behind result
   536 00000340 763F                <1> 	jbe .noresult		; end of segment
   537 00000342 89C6                <1> 	mov si, ax		; cannot be zero
   538                              <1> 
   539                              <1> %if _SDUMPDISPLACEMENT
   540 00000344 660FB7D2            <1> _386_PM	movzx edx, dx
   541 00000348 E8CF01              <1> 	call sss_calculate_displacement
   542                              <1> 
   543 0000034B 89FB                <1> 	mov bx, di
   544 0000034D 01C3                <1> 	add bx, ax
   545 0000034F 01C3                <1> 	add bx, ax
   546 00000351 01C3                <1> 	add bx, ax
   547                              <1> %else
   548                              <1> 	mov ax, 32<<8|32
   549                              <1> 	stosw
   550                              <1> 	lea bx, [di+3*16]
   551                              <1> %endif
   552                              <1> 
   553 00000353 89F1                <1> 	mov cx, si		; cannot be zero
   554 00000355 F7D9                <1> 	neg cx			; cannot be zero
   555                              <1> %if _SDUMPDISPLACEMENT
   556 00000357 39C1                <1> 	cmp cx, ax
   557                              <1> %else
   558                              <1> 	cmp cx, byte 16
   559                              <1> %endif
   560 00000359 7602                <1> 	jbe .cxdone
   561                              <1> %if _SDUMPDISPLACEMENT
   562 0000035B 89C1                <1> 	mov cx, ax
   563                              <1> %else
   564                              <1> 	mov cx, 16
   565                              <1> %endif
   566                              <1> .cxdone:			; cx cannot be zero
   567 0000035D 1F                  <1> 	 pop ds
   568 0000035E 1E                  <1> 	 push ds		; restore search's segment
   569                              <1> %if _SDUMPDISPLACEMENT
   570 0000035F 50                  <1> 	push ax
   571                              <1> %endif
   572 00000360 51                  <1> 	push cx
   573                              <1> .disploop:
   574 00000361 AC                  <1> 	lodsb
   575 00000362 E8E304              <1> 	extcallcall dd_store
   576 00000365 B020                <1> 	mov al, 32
   577 00000367 AA                  <1> 	stosb
   578 00000368 E2F7                <1> 	loop .disploop
   579 0000036A 59                  <1> 	pop cx
   580                              <1> %if _SDUMPDISPLACEMENT
   581 0000036B 58                  <1> 	pop ax
   582                              <1> %endif
   583 0000036C 16                  <1> 	 push ss
   584 0000036D 1F                  <1> 	 pop ds
   585 0000036E F7D9                <1> 	neg cx
   586                              <1> %if _SDUMPDISPLACEMENT
   587 00000370 01C1                <1> 	add cx, ax
   588                              <1> %else
   589                              <1> 	add cx, byte 16
   590                              <1> %endif
   591 00000372 7407                <1> 	jz .noblanks
   592                              <1> .loopblanks:
   593 00000374 B82020              <1> 	mov ax, 32<<8|32
   594 00000377 AB                  <1> 	stosw
   595 00000378 AA                  <1> 	stosb
   596 00000379 E2F9                <1> 	loop .loopblanks
   597                              <1> .noblanks:
   598 0000037B C645E72D            <1> 	mov byte [di-(1+(8*3))], '-'
   599 0000037F 89DF                <1> 	mov di, bx
   600                              <1> .noresult:
   601                              <1> .no_dump:
   602                              <1> %endif	; _SDUMP
   603 00000381 52                  <1> 	push dx
   604 00000382 E8CB04              <1> 	extcallcall putsline_crlf
   605                              <1> .nodisplay:
   606 00000385 E8A004              <1> 	extcallcall dohack
   607 00000388 5A                  <1> 	pop dx
   608 00000389 07                  <1> 	pop es
   609 0000038A 1F                  <1> 	pop ds
   610 0000038B 5F                  <1> 	pop di
   611 0000038C E92EFF              <1> 	jmp .next
   612                              <1> 
   613                              <1> 
   614                              <1> .error_unhack_di:
   615 0000038F 16                  <1> 	push ss
   616 00000390 1F                  <1> 	pop ds
   617 00000391 E89C04              <1> 	extcallcall unhack
   618 00000394 89FE                <1> 	mov si, di
   619 00000396 E92A04              <1> 	jmp error
   620                              <1> 
   621                              <1> 
   622                              <1> %if _PM
   623                              <1> 	subcpu 386
   624                              <1> 
   625                              <1> .386init:
   626 00000399 665B                <1> 	pop ebx
   627 0000039B 665A                <1> 	pop edx
   628 0000039D E85004              <1> 	extcallcall ispm
   629 000003A0 0F857EFE            <1> 	jnz .init_popped	; not PM -->
   630 000003A4 6629D3              <1> 	sub ebx, edx		; ebx = number of bytes in search range minus one
   631 000003A7 6629CB              <1> 	sub ebx, ecx		; = number of possible positions of string minus 1
   632 000003AA 72E3                <1> 	jb .error_unhack_di
   633 000003AC 6689D7              <1> 	mov edi, edx
   634 000003AF 6689CA              <1> 	mov edx, ecx
   635 000003B2 6689D9              <1> 	mov ecx, ebx
   636                              <1> 
   637                              <1> 		; ds:esi-> search string, length (edx+1)
   638                              <1> 		; es:edi-> data to search in, (ecx+1) bytes
   639                              <1> 		; Although 386+ RM still uses 64 KiB segments, it allows
   640                              <1> 		; us to use the 32-bit addressing variant of the string
   641                              <1> 		; instructions as long as we never access any byte above
   642                              <1> 		; the 64 KiB limit. (Even if the index register contains
   643                              <1> 		; 00010000h after an instruction executed.)
   644                              <1> %if _SREVERSE
   645 000003B5 36F606[0300]80      <1> reloc	testopt [ss:relocated(internalflags3)], dif3_sss_is_reverse
   646                              <1> linkdatarelocation internalflags3, -3
   647 000003BB 7522                <1> 	jnz .386reverse
   648                              <1> %endif
   649                              <1> .386loop:
   650 000003BD 0C01                <1> 	or al, 1		; NZ (iff cx==0, repne scasb doesn't change ZF)
   651 000003BF 6656                <1> 	push esi
   652 000003C1 67AC                <1> 	a32 lodsb		; first character in al
   653                              <1>  %if ELD
   654 000003C3 F9                  <1> _386_PM	stc
   655 000003C4 36FF16[DE01]        <1> reloc	call near [ss:sss_repne_scasb]
   656                              <1> internaldatarelocation
   657                              <1>  %else
   658                              <1> 	a32 repne scasb		; look for first byte
   659                              <1>  %endif
   660 000003C9 740D                <1> 	je .386foundbyte
   661                              <1>  %if ELD
   662 000003CB F9                  <1> _386_PM	stc
   663 000003CC 36FF16[E001]        <1> reloc	call near [ss:sss_scasb]
   664                              <1> internaldatarelocation
   665                              <1>  %else
   666                              <1> 	a32 scasb		; count in ecx was cnt-1
   667                              <1>  %endif
   668 000003D1 7548                <1> 	jne .386done
   669                              <1> .386found_last_byte:
   670 000003D3 E84A00              <1> 	call .386handle_found_byte
   671 000003D6 EB43                <1> 	jmp .386done
   672                              <1> 
   673                              <1> .386foundbyte:
   674 000003D8 E84500              <1> 	call .386handle_found_byte
   675 000003DB 665E                <1> 	pop esi
   676 000003DD EBDE                <1> 	jmp .386loop		; ecx = 0 if one to search,
   677                              <1> 				;  ecx = 1 if two to search, etc
   678                              <1> 
   679                              <1> %if _SREVERSE
   680                              <1> .386reverse:
   681 000003DF 6601CF              <1> 	add edi, ecx		; -> last position to check
   682                              <1> .386reverseloop:
   683 000003E2 0C01                <1> 	or al, 1		; NZ (iff cx==0, repne scasb doesn't change ZF)
   684 000003E4 6656                <1> 	push esi
   685 000003E6 67AC                <1> 	a32 lodsb		; first character in al
   686 000003E8 FD                  <1> 	std			; no AMD erratum workaround needed
   687                              <1>  %if ELD
   688 000003E9 F9                  <1> _386_PM	stc
   689 000003EA 36FF16[DE01]        <1> reloc	call near [ss:sss_repne_scasb]
   690                              <1> internaldatarelocation
   691                              <1>  %else
   692                              <1> 	a32 repne scasb		; look for first byte
   693                              <1>  %endif
   694 000003EF 7418                <1> 	je .386reversefoundbyte
   695                              <1>  %if ELD
   696 000003F1 F9                  <1> _386_PM	stc
   697 000003F2 36FF16[E001]        <1> reloc	call near [ss:sss_scasb]
   698                              <1> internaldatarelocation
   699                              <1>  %else
   700                              <1> 	a32 scasb		; count in ecx was cnt-1
   701                              <1>  %endif
   702 000003F7 7522                <1> 	jne .386done
   703                              <1> .386reversefound_last_byte:
   704 000003F9 FC                  <1> 	cld
   705 000003FA 6683C702            <1> 	add edi, 2
   706 000003FE 38C0                <1> 	cmp al, al		; ZR for case if edx = 0
   707 00000400 E81D00              <1> 	call .386handle_found_byte
   708 00000403 6683EF02            <1> 	sub edi, 2
   709 00000407 EB12                <1> 	jmp .386done
   710                              <1> 
   711                              <1> .386reversefoundbyte:
   712 00000409 FC                  <1> 	cld
   713 0000040A 6683C702            <1> 	add edi, 2
   714 0000040E 38C0                <1> 	cmp al, al		; ZR for case if edx = 0
   715 00000410 E80D00              <1> 	call .386handle_found_byte
   716 00000413 6683EF02            <1> 	sub edi, 2
   717 00000417 665E                <1> 	pop esi
   718 00000419 EBC7                <1> 	jmp .386reverseloop	; ecx = 0 if one to search,
   719                              <1> 				;  ecx = 1 if two to search, etc
   720                              <1> %endif
   721                              <1> 
   722                              <1> .386done:
   723 0000041B 665E                <1> 	pop esi			; discard
   724 0000041D E96DFE              <1> 	jmp .commondone
   725                              <1> 
   726                              <1> 
   727                              <1> 		; INP:	ZR
   728                              <1> .386handle_found_byte:
   729 00000420 6651                <1> 	push ecx
   730 00000422 6657                <1> 	push edi
   731 00000424 6689D1              <1> 	mov ecx, edx
   732                              <1>  %if ELD
   733 00000427 F9                  <1> _386_PM	stc
   734 00000428 36FF16[E201]        <1> reloc	call near [ss:sss_repe_cmpsb]
   735                              <1> internaldatarelocation
   736                              <1>  %else
   737                              <1> 	a32 repe cmpsb		; compare string behind first byte
   738                              <1>  %endif
   739                              <1> 		; If we're searching for a single-byte value then
   740                              <1> 		;  edx is equal to zero here. In that case ecx gets
   741                              <1> 		;  the value zero and then a32 repe cmpsb does not
   742                              <1> 		;  alter ZF, meaning it will stay ZR (as noted for
   743                              <1> 		;  the comment INP section).
   744 0000042D 665F                <1> 	pop edi
   745 0000042F 7403                <1> 	je .386display		; if equal
   746                              <1> .386next:
   747 00000431 6659                <1> 	pop ecx
   748 00000433 C3                  <1> 	retn
   749                              <1> 
   750                              <1> .386display:
   751 00000434 8CC3                <1> 	mov bx, es
   752 00000436 6657                <1> 	push edi
   753 00000438 1E                  <1> 	push ds
   754 00000439 06                  <1> 	push es
   755 0000043A 16                  <1> 	 push ss
   756 0000043B 1F                  <1> 	 pop ds
   757 0000043C E8F103              <1> 	extcallcall unhack	; undo the interrupt vector hack and restore es
   758 0000043F 6657                <1> 	push edi
   759 00000441 668B3E[0000]        <1> reloc	mov edi, dword [relocated(sscounter)]
   760                              <1> linkdatarelocation sscounter
   761 00000446 6681FF[00000000]    <1> reloc	cmp edi, strict dword relocated(search_results_amount)
   762                              <1> linkdatarelocation search_results_amount, -4	; low word of the dword !
   763 0000044D 7317                <1> 	jae @F
   764 0000044F 01FF                <1> 	add di, di		; * 2
   765 00000451 89F8                <1> 	mov ax, di
   766 00000453 01FF                <1> 	add di, di		; * 4
   767 00000455 01C7                <1> 	add di, ax		; * 4 + * 2 = * 6
   768 00000457 81C7[0000]          <1> reloc	add di, relocated(search_results)
   769                              <1> linkdatarelocation search_results
   770 0000045B 6658                <1> 	pop eax
   771 0000045D 6650                <1> 	push eax
   772 0000045F 6648                <1> 	dec eax
   773 00000461 66AB                <1> 	stosd
   774 00000463 89D8                <1> 	mov ax, bx
   775 00000465 AB                  <1> 	stosw
   776                              <1> 
   777                              <1> @@:
   778 00000466 66FF06[0000]        <1> reloc	inc dword [relocated(sscounter)]
   779                              <1> linkdatarelocation sscounter
   780 0000046B D006[0000]          <1> reloc	rol byte [relocated(sss_silent_count_used)], 1
   781                              <1> linkdatarelocation sss_silent_count_used
   782 0000046F 731A                <1> 	jnc @F
   783 00000471 66833E[0000]00      <1> reloc	cmp dword [relocated(sss_silent_count)], strict byte 0
   784                              <1> linkdatarelocation sss_silent_count, -3
   785 00000477 6658                <1> 	pop eax
   786 00000479 52                  <1> 	push dx
   787 0000047A 0F849100            <1> 	je .386nodisplay
   788 0000047E 5A                  <1> 	pop dx
   789 0000047F 6650                <1> 	push eax
   790 00000481 832E[0000]01        <1> reloc	sub word [relocated(sss_silent_count)], strict byte 1
   791                              <1> linkdatarelocation sss_silent_count, -3
   792 00000486 831E[0200]00        <1> reloc	sbb word [relocated(sss_silent_count) + 2], strict byte 0
   793                              <1> linkdatarelocation sss_silent_count, -3
   794                              <1> @@:
   795 0000048B 89D8                <1> 	mov ax, bx
   796 0000048D BF[0000]            <1> reloc	mov di, relocated(line_out)
   797                              <1> linkdatarelocation line_out
   798 00000490 E8A503              <1> 	extcallcall hexword	; 4 (segment)
   799 00000493 B03A                <1> 	mov al, ':'
   800 00000495 AA                  <1> 	stosb			; +1=5
   801 00000496 6658                <1> 	pop eax
   802 00000498 6648                <1> 	dec eax
   803 0000049A E8BB03              <1> 	extcallcall test_high_limit
   804 0000049D 7407                <1> 	jz .noa32
   805 0000049F E8[0000]EB020000    <1> 	extcall hexword_high, PM required
   806                              <1> .noa32:
   807 000004A6 E88F03              <1> 	extcallcall hexword
   808                              <1> %if _SDUMP
   809 000004A9 F606[0200]80        <1> reloc	testopt [relocated(options)], ss_no_dump
   810                              <1> linkdatarelocation options, -3
   811 000004AE 755B                <1> 	jnz .386_no_dump
   812 000004B0 F9                  <1> 	stc
   813 000004B1 6611D0              <1> 	adc eax, edx		; -> behind result
   814 000004B4 7655                <1> 	jbe .386noresult	; end of segment
   815 000004B6 6689C6              <1> 	mov esi, eax
   816                              <1> 		; esi is at most 10000h in a 64 KiB segment.
   817                              <1> 		;  The jcxz at .386cxdone will branch if si = 0,
   818                              <1> 		;  which is only possible if esi = 10000h.
   819                              <1> 		; esi is never zero here.
   820                              <1> 
   821                              <1> %if _SDUMPDISPLACEMENT
   822 000004B9 E85E00              <1> 	call sss_calculate_displacement
   823                              <1> %else
   824                              <1> 	mov ax, 32<<8|32
   825                              <1> 	stosw
   826                              <1> %endif
   827                              <1> 
   828 000004BC 5B                  <1> 	pop bx			; get search selector
   829 000004BD 53                  <1> 	push bx
   830 000004BE E89703              <1> 	extcallcall test_high_limit
   831 000004C1 7508                <1> 	jnz .386_high_limit
   832                              <1> 
   833                              <1> .386_low_limit:
   834 000004C3 89F1                <1> 	mov cx, si		; 0 if at end of 64 KiB limit, else nonzero
   835 000004C5 F7D9                <1> 	neg cx			; 0 if at end of 64 KiB limit, else nonzero
   836                              <1> %if _SDUMPDISPLACEMENT
   837 000004C7 39C1                <1> 	cmp cx, ax
   838                              <1> %else
   839                              <1> 	cmp cx, byte 16		; below or equal maximum dump length ?
   840                              <1> %endif
   841 000004C9 EB0D                <1> 	jmp @F
   842                              <1> 
   843                              <1> .386_high_limit:
   844 000004CB 6689F1              <1> 	mov ecx, esi		; cannot be 0
   845 000004CE 66F7D9              <1> 	neg ecx			; cannot be 0
   846                              <1> %if _SDUMPDISPLACEMENT
   847 000004D1 660FB7C0            <1> 	movzx eax, ax
   848 000004D5 6639C1              <1> 	cmp ecx, eax
   849                              <1> %else
   850                              <1> 	cmp ecx, byte 16	; below or equal maximum dump length ?
   851                              <1> %endif
   852                              <1> @@:
   853 000004D8 7602                <1> 	jbe .386cxdone		; (e)cx <= maximum dump length, use cx
   854                              <1> %if _SDUMPDISPLACEMENT
   855 000004DA 89C1                <1> 	mov cx, ax
   856                              <1> %else
   857                              <1> 	mov cx, 16		; reset cx (ecxh is not used)
   858                              <1> %endif
   859                              <1> .386cxdone:
   860 000004DC E32D                <1> 	jcxz .386noresult	; if at end of 64 KiB limit -->
   861                              <1> 		; (The displacement is already written here. Oh well.)
   862                              <1> %if _SDUMPDISPLACEMENT
   863 000004DE 89FB                <1> 	mov bx, di
   864 000004E0 01C3                <1> 	add bx, ax
   865 000004E2 01C3                <1> 	add bx, ax
   866 000004E4 01C3                <1> 	add bx, ax
   867                              <1> %else
   868                              <1> 	lea bx, [di+3*16]
   869                              <1> %endif
   870 000004E6 1F                  <1> 	 pop ds
   871 000004E7 1E                  <1> 	 push ds		; restore search's segment
   872                              <1> %if _SDUMPDISPLACEMENT
   873 000004E8 50                  <1> 	push ax
   874                              <1> %endif
   875 000004E9 51                  <1> 	push cx
   876                              <1> .386disploop:
   877 000004EA 67AC                <1> 	a32 lodsb
   878 000004EC E85903              <1> 	extcallcall dd_store
   879 000004EF B020                <1> 	mov al, 32
   880 000004F1 AA                  <1> 	stosb
   881 000004F2 E2F6                <1> 	loop .386disploop
   882 000004F4 59                  <1> 	pop cx
   883                              <1> %if _SDUMPDISPLACEMENT
   884 000004F5 58                  <1> 	pop ax
   885                              <1> %endif
   886 000004F6 16                  <1> 	 push ss
   887 000004F7 1F                  <1> 	 pop ds
   888 000004F8 F7D9                <1> 	neg cx
   889                              <1> %if _SDUMPDISPLACEMENT
   890 000004FA 01C1                <1> 	add cx, ax
   891                              <1> %else
   892                              <1> 	add cx, byte 16
   893                              <1> %endif
   894 000004FC 7407                <1> 	jz .386noblanks
   895                              <1> .386loopblanks:
   896 000004FE B82020              <1> 	mov ax, 32<<8|32
   897 00000501 AB                  <1> 	stosw
   898 00000502 AA                  <1> 	stosb
   899 00000503 E2F9                <1> 	loop .386loopblanks
   900                              <1> .386noblanks:
   901 00000505 C645E72D            <1> 	mov byte [di-(1+(8*3))], '-'
   902 00000509 89DF                <1> 	mov di, bx
   903                              <1> .386noresult:
   904                              <1> .386_no_dump:
   905                              <1> %endif	; _SDUMP
   906 0000050B 52                  <1> 	push dx
   907 0000050C E84103              <1> 	extcallcall putsline_crlf
   908                              <1> .386nodisplay:
   909 0000050F E81603              <1> 	extcallcall dohack
   910 00000512 5A                  <1> 	pop dx
   911 00000513 07                  <1> 	pop es
   912 00000514 1F                  <1> 	pop ds
   913 00000515 665F                <1> 	pop edi
   914 00000517 E917FF              <1> 	jmp .386next
   915                              <1> 
   916                              <1> subcpureset
   917                              <1> %endif	; _PM
   918                              <1> 
   919                              <1> 
   920                              <1> %if _SDUMPDISPLACEMENT
   921                              <1> 
   922                              <1> 		; INP:	(e)dx = length of pattern - 1
   923                              <1> 		;	es:di -> where to write, within line_out
   924                              <1> 		;	di <= line_out + 13
   925                              <1> 		;	di >= line_out + 9
   926                              <1> 		; OUT:	bx = table offset
   927                              <1> 		;	ax = how many bytes to dump (13 .. 16)
   928                              <1> 		; CHG:	-
   929                              <1> sss_calculate_displacement:
   930                              <1> 
   931 0000051A 31DB                <1> 	xor bx, bx
   932 0000051C 66                  <1> 	_386_PM_o32
   933 0000051D 42                  <1> 	inc dx			; = pattern length (can overflow)
   934 0000051E B306                <1> _386_PM	mov bl, 6		; dword needed
   935 00000520 66F7C2000000FF      <1> _386_PM	test edx, 0FF00_0000h
   936 00000527 7513                <1> _386_PM	jnz @F
   937 00000529 B304                <1> _386_PM	mov bl, 4		; 3byte needed
   938 0000052B 66F7C20000FF00      <1> _386_PM	test edx, 0FF_0000h
   939 00000532 7508                <1> _386_PM	jnz @F
   940 00000534 B302                <1> 	mov bl, 2		; word needed
   941 00000536 84F6                <1> 	test dh, dh
   942 00000538 7502                <1> 	jnz @F
   943 0000053A B300                <1> 	mov bl, 0		; byte needed
   944                              <1> @@:
   945                              <1> 
   946 0000053C B8202B              <1> 	mov ax, " +"
   947 0000053F AB                  <1> 	stosw			; common prefix
   948 00000540 66                  <1> 	_386_PM_o32
   949 00000541 89D0                <1> 	mov ax, dx
   950 00000543 FF97[0000]          <1> reloc	call near [word sss_displacement_write_table + bx]
   951                              <1> internaldatarelocation
   952                              <1> 				; write displacement number
   953 00000547 66                  <1> 	_386_PM_o32
   954 00000548 4A                  <1> 	dec dx			; restore
   955                              <1> 
   956 00000549 B82020              <1> 	mov ax, 32 | 32 << 8
   957 0000054C AB                  <1> 	stosw			; write blanks
   958 0000054D 89F8                <1> 	mov ax, di
   959 0000054F 2D[0000]            <1> reloc	sub ax, strict word relocated(line_out)
   960                              <1> linkdatarelocation line_out	; = length written so far (<= 25, >= 15)
   961 00000552 F7D8                <1> 	neg ax			; minus length written so far (>= -25, <= -15)
   962 00000554 83C04F              <1> 	add ax, 79		; 79 minus length written so far
   963                              <1> 				;  = how many columns remaining (>= 54, <= 64)
   964 00000557 D1E8                <1> 	shr ax, 1
   965 00000559 D1E8                <1> 	shr ax, 1		; divide by 4 (>= 13, <= 16)
   966                              <1> 				;  = how many bytes can be dumped
   967 0000055B C3                  <1> 	retn
   968                              <1> 
   969                              <1> 
   970                              <1> 	usesection lDEBUG_DATA_ENTRY
   971                              <1> 	align 2, db 0
   972                              <1> sss_displacement_write_table:
   973 00000000 [5C05]              <1> reloc	dw .byte
   974                              <1> internalcoderelocation
   975 00000002 [6005]              <1> reloc	dw .word
   976                              <1> internalcoderelocation
   977                              <1>  %if _PM && ! _ONLYNON386
   978 00000004 [6405]              <1> reloc	dw .3byte
   979                              <1> internalcoderelocation
   980 00000006 [7105]              <1> reloc	dw .dword
   981                              <1> internalcoderelocation
   982                              <1>  %endif
   983                              <1> 
   984                              <1> 	usesection lDEBUG_CODE
   985                              <1> 
   986                              <1>  %if ELD
   987                              <1> .byte:
   988 0000055C E80103              <1> 	extcallcall hexbyte
   989 0000055F C3                  <1> 	retn
   990                              <1> .word:
   991 00000560 E8D502              <1> 	extcallcall hexword
   992 00000563 C3                  <1> 	retn
   993                              <1>   %if _PM && ! _ONLYNON386
   994                              <1> .3byte:
   995                              <1>  subcpu 386
   996 00000564 66C1C810            <1> 	ror eax, 16
   997 00000568 E8F502              <1> 	extcallcall hexbyte
   998 0000056B 66C1C010            <1> 	rol eax, 16
   999                              <1>  subcpureset
  1000 0000056F EBEF                <1> 	jmp .word
  1001                              <1> .dword:
  1002 00000571 E8[0000]EB020000    <1> 	extcall hexdword, PM required
  1003 00000578 C3                  <1> 	retn
  1004                              <1>   %endif
  1005                              <1>  %else
  1006                              <1> .byte: equ hexbyte
  1007                              <1> .word: equ hexword
  1008                              <1>   %if _PM && ! _ONLYNON386
  1009                              <1> .3byte:
  1010                              <1>  subcpu 386
  1011                              <1> 	ror eax, 16
  1012                              <1> 	call hexbyte
  1013                              <1> 	rol eax, 16
  1014                              <1>  subcpureset
  1015                              <1> 	jmp .word
  1016                              <1> .dword: equ hexdword
  1017                              <1>   %endif
  1018                              <1>  %endif
  1019                              <1> %endif
  1020                              <1> 
  1021                              <1> %if ELD
  1022                              <1> do_repne_scasb:
  1023 00000579 0F829B00            <1> _386_PM	jc do_repne_scasb_a32
  1024 0000057D F2AE                <1> 	repne scasb
  1025 0000057F C3                  <1> 	retn
  1026                              <1> 
  1027                              <1> do_scasb:
  1028 00000580 0F829500            <1> _386_PM	jc do_scasb_a32
  1029 00000584 AE                  <1> 	scasb
  1030 00000585 C3                  <1> 	retn
  1031                              <1> 
  1032                              <1> do_repe_cmpsb:
  1033 00000586 0F829200            <1> _386_PM	jc do_repe_cmpsb_a32
  1034 0000058A F3A6                <1> 	repe cmpsb
  1035 0000058C C3                  <1> 	retn
  1036                              <1> 
  1037                              <1> do_repe_cmpsb_caps:
  1038 0000058D 0F828F00            <1> _386_PM	jc do_repe_cmpsb_caps_a32
  1039 00000591 E308                <1> 	jcxz .retn
  1040                              <1> .loop:
  1041 00000593 AC                  <1> 	lodsb
  1042 00000594 B702                <1> 	mov bh, 2		; caps flag
  1043 00000596 E85400              <1> 	call difficult_scasb_a16
  1044 00000599 E1F8                <1> 	loope .loop
  1045                              <1> .retn:
  1046 0000059B C3                  <1> 	retn
  1047                              <1> 
  1048                              <1> difficult_repe_cmpsb:
  1049 0000059C 0F828E00            <1> _386_PM	jc difficult_repe_cmpsb_a32
  1050 000005A0 E330                <1> 	jcxz .retn
  1051                              <1> 	lframe
  1052 000005A2 5589E5              <1> 	lenter
  1053 000005A5 31DB                <1> 	xor bx, bx
  1054 000005A7 53                  <1> 	 push bx		; ?idx = 0
  1055                              <1> 	lvar word, idx
  1056 000005A8 B302                <1> 	mov bl, 2		; skip initial tag
  1057                              <1> .loop:
  1058 000005AA 51                  <1> 	push cx
  1059 000005AB 89D9                <1> 	mov cx, bx		; cl = how many tags to skip times 2
  1060 000005AD 8B5EFE              <1> 	mov bx, word [bp + ?idx]; + tagbuffer -> current tag byte
  1061 000005B0 368AAF[8A00]        <1> reloc	mov ch, byte [ss:word tagbuffer + bx]
  1062                              <1> internaldatarelocation		; get current tag byte
  1063 000005B5 D2ED                <1> 	shr ch, cl		; shift down tag to bit 0 and 1
  1064 000005B7 80C102              <1> 	add cl, 2		; next tag
  1065 000005BA 80F908              <1> 	cmp cl, 8		; need to increment ?idx ?
  1066 000005BD 7205                <1> 	jb @F			; no -->
  1067 000005BF B100                <1> 	mov cl, 0		; reset for next iteration
  1068 000005C1 FF46FE              <1> 	inc word [bp + ?idx]	; point at next tag byte
  1069                              <1> @@:
  1070 000005C4 89CB                <1> 	mov bx, cx		; bl = shift count for next tag,
  1071                              <1> 				; bh bit 0 and 1 = tag
  1072 000005C6 59                  <1> 	pop cx
  1073 000005C7 AC                  <1> 	lodsb
  1074 000005C8 53                  <1> 	push bx			; preserve shift count
  1075 000005C9 E82100              <1> 	call difficult_scasb_a16
  1076 000005CC 5B                  <1> 	pop bx
  1077 000005CD E1DB                <1> 	loope .loop
  1078 000005CF 89EC5D              <1> 	lleave
  1079                              <1> .retn:
  1080 000005D2 C3                  <1> 	retn
  1081                              <1> 
  1082                              <1> 
  1083                              <1> difficult_repne_scasb:
  1084 000005D3 368A3E[8A00]        <1> reloc	mov bh, byte [ss:tagbuffer]
  1085                              <1> internaldatarelocation
  1086 000005D8 0F828800            <1> _386_PM	jc difficult_repne_scasb_a32
  1087 000005DC E305                <1> 	jcxz .ret
  1088                              <1> .loop:
  1089 000005DE E80C00              <1> 	call difficult_scasb_a16
  1090 000005E1 E0FB                <1> 	loopne .loop
  1091                              <1> .ret:
  1092 000005E3 C3                  <1> 	retn
  1093                              <1> 
  1094                              <1> difficult_scasb:
  1095 000005E4 368A3E[8A00]        <1> reloc	mov bh, byte [ss:tagbuffer]
  1096                              <1> internaldatarelocation
  1097 000005E9 0F828100            <1> _386_PM	jc difficult_scasb_a32
  1098                              <1> difficult_scasb_a16:
  1099 000005ED F6C701              <1> 	test bh, 1
  1100 000005F0 7522                <1> 	jnz .wild
  1101 000005F2 F6C702              <1> 	test bh, 2
  1102 000005F5 7502                <1> 	jnz .caps
  1103 000005F7 AE                  <1> 	scasb
  1104 000005F8 C3                  <1> 	retn
  1105                              <1> 
  1106                              <1> .caps:
  1107 000005F9 57                  <1> 	push di
  1108 000005FA AE                  <1> 	scasb
  1109 000005FB 7415                <1> 	je .ret_stack		; ZR
  1110 000005FD 3C41                <1> 	cmp al, 'A'
  1111 000005FF 7211                <1> 	jb .ret_stack		; NZ
  1112 00000601 3C5A                <1> 	cmp al, 'Z'
  1113 00000603 7608                <1> 	jbe .toggle
  1114 00000605 3C61                <1> 	cmp al, 'a'
  1115 00000607 7209                <1> 	jb .ret_stack		; NZ
  1116 00000609 3C7A                <1> 	cmp al, 'z'
  1117 0000060B 7705                <1> 	ja .ret_stack		; NZ
  1118                              <1> .toggle:
  1119 0000060D 5F                  <1> 	pop di
  1120 0000060E 3420                <1> 	xor al, 32		; try other caps status
  1121 00000610 AE                  <1> 	scasb
  1122 00000611 C3                  <1> 	retn
  1123                              <1> 
  1124                              <1> .ret_stack:
  1125 00000612 5B                  <1> 	pop bx
  1126 00000613 C3                  <1> 	retn
  1127                              <1> 
  1128                              <1> .wild:
  1129 00000614 AE                  <1> 	scasb
  1130 00000615 38C0                <1> 	cmp al, al
  1131 00000617 C3                  <1> 	retn
  1132                              <1> 
  1133                              <1> 
  1134                              <1>  %if _PM
  1135                              <1> 	subcpu 386
  1136                              <1> do_repne_scasb_a32:
  1137 00000618 F2                  <1> 	repne
  1138                              <1> 
  1139                              <1> do_scasb_a32:
  1140 00000619 67AE                <1> 	a32 scasb
  1141 0000061B C3                  <1> 	retn
  1142                              <1> 
  1143                              <1> do_repe_cmpsb_a32:
  1144 0000061C F367A6              <1> 	a32 repe cmpsb
  1145 0000061F C3                  <1> 	retn
  1146                              <1> 
  1147                              <1> do_repe_cmpsb_caps_a32:
  1148 00000620 67E30A              <1> 	jecxz .retn
  1149                              <1> .loop:
  1150 00000623 67AC                <1> 	a32 lodsb
  1151 00000625 B702                <1> 	mov bh, 2		; caps flag
  1152 00000627 E84400              <1> 	call difficult_scasb_a32
  1153 0000062A 67E1F6              <1> 	loope .loop, ecx
  1154                              <1> .retn:
  1155 0000062D C3                  <1> 	retn
  1156                              <1> 
  1157                              <1> difficult_repe_cmpsb_a32:
  1158 0000062E 67E332              <1> 	jecxz .retn
  1159                              <1> 	lframe
  1160 00000631 5589E5              <1> 	lenter
  1161 00000634 31DB                <1> 	xor bx, bx
  1162 00000636 53                  <1> 	 push bx		; ?idx = 0
  1163                              <1> 	lvar word, idx
  1164 00000637 B302                <1> 	mov bl, 2		; skip initial tag
  1165                              <1> .loop:
  1166 00000639 51                  <1> 	push cx
  1167 0000063A 89D9                <1> 	mov cx, bx		; cl = how many tags to skip times 2
  1168 0000063C 8B5EFE              <1> 	mov bx, word [bp + ?idx]; + tagbuffer -> current tag byte
  1169 0000063F 368AAF[8A00]        <1> reloc	mov ch, byte [ss:word tagbuffer + bx]
  1170                              <1> internaldatarelocation		; get current tag byte
  1171 00000644 D2ED                <1> 	shr ch, cl		; shift down tag to bit 0 and 1
  1172 00000646 80C102              <1> 	add cl, 2		; next tag
  1173 00000649 80F908              <1> 	cmp cl, 8		; need to increment ?idx ?
  1174 0000064C 7205                <1> 	jb @F			; no -->
  1175 0000064E B100                <1> 	mov cl, 0		; reset for next iteration
  1176 00000650 FF46FE              <1> 	inc word [bp + ?idx]	; point at next tag byte
  1177                              <1> @@:
  1178 00000653 89CB                <1> 	mov bx, cx		; bl = shift count for next tag,
  1179                              <1> 				; bh bit 0 and 1 = tag
  1180 00000655 59                  <1> 	pop cx
  1181 00000656 67AC                <1> 	a32 lodsb
  1182 00000658 53                  <1> 	push bx			; preserve shift count
  1183 00000659 E81200              <1> 	call difficult_scasb_a32
  1184 0000065C 5B                  <1> 	pop bx
  1185 0000065D 67E1D9              <1> 	loope .loop, ecx
  1186 00000660 89EC5D              <1> 	lleave
  1187                              <1> .retn:
  1188 00000663 C3                  <1> 	retn
  1189                              <1> 
  1190                              <1> 
  1191                              <1> difficult_repne_scasb_a32:
  1192 00000664 67E306              <1> 	jecxz .ret
  1193                              <1> .loop:
  1194 00000667 E80400              <1> 	call difficult_scasb_a32
  1195 0000066A 67E0FA              <1> 	loopne .loop, ecx
  1196                              <1> .ret:
  1197 0000066D C3                  <1> 	retn
  1198                              <1> 
  1199                              <1> difficult_scasb_a32:
  1200 0000066E F6C701              <1> 	test bh, 1
  1201 00000671 7528                <1> 	jnz .wild
  1202 00000673 F6C702              <1> 	test bh, 2
  1203 00000676 7503                <1> 	jnz .caps
  1204 00000678 67AE                <1> 	a32 scasb
  1205 0000067A C3                  <1> 	retn
  1206                              <1> 
  1207                              <1> .caps:
  1208 0000067B 6657                <1> 	push edi
  1209 0000067D 67AE                <1> 	a32 scasb
  1210 0000067F 7417                <1> 	je .ret_stack		; ZR
  1211 00000681 3C41                <1> 	cmp al, 'A'
  1212 00000683 7213                <1> 	jb .ret_stack		; NZ
  1213 00000685 3C5A                <1> 	cmp al, 'Z'
  1214 00000687 7608                <1> 	jbe .toggle
  1215 00000689 3C61                <1> 	cmp al, 'a'
  1216 0000068B 720B                <1> 	jb .ret_stack		; NZ
  1217 0000068D 3C7A                <1> 	cmp al, 'z'
  1218 0000068F 7707                <1> 	ja .ret_stack		; NZ
  1219                              <1> .toggle:
  1220 00000691 665F                <1> 	pop edi
  1221 00000693 3420                <1> 	xor al, 32		; try other caps status
  1222 00000695 67AE                <1> 	a32 scasb
  1223 00000697 C3                  <1> 	retn
  1224                              <1> 
  1225                              <1> .ret_stack:
  1226 00000698 665B                <1> 	pop ebx
  1227 0000069A C3                  <1> 	retn
  1228                              <1> 
  1229                              <1> .wild:
  1230 0000069B 67AE                <1> 	a32 scasb
  1231 0000069D 38C0                <1> 	cmp al, al
  1232 0000069F C3                  <1> 	retn
  1233                              <1> 
  1234                              <1> 	subcpureset
  1235                              <1>  %endif
  1236                              <1> %endif
  1237                              <1> 
  1238                              <1> ..@sss_access_end:
  1239                              <1> %endif	; _LOADER
   264                                  
   265                                  
   266                                  %assign _STRNUM 1
   267                                  
   268                                  %if _STRNUM
   269                                  getstr_check_limit:
   270 000006A0 3BBF[1400]              reloc	cmp di, word [word getstr_dispatch_table.limit + bx]
   271                                  internaldatarelocation
   272 000006A4 7703E9C200              	jbe getstr_retn
   273                                  %endif
   274                                  errorj2a:
   275 000006A9 E91701                  	jmp error
   276                                  
   277                                  ;	GETSTR - Get string of bytes.  Put the answer in line_out.
   278                                  ;		Entry	AL	first character
   279                                  ;			SI	address of next character
   280                                  ;		Exit	[line_out] first byte of string
   281                                  ;			DI	address of last+1 byte of string
   282                                  ;		Uses	AX, cx, dx,SI
   283                                  getstr_sss:
   284 000006AC 4E                      	dec si
   285                                  	lframe
   286 000006AD 5589E5                  	lenter
   287 000006B0 B92600                  	mov cx, words(tagbuffer.size)
   288 000006B3 31C0                    	xor ax, ax
   289 000006B5 BF[8A00]                reloc	mov di, tagbuffer
   290                                  internaldatarelocation
   291 000006B8 57                      	 push di		; -> tag buffer
   292                                  	lvar word, idxtagbuffer
   293 000006B9 50                      	 push ax		; = 0
   294                                  	lvar word, tag
   295                                  	lequ 1, tagwild
   296                                  	lequ 2, tagcaps
   297 000006BA F3AB                    	rep stosw		; cx = 0
   298                                  
   299                                  %if _STRNUM
   300 000006BC 53                      	push bx
   301 000006BD 31DB                    	xor bx, bx		; 0 = byte size as default
   302                                  %endif
   303 000006BF E80E01                  	extcallcall skipcomma
   304 000006C2 BF[0000]                reloc	mov di, relocateddata
   305                                  linkdatarelocation line_out
   306 000006C5 E8A001                  	extcallcall iseol?
   307 000006C8 74DF                    	je short errorj2a	; we don't allow empty byte strings
   308                                  
   309                                  getstr_loop:
   310 000006CA E84301                  	extcallcall skipcomm0
   311                                  %if _STRNUM
   312 000006CD 4E                      	dec si			; -> nonblank
   313 000006CE BA[1C00]                reloc	mov dx, msg.as		; "AS" keyword ?
   314                                  internaldatarelocation
   315 000006D1 E80401                  	extcallcall isstring?
   316 000006D4 7517                    	jne .notas		; no -->
   317 000006D6 E8F700                  	extcallcall skipcomma
   318 000006D9 4E                      	dec si			; -> nonblank
   319 000006DA 51                      	push cx
   320 000006DB E89201                  	extcallcall get_length_keyword
   321 000006DE 75C9                    	jnz errorj2a
   322 000006E0 80F902                  	cmp cl, 2		; 0 = bytes, 1 = words, 2 = dwords
   323                                  				; (ch is always zero)
   324 000006E3 77C4                    	ja errorj2a		; higher is invalid -->
   325 000006E5 89CB                    	mov bx, cx
   326 000006E7 01DB                    	add bx, bx		; make a table offset
   327 000006E9 59                      	pop cx
   328 000006EA AC                      	lodsb
   329 000006EB EB65                    	jmp getstr_next
   330                                  
   331                                  .notas:
   332                                  %endif
   333 000006ED BA[2300]                reloc	mov dx, msg.wild
   334                                  internaldatarelocation
   335 000006F0 E8E500                  	extcallcall isstring?
   336 000006F3 7512                    	jne .notwild
   337 000006F5 804EFC01                	setopt [bp + ?tag], ?tagwild
   338                                  %if _STRNUM
   339 000006F9 E8A4FF                  	call getstr_check_limit
   340 000006FC FF97[0E00]              reloc	call near [word getstr_dispatch_table.string + bx]
   341                                  internaldatarelocation
   342                                  %else
   343                                  	inc di
   344                                  	call storetag
   345                                  %endif
   346 00000700 8066FCFE                	clropt [bp + ?tag], ?tagwild
   347                                  .lod:
   348 00000704 AC                      	lodsb
   349 00000705 EB4B                    	jmp getstr_next
   350                                  
   351                                  .notwild:
   352 00000707 BA[2A00]                reloc	mov dx, msg.caps
   353                                  internaldatarelocation
   354 0000070A E8CB00                  	extcallcall isstring?
   355 0000070D 7506                    	jne .notcaps
   356 0000070F 804EFC02                	setopt [bp + ?tag], ?tagcaps
   357 00000713 EBEF                    	jmp .lod
   358                                  
   359                                  .notcaps:
   360 00000715 BA[2800]                reloc	mov dx, msg.uncaps
   361                                  internaldatarelocation
   362 00000718 E8BD00                  	extcallcall isstring?
   363 0000071B 7506                    	jne .notuncaps
   364 0000071D 8066FCFD                	clropt [bp + ?tag], ?tagcaps
   365 00000721 EBE1                    	jmp .lod
   366                                  
   367                                  .notuncaps:
   368 00000723 AC                      	lodsb
   369 00000724 3C27                    	cmp al, "'"
   370 00000726 740D                    	je getstr_start_quote	; if string
   371 00000728 3C22                    	cmp al, '"'
   372 0000072A 7409                    	je getstr_start_quote	; ditto
   373                                  
   374                                  %if _STRNUM
   375 0000072C E871FF                  	call getstr_check_limit
   376 0000072F FF97[0800]              reloc	call near [word getstr_dispatch_table.numeric + bx]
   377                                  internaldatarelocation
   378                                  %else
   379                                  	extcallcall getbyte	; byte in DL
   380                                  	mov byte [di], dl	; store the byte
   381                                  	inc di
   382                                  %endif
   383 00000733 EB1D                    	jmp short getstr_next
   384                                  
   385                                  getstr_start_quote:
   386 00000735 88C4                    	mov ah, al		; save quote character
   387                                  getstr_loop_quoted:
   388 00000737 AC                      	lodsb
   389 00000738 38E0                    	cmp al, ah
   390 0000073A 7411                    	je getstr_quote_quoted	; if possible end of string
   391 0000073C E83901                  	extcallcall iseol?.notsemicolon
   392 0000073F 7503E965FF              	je errorj2a		; if end of line
   393                                  getstr_store_quoted:
   394                                  %if _STRNUM
   395 00000744 E859FF                  	call getstr_check_limit
   396 00000747 FF97[0E00]              reloc	call near [word getstr_dispatch_table.string + bx]
   397                                  internaldatarelocation
   398                                  %else
   399                                  	stosb			; save character and continue
   400                                  %endif
   401 0000074B EBEA                    	jmp short getstr_loop_quoted
   402                                  
   403                                  getstr_quote_quoted:
   404 0000074D AC                      	lodsb
   405 0000074E 38E0                    	cmp al, ah
   406 00000750 74F2                    	je getstr_store_quoted	; if doubled quote character
   407                                  getstr_next:
   408 00000752 E8BB00                  	extcallcall skipcomm0	; go back for more
   409 00000755 E81001                  	extcallcall iseol?
   410 00000758 740D                    	je .ret
   411 0000075A 4E                      	dec si
   412 0000075B BA[1F00]                reloc	mov dx, msg.end
   413                                  internaldatarelocation
   414 0000075E E87700                  	extcallcall isstring?
   415 00000761 AC                      	lodsb
   416 00000762 7403E963FF              	jne getstr_loop			; if not done yet
   417                                  .ret:
   418                                  %if _STRNUM
   419 00000767 5B                      	pop bx
   420                                  %endif
   421 00000768 89EC5D                  	lleave code
   422                                  %if _STRNUM
   423                                  getstr_retn:
   424                                  %endif
   425 0000076B C3                      	retn
   426                                  
   427                                  
   428                                  %if _STRNUM
   429                                  getstr_numeric_byte:
   430 0000076C E81101                  	extcallcall getbyte	; byte in DL
   431 0000076F 8815                    	mov byte [di], dl	; store the byte
   432 00000771 47                      	inc di
   433 00000772 EB2F                    	jmp storetag
   434                                  
   435                                  getstr_numeric_word:
   436 00000774 E81101                  	extcallcall getword	; dx
   437 00000777 8915                    	mov word [di], dx	; store
   438 00000779 AF                      	scasw			; di += 2
   439                                  storetagtwice:
   440 0000077A E82600                  	call storetag
   441 0000077D EB24                    	jmp storetag
   442                                  
   443                                  getstr_numeric_dword:
   444 0000077F 53                      	push bx
   445 00000780 E89D00                  	extcallcall getdword	; bx:dx
   446 00000783 8915                    	mov word [di], dx	; store
   447 00000785 AF                      	scasw			; di += 2
   448 00000786 891D                    	mov word [di], bx	; store
   449 00000788 AF                      	scasw			; di += 2
   450 00000789 5B                      	pop bx
   451 0000078A E8EDFF                  	call storetagtwice
   452 0000078D EBEB                    	jmp storetagtwice
   453                                  
   454                                  
   455                                  getstr_string_word:
   456 0000078F AA                      	stosb			; save character and continue
   457 00000790 E81000                  	call storetag
   458 00000793 B000                    	mov al, 0
   459 00000795 EB0B                    	jmp getstr_string_byte
   460                                  
   461                                  getstr_string_dword:
   462 00000797 AA                      	stosb			; save character and continue
   463 00000798 E8DFFF                  	call storetagtwice
   464 0000079B E80500                  	call storetag
   465 0000079E B000                    	mov al, 0
   466 000007A0 AA                      	stosb
   467 000007A1 AA                      	stosb
   468                                  getstr_string_byte:
   469 000007A2 AA                      	stosb
   470                                  	; fall through
   471                                  
   472                                  storetag:
   473 000007A3 50                      	push ax
   474 000007A4 877EFE                  	xchg di, word [bp + ?idxtagbuffer]
   475 000007A7 81FF[D500]              reloc	cmp di, strict word tagbuffer.end
   476                                  internaldatarelocation
   477 000007AB 7316                    	jae error
   478 000007AD 8A46FC                  	mov al, byte [bp + ?tag]
   479 000007B0 D2E0                    	shl al, cl
   480 000007B2 0805                    	or byte [di], al
   481 000007B4 41                      	inc cx
   482 000007B5 41                      	inc cx
   483 000007B6 80F908                  	cmp cl, 8
   484 000007B9 7203                    	jb @F
   485 000007BB B100                    	mov cl, 0
   486 000007BD 47                      	inc di
   487                                  @@:
   488 000007BE 877EFE                  	xchg di, word [bp + ?idxtagbuffer]
   489 000007C1 58                      	pop ax
   490 000007C2 C3                      	retn
   491                                  
   492                                  
   493                                  	lleave ctx
   494                                  
   495                                  
   496                                  	usesection DATA
   497                                  
   498                                  		; REM:	Dispatch table in section CODE (ELD code segment)
   499                                  	align 2, db 0
   500                                  getstr_dispatch_table:
   501                                  .numeric:
   502 00000008 [6C07]                  reloc		dw getstr_numeric_byte
   503                                  internalcoderelocation
   504 0000000A [7407]                  reloc		dw getstr_numeric_word
   505                                  internalcoderelocation
   506 0000000C [7F07]                  reloc		dw getstr_numeric_dword
   507                                  internalcoderelocation
   508                                  .string:
   509 0000000E [A207]                  reloc		dw getstr_string_byte
   510                                  internalcoderelocation
   511 00000010 [8F07]                  reloc		dw getstr_string_word
   512                                  internalcoderelocation
   513 00000012 [9707]                  reloc		dw getstr_string_dword
   514                                  internalcoderelocation
   515                                  .limit:
   516 00000014 [FFFF]                  reloc		dw relocateddata - 1
   517                                  linkdatarelocation line_out_end
   518 00000016 [FEFF]                  reloc		dw relocateddata - 2
   519                                  linkdatarelocation line_out_end
   520 00000018 [FCFF]                  reloc		dw relocateddata - 4
   521                                  linkdatarelocation line_out_end
   522                                  
   523                                  	usesection CODE
   524                                  %endif	; _STRNUM
   525                                  
   526                                  
   527                                  error:
   528 000007C3 E8[0000]EB020000        	extcall error
   529                                  
   530 000007CA 90<rep 6h>E8[0000]-     	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   530 000007D3 EB020000C3E8[0000]-
   530 000007DB EB020000C3E8[0000]-
   530 000007E3 EB020000C3E8[0000]-
   530 000007EB EB020000C3E8[0000]-
   530 000007F3 EB020000C3E8[0000]-
   530 000007FB EB020000C3E8[0000]-
   530 00000803 EB020000C3E8[0000]-
   530 0000080B EB020000C3E8[0000]-
   530 00000813 EB020000C3E8[0000]-
   530 0000081B EB020000C3E8[0000]-
   530 00000823 EB020000C3E8[0000]-
   530 0000082B EB020000C3E8[0000]-
   530 00000833 EB020000C3E8[0000]-
   530 0000083B EB020000C3E8[0000]-
   530 00000843 EB020000C3E8[0000]-
   530 0000084B EB020000C3E8[0000]-
   530 00000853 EB020000C3E8[0000]-
   530 0000085B EB020000C3E8[0000]-
   530 00000863 EB020000C3E8[0000]-
   530 0000086B EB020000C3E8[0000]-
   530 00000873 EB020000C3E8[0000]-
   530 0000087B EB020000C3E8[0000]-
   530 00000883 EB020000C3E8[0000]-
   530 0000088B EB020000C3         
   531                                  
   532                                  endinstalled equ ($ + CODEFIXUP + 15) & ~15
   533                                  
   534                                  	align 2, db 0				; align on word boundary
   535                                  		; Table of patches that are to be set NOP if not running on a 386.
   536 00000890 DF0108010101780102-     writepatchtable patch_no386_table, PATCH_NO386_TABLE
   536 00000899 012C0403047D040101-
   536 000008A2 1C010701190107014C-
   536 000008AB 018F047B0107011D01-
   536 000008B4 07013501F40101160C-
   536 000008BD 010601310403040204-
   536 000008C6 03040B0438040D0400-
   536 000008CF 00                 
   536          ******************       warning: patch_no386_table: 64 bytes (Method 2) [-w+user]
   536          ******************       warning: 1B=19 repo=0 run=31 byte=85 [-w+user]
   537                                  %undef PATCH_NO386_TABLE
   538                                  
   539                                  	align 2, db 0
   540                                  		; Table of patches that are to be set NOP if running on a 386.
   541                                  writepatchtable patch_386_table, PATCH_386_TABLE
   541          ******************       warning: patch_386_table: 0 bytes (Method 1) [-w+user]
   542                                  %undef PATCH_386_TABLE
   543                                  
   544                                  
   545                                  start:
   546                                  	houdini
   547 000008D0 56                      	push si
   548 000008D1 BA[0000]                reloc	mov dx, code
   549                                  internalcoderelocation
   550 000008D4 F606[0100]80            reloc	testopt [relocateddata], has386
   551                                  linkdatarelocation internalflags, -3
   552 000008D9 740B                    	jz @F
   553 000008DB BE[D008]                reloc	mov si, patch_386_table		; table of patches to set for 386+
   554                                  internalcoderelocation
   555                                  %if __patch_386_table_method == 1
   556 000008DE B90000                  	mov cx, patch_386_table_size_w
   557 000008E1 E82900                  	call .patch1
   558                                  %else
   559                                  	call .patch2
   560                                  %endif
   561 000008E4 EB35                    	jmp .patch_code1_end
   562                                  
   563                                  @@:
   564 000008E6 BE[9008]                reloc	mov si, patch_no386_table	; table of patches to set for 16-bit CPU
   565                                  internalcoderelocation
   566                                  %if __patch_no386_table_method == 1
   567                                  	mov cx, patch_no386_table_size_w
   568                                  	call .patch1
   569                                  %else
   570 000008E9 E80200                  	call .patch2
   571                                  %endif
   572 000008EC EB2D                    	jmp .patch_code1_end
   573                                  
   574                                  		; Complicated table patch code.
   575                                  %if __patch_no386_table_method == 2 || __patch_386_table_method == 2
   576                                  .patch2:
   577 000008EE BF[0000]                reloc	mov di, code_start		; initialise offset
   578                                  internalcoderelocation
   579 000008F1 31C0                    	xor ax, ax			; initialise ah
   580                                  .looppatch2:
   581 000008F3 2EAC                    	cs lodsb
   582 000008F5 01C7                    	add di, ax			; skip number of bytes to skip
   583 000008F7 3CFF                    	cmp al, 255			; really repositioning?
   584 000008F9 7506                    	jne .l2patch			; no -->
   585 000008FB 97                      	xchg ax, di			; (to preserve ah)
   586 000008FC 2EAD                    	cs lodsw			; ax = new address
   587 000008FE 01D0                    	add ax, dx
   588 00000900 97                      	xchg ax, di			; di = new address
   589                                  .l2patch:
   590 00000901 2EAC                    	cs lodsb
   591 00000903 89C1                    	mov cx, ax			; cx = number of bytes to patch
   592 00000905 E313                    	jcxz .patchesdone		; end of table -->
   593 00000907 B090                    	mov al, 90h			; patch to NOP
   594 00000909 F3AA                    	rep stosb			; patch as many bytes as specified
   595 0000090B EBE6                    	jmp short .looppatch2
   596                                  %endif
   597                                  
   598                                  		; Simple table patch code.
   599                                  %if __patch_no386_table_method == 1 || __patch_386_table_method == 1
   600                                  .patch1:
   601 0000090D E30B                    	jcxz .patchesdone
   602                                  .looppatch1:
   603 0000090F 2EAD                    	cs lodsw			; load address of patch
   604 00000911 01D0                    	add ax, dx
   605 00000913 93                      	xchg bx, ax			; (set bx = ax, CHG ax)
   606 00000914 26C60790                	mov byte [es:bx], 90h		; patch
   607 00000918 E2F5                    	loop .looppatch1
   608                                  %endif
   609                                  .patchesdone:
   610 0000091A C3                      	retn
   611                                  
   612                                  .patch_code1_end:
   613 0000091B 5E                      	pop si
   614                                  
   615 0000091C 8CC3                    	mov bx, es
   616 0000091E 16                      	 push ss
   617 0000091F 07                      	 pop es
   618                                  
   619 00000920 E8ADFE                  	call skipcomma
   620 00000923 4E                      	dec si
   621 00000924 BA[0000]                reloc	mov dx, relocateddata
   622                                  linkdatarelocation msg.install
   623 00000927 E8AEFE                  	call isstring?
   624 0000092A 742D                    	je install
   625 0000092C AC                      	lodsb
   626 0000092D E8A6F7                  	call sss
   627                                  @@:
   628 00000930 E80300                  	call uninstall_oneshot
   629 00000933 31C0                    	xor ax, ax
   630 00000935 CB                      	retf
   631                                  
   632                                  
   633                                  uninstall_oneshot:
   634 00000936 36F606[0000]01          reloc	testopt [ss:relocateddata], 1
   635                                  linkdatarelocation options7, -3
   636 0000093C 751A                    	jnz @F
   637                                  
   638 0000093E 2EA1[0200]              reloc	mov ax, word [cs:code + eldiEndCode]
   639                                  internalcoderelocation
   640 00000942 2E2B06[0000]            reloc	sub ax, word [cs:code + eldiStartCode]
   641                                  internalcoderelocation
   642 00000947 2906[0000]              reloc	sub word [relocateddata], ax
   643                                  linkdatarelocation extseg_used
   644                                  
   645 0000094B 2EA1[0600]              reloc	mov ax, word [cs:code + eldiEndData]
   646                                  internalcoderelocation
   647 0000094F 2E2B06[0400]            reloc	sub ax, word [cs:code + eldiStartData]
   648                                  internalcoderelocation
   649 00000954 2906[0000]              reloc	sub word [relocateddata], ax
   650                                  linkdatarelocation extdata_used
   651                                  @@:
   652 00000958 C3                      	retn
   653                                  
   654                                  
   655                                  install:
   656 00000959 AC                      	lodsb
   657 0000095A E8[0000]EB020000        	extcall chkeol
   658                                  
   659                                  	houdini
   660 00000961 8EC3                    	mov es, bx		; => ext seg (writable)
   661 00000963 B81001                  	mov ax, endresident - endinstalled
   662 00000966 262906[0200]            reloc	sub word [es:code + eldiEndCode], ax
   663                                  internalcoderelocation		; adjust size
   664 0000096B 2906[0000]              reloc	sub word [relocateddata], ax
   665                                  linkdatarelocation extseg_used	; adjust size
   666 0000096F 8B1E[0000]              reloc	mov bx, word [relocateddata]
   667                                  linkdatarelocation ext_command_handler
   668                                  				; -> prior
   669 00000973 BF[2000]                reloc	mov di, command		; -> our handler
   670                                  internalcoderelocation
   671 00000976 85DB                    	test bx, bx		; installing as first ?
   672 00000978 740A                    	jz .only_first		; yes, simple --> (leave as extcall cmd3_not_ext)
   673 0000097A AF                      	scasw			; skip entrypoint jmp strict short
   674 0000097B B0E9                    	mov al, 0E9h		; = jmp near opcode
   675 0000097D AA                      	stosb			; store
   676 0000097E 93                      	xchg ax, bx		; ax -> next handler
   677 0000097F 29F8                    	sub ax, di
   678 00000981 48                      	dec ax
   679 00000982 48                      	dec ax			; ax = ax - (di + 2)
   680 00000983 AB                      	stosw			; store our downlink as rel16 displacement
   681                                  
   682                                  .only_first:
   683 00000984 26800E[1000]01          reloc	setopt [es:code + eldiFlags], eldifResident
   684                                  internalcoderelocation -3	; mark block as resident
   685 0000098A C706[0000][2000]        reloc2	mov word [relocateddata], command
   686                                  linkdatarelocation ext_command_handler, -4
   687                                  internalcoderelocation		; -> our entrypoint
   688                                  
   689 00000990 F606[0000]04            reloc	testopt [relocateddata], 4
   690                                  linkdatarelocation options7, -3
   691 00000995 7506                    	jnz @F
   692 00000997 BA[8900]                reloc	mov dx, msg.installed
   693                                  internaldatarelocation
   694 0000099A E85BFE                  	call putsz
   695                                  @@:
   696 0000099D 31C0                    	xor ax, ax
   697 0000099F CB                      	retf
   698                                  
   699                                  
   700                                  	usesection DATA
   701                                  msg:
   702                                  %if 0
   703                                  .sleep:			asciz "SLEEP"
   704                                  %else
   705 0000001A 5300                    .s:			asciz "S"
   706                                  %endif
   707 0000001C 415300                  .as:			asciz "AS"
   708 0000001F 454E4400                .end:			asciz "END"
   709 00000023 57494C4400              .wild:			asciz "WILD"
   710 00000028 554E                    .uncaps:		db "UN"
   711 0000002A 4341505300              .caps:			asciz "CAPS"
   712 0000002F 53494C454E5400          .silent:		asciz "SILENT"
   713 00000036 52414E474500            .range:			asciz "RANGE"
   714 0000003C 5245564552534500        .reverse:		asciz "REVERSE"
   715 00000044 206D6174636865730D-     .matches:		asciz " matches",13,10
   715 0000004D 0A00               
   716 0000004F 5320636F6D6D616E64-     .uninstall_done:	db "S command uninstalled."
   716 00000058 20756E696E7374616C-
   716 00000061 6C65642E           
   717                                  %if _ELD_RECLAIM_HINT
   718                                  			db " (Don't forget to use reclaim.eld)"
   719                                  %endif
   720 00000065 0D0A00                  			asciz 13,10
   721 00000068 5320636F6D6D616E64-     .uninstall_error:	asciz "S command unable to uninstall!",13,10
   721 00000071 20756E61626C652074-
   721 0000007A 6F20756E696E737461-
   721 00000083 6C6C210D0A00       
   722                                  
   723                                  uinit_data: equ $
   724                                  
   725 00000089 5320636F6D6D616E64-     .installed:	asciz "S command installed.",13,10
   725 00000092 20696E7374616C6C65-
   725 0000009B 642E0D0A00         
   726                                  
   727                                  	align 16, db 0
   728                                  init_data_end:
   729                                  data_size equ $ - datastart
   730                                  
   731                                  	absolute uinit_data
   732                                  
   733 00000089 ??                      	alignb 2
   734                                  tagbuffer:
   735 0000008A <res 4Bh>               .:	resb 300 / 4
   736                                  .end:
   737                                  .size equ .end - .
   738 000000D5 ??                      	alignb 2		; may overflow if odd tagbuffer.size
   739                                  
   740                                  patternbuffer:
   741 000000D6 <res 108h>              .:	resb 264
   742                                  .size equ $ - .
   743                                  
   744                                  	alignb 2
   745                                  sss_repne_scasb:
   746 000001DE ????                    	resw 1
   747                                  sss_scasb:
   748 000001E0 ????                    	resw 1
   749                                  sss_repe_cmpsb:
   750 000001E2 ????                    	resw 1
   751                                  sss_repe_cmpsb_for_range:
   752 000001E4 ????                    	resw 1
   753                                  
   754                                  sss_range_used:
   755 000001E6 ??                      	resb 1
   756                                  
   757                                  %if 0 ;n _RN_AUX
   758                                  	alignb 4
   759                                  rn_rm_buffer:
   760                                  		resb 128
   761                                  %endif
   762                                  
   763 000001E7 <res 9h>                	alignb 16
   764                                  uinit_data_end:
   765                                  resident_data_end:
   766                                  
   767                                  %if uinit_data_end >= init_data_end
   768                                   total_data_size equ $ - datastart
   769                                  %else
   770                                   total_data_size equ init_data_end - datastart
   771                                  %endif
   772                                  %assign _DATA_SIZE total_data_size
   773                                  
   774                                  	usesection CODE
   775                                  
   776                                  %include "eldlink.asm"
     1                              <1> %if 0
     2                              <1> 
     3                              <1> Extensions for lDebug linker
     4                              <1> 
     5                              <1> Copyright (C) 2008-2025 E. C. Masloch
     6                              <1> 
     7                              <1> Usage of the works is permitted provided that this
     8                              <1> instrument is retained with the works, so that any entity
     9                              <1> that uses the works is notified of this instrument.
    10                              <1> 
    11                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <1> 
    13                              <1> %endif
    14                              <1> 
    15                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
    16                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22                              <2> eldhSignature:		resb 4	; "ELD1"
    23                              <2> 			resb 3	; reserved
    24                              <2> 			resb 1	; 26 (Ctrl-Z)
    25                              <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26                              <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27                              <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28                              <2> eldhDataOffset:		resd 1
    29                              <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30                              <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31                              <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32                              <2> eldhReserved:		resb 4	; reserved
    33                              <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38                              <2> eldhxHeader:		resb ELD_HEADER_size
    39                              <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40                              <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41                              <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42                              <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47                              <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48                              <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50                              <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51                              <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56                              <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61                              <2> eldltAmount:		resw 1
    62                              <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69                              <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70                              <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71                              <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72                              <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73                              <2> eldiIdentifier:		resb 8	; blank-filled text
    74                              <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76                              <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84                              <2> eldlSignature:		resw 1	; 0E1D1h
    85                              <2> eldlReserved:		resw 2
    86                              <2> eldlUseLinkHash:	resw 1
    87                              <2> eldlDataAmount:		resw 1
    88                              <2> eldlDataPrefixes:	resw 1
    89                              <2> eldlDataEntries:	resw 1
    90                              <2> eldlDataAddresses:	resw 1
    91                              <2> eldlCodeAmount:		resw 1
    92                              <2> eldlCodePrefixes:	resw 1
    93                              <2> eldlCodeEntries:	resw 1
    94                              <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
    17                              <1> 
    18                              <1> 	cpu 8086
    19                              <1> 
    20                              <1> %if ELDSTRICT
    21                              <1>  %if ELDSTRICTCOUNTER
    22                              <1>   %error Missing relocation
    23                              <1>  %endif
    24                              <1> %endif
    25                              <1> 	eldstrict off		; linker does some relocations
    26                              <1> 
    27                              <1> %ifn ELDCALLCALL_DUMPED
    28                              <1> 	eldcall_dump_callcall ELDCALL_CALLCALL_LIST
    29                              <1> %endif
    30                              <1> 
    31                              <1> 	numdef ELD_IDENTICALISE, 0
    32                              <1> 	numdef ELD_DEBUG, 0
    33                              <1> 	numdef ELD_LINKER_PASSES, 1
    34                              <1> 	strdef LISTING, _ELD_LISTING
    35                              <1> 	numdef ELDCALL_OPTIONAL, ELDCALL_OPTIONAL_STATUS
    36                              <1> 	numdef ELDDATA_OPTIONAL, ELDDATA_OPTIONAL_STATUS
    37                              <1> 	numdef ELDDATA_NEXT, ELDDATA_NEXT_STATUS
    38                              <1> 	numdef ELDCALL_NEXT, ELDCALL_NEXT_STATUS
    39                              <1> %if _ELD_IDENTICALISE
    40                              <1>  ;%assign _ELDCALL_OPTIONAL 1
    41                              <1> %endif
    42                              <1> %ifn _ELDCALL_OPTIONAL
    43                              <1> %assign ELDCALL_OPTIONAL_STATUS 2		; not allowed
    44                              <1> %endif
    45                              <1> ;%ifn _ELDDATA_OPTIONAL
    46                              <1> ;%assign ELDDATA_OPTIONAL_STATUS 2		; not allowed
    47                              <1> ;%endif
    48                              <1> 	gendef MAP, ""
    49                              <1> 
    50                              <1> %ifnidni _MAP, ""
    51                              <1>  [map all _MAP]
    52                              <1> %endif
    53                              <1> 
    54                              <1> 
    55                              <1> endresident: equ ($ + _CURRENT_SECTION %+ FIXUP + 15) & ~15
    56                              <1> 
    57                              <1> %if _ELD_LINKER_PASSES
    58                              <1> %assign ELDLINKER 1
    59                              <1> 
    60                              <1> 	struc LINKTABLE
    61 00000000 ????????            <1> ltCodeToCode:	resw 2
    62 00000004 ????????            <1> ltCodeToData:	resw 2
    63 00000008 ????????            <1> ltDataToCode:	resw 2
    64 0000000C ????????            <1> ltDataToData:	resw 2
    65 00000010 ????????            <1> ltLinkData:	resw 2
    66 00000014 ????????            <1> ltLinkCode:	resw 2
    67                              <1> 	endstruc
    68                              <1> %endif
    69                              <1> 
    70                              <1> 
    71                              <1> 		; INP:	es:dx -> loaded initial ELD image
    72                              <1> 		;	 ELD instance structure filled
    73                              <1> 		;	es => ELD code area
    74                              <1> 		;	ds:di -> link info
    75                              <1> 		;	ss:bx -> loaded initial data
    76                              <1> 		;	ss:si -> command line tail
    77                              <1> 		;	cs:ip -> entrypoint
    78                              <1> 		;	ss:sp -> far return address for current mode
    79                              <1> 		; STT:	UP, EI
    80                              <1> linker:
    81                              <1> 		; The first 15 Bytes of the linker should be
    82                              <1> 		;  the same regardless of the linker options
    83                              <1> 		;  used (debug, passes, vstart). This allows
    84                              <1> 		;  the eldcomp ELD to match even if up to 15
    85                              <1> 		;  Bytes of the linker are trailing in the
    86                              <1> 		;  resident part of the ELD.
    87                              <1> 	lframe
    88                              <1>  %if ELDOTHER
    89                              <1> 	lvar dword, linkinfo_other
    90                              <1> 	lvar word, use_hash_other
    91                              <1>  %endif
    92 000009A0 5589E5              <1> 	lenter
    93                              <1> 	lvar dword, instance
    94 000009A3 06                  <1> 	 push es
    95 000009A4 52                  <1> 	 push dx		; -> start of where we're loaded in ELD cs
    96                              <1> 	lvar word, targetsection_low_optional_high
    97 000009A5 50                  <1> 	 push ax		; placeholder
    98                              <1> 	lequ ?targetsection_low_optional_high, targetsection
    99                              <1> 	lequ ?targetsection_low_optional_high + 1, optional
   100                              <1> 	lvar dword, linkinfo
   101 000009A6 1E                  <1> 	 push ds
   102 000009A7 57                  <1> 	 push di		; -> link info (in debugger ss or message seg)
   103                              <1> 	lvar dword, nextreloc
   104 000009A8 06                  <1> 	 push es		; => ELD cs
   105 000009A9 52                  <1> 	 push dx		; placeholder
   106                              <1> 	lvar dword, entry
   107 000009AA 06                  <1> 	 push es		; => ELD cs
   108 000009AB 50                  <1> 	 push ax		; placeholder
   109 000009AC 31C0                <1> 	xor ax, ax
   110 000009AE 813DD1E1            <1> 	cmp word [di + eldlSignature], 0E1D1h
   111                              <1> %if ($ - linker) < 16
   112                              <1>  %error Expected invariant first paragraph of linker
   113                              <1> %endif
   114 000009B2 7403                <1> 	je @F
   115                              <1> .error_j1:
   116 000009B4 E92C03              <1> 	jmp .error		; signature mismatch -->
   117                              <1> @@:
   118 000009B7 837D0601            <1> 	cmp word [di + eldlUseLinkHash], 1
   119 000009BB 77F7                <1> 	ja .error_j1		; unknown use link hash number -->
   120 000009BD 7201                <1> 	jb @F
   121                              <1> %if _ELDDATA_NEXT || _ELDCALL_NEXT
   122                              <1> 	dec al			; = -1 if hash used
   123                              <1> %else
   124 000009BF 48                  <1> 	dec ax
   125                              <1> %endif
   126                              <1> @@:
   127                              <1> 	lvar word, use_hash_low_skip_last_high
   128 000009C0 50                  <1> 	 push ax		; = -1 if hash used, else 0
   129                              <1> 	lequ ?use_hash_low_skip_last_high, use_hash
   130                              <1> 	lequ ?use_hash_low_skip_last_high + 1, skip_last
   131                              <1> %if _ELD_IDENTICALISE && _ELD_LINKER_PASSES
   132                              <1> 	mov ax, linktable - code
   133                              <1> 	lvar word, lt
   134                              <1> 	 push ax		; -> link tables (a single reference)
   135                              <1> %endif
   136                              <1> %if _ELD_LINKER_PASSES || ELDOTHER || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   137 000009C1 31C0                <1> 	xor ax, ax
   138                              <1>  %if _ELD_LINKER_PASSES
   139                              <1> 	lvar word, pass
   140 000009C3 50                  <1> 	 push ax		; = 0 for linker itself, = 2 for application
   141                              <1> 	lvar word, amounterrors
   142 000009C4 50                  <1> 	 push ax		; how many distinct errors encountered in pass 2
   143                              <1>  %endif
   144                              <1>  %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   145                              <1> 	lvar word, name
   146 000009C5 50                  <1> 	 push ax		; -> name currently being sought (in our table)
   147                              <1>  %endif
   148                              <1>  %if ELDOTHER
   149                              <1> 	lvar word, other
   150                              <1> 	 push ax		; byte: 0 = own data links, -1 = other data links
   151                              <1>  %endif
   152                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   153                              <1> 	lvar word, optionalmissing
   154 000009C6 50                  <1> 	 push ax
   155                              <1>  %endif
   156                              <1> %endif
   157 000009C7 56                  <1> 	push si			; -> command line tail
   158 000009C8 53                  <1> 	push bx			; -> data block in ELD data area (segment ss)
   159                              <1> 
   160                              <1> 			; simple: add instance base (dx) to code
   161 000009C9 06                  <1> 	push es
   162 000009CA 1F                  <1> 	pop ds			; ds = es => ELD cs
   163                              <1> %if _ELD_LINKER_PASSES
   164                              <1> .pass:
   165 000009CB 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   166 000009CE 01D3                <1> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   167                              <1>  %if _ELD_IDENTICALISE
   168                              <1> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   169                              <1> 	mov si, word [ltCodeToCode + bx]
   170                              <1>  %else
   171 000009D0 8BB7140E            <1> 	mov si, word [linktable - code + ltCodeToCode + bx]
   172                              <1>  %endif
   173                              <1> %else
   174                              <1> 	mov si, internalcodetocoderelocations - code
   175                              <1> %endif		 		; si -> table for code to code (linker or app)
   176 000009D4 01D6                <1> 	add si, dx		; relocate the table pointer itself
   177                              <1> @@:
   178 000009D6 AD                  <1> 	lodsw
   179 000009D7 85C0                <1> 	test ax, ax		; was last ?
   180 000009D9 740B                <1> 	jz @F			; yes -->
   181 000009DB 93                  <1> 	xchg bx, ax		; bx = entry
   182 000009DC 01D3                <1> 	add bx, dx		; relocate the entry itself
   183                              <1> %if _ELD_CODE_VSTART
   184 000009DE 812F[0000]          <1> 	sub word [bx], code	; undo adjustment
   185                              <1> %endif
   186 000009E2 0117                <1> 	add word [bx], dx	; relocate word referenced by entry
   187 000009E4 EBF0                <1> 	jmp @B
   188                              <1> 
   189                              <1> @@:
   190                              <1> 			; next, add heap data base (on stack) to code
   191                              <1> %if _ELD_LINKER_PASSES
   192 000009E6 8B5EEA              <1> 	mov bx, word [bp + ?pass]	; 0 or 2
   193 000009E9 01D3                <1> 	add bx, dx		; -> start of the ELD instance in cs, +0 or +2
   194                              <1>  %if _ELD_IDENTICALISE
   195                              <1> 	add bx, word [bp + ?lt]	; add in single reference to linktable
   196                              <1> 	mov si, word [ltCodeToData + bx]
   197                              <1>  %else
   198 000009EB 8BB7180E            <1> 	mov si, word [linktable - code + ltCodeToData + bx]
   199                              <1>  %endif
   200                              <1> %else
   201                              <1> 	mov si, internalcodetodatarelocations - code
   202                              <1> %endif				; si -> table for code to data (linker or app)
   203 000009EF 01D6                <1> 	add si, dx		; relocate the table pointer itself
   204                              <1> @@:
   205 000009F1 AD                  <1> 	lodsw
   206 000009F2 85C0                <1> 	test ax, ax		; was last ?
   207 000009F4 740C                <1> 	jz @F			; yes -->
   208 000009F6 93                  <1> 	xchg bx, ax		; bx = entry
   209 000009F7 01D3                <1> 	add bx, dx		; relocate the entry itself
   210                              <1> 		; ! access the offset of the data area block, topmost on stack
   211 000009F9 58                  <1> 	pop ax			; ax -> heap data
   212 000009FA 50                  <1> 	push ax
   213                              <1> %if _ELD_DATA_VSTART
   214 000009FB 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   215                              <1> %endif
   216 000009FE 0107                <1> 	add word [bx], ax	; relocate word referenced by entry
   217 00000A00 EBEF                <1> 	jmp @B
   218                              <1> 
   219                              <1> @@:
   220                              <1> 
   221                              <1> 			; add instance base (dx) to data
   222                              <1> %if _ELD_LINKER_PASSES
   223 00000A02 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   224 00000A05 01D3                <1> 	add bx, dx
   225                              <1>  %if _ELD_IDENTICALISE
   226                              <1> 	add bx, word [bp + ?lt]
   227                              <1> 	mov si, word [ltDataToCode + bx]
   228                              <1>  %else
   229 00000A07 8BB71C0E            <1> 	mov si, word [linktable - code + ltDataToCode + bx]
   230                              <1>  %endif
   231                              <1> %else
   232                              <1> 	mov si, internaldatatocoderelocations - code
   233                              <1> %endif
   234 00000A0B 01D6                <1> 	add si, dx
   235                              <1> @@:
   236 00000A0D AD                  <1> 	lodsw
   237 00000A0E 83F8FF              <1> 	cmp ax, -1		; was last ?
   238 00000A11 740F                <1> 	je @F			; yes -->
   239 00000A13 93                  <1> 	xchg bx, ax		; bx = entry
   240                              <1> 		; ! access the offset of the data area block, topmost on stack
   241 00000A14 58                  <1> 	pop ax
   242 00000A15 50                  <1> 	push ax
   243 00000A16 01C3                <1> 	add bx, ax		; relocate the entry itself
   244                              <1> %if _ELD_CODE_VSTART
   245 00000A18 36812F[0000]        <1> 	sub word [ss:bx], code	; undo adjustment
   246                              <1> %endif
   247 00000A1D 360117              <1> 	add word [ss:bx], dx	; relocate word referenced by entry
   248 00000A20 EBEB                <1> 	jmp @B
   249                              <1> 
   250                              <1> @@:
   251                              <1> 			; next, add heap data base (on stack) to data
   252                              <1> %if _ELD_LINKER_PASSES
   253 00000A22 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   254 00000A25 01D3                <1> 	add bx, dx
   255                              <1>  %if _ELD_IDENTICALISE
   256                              <1> 	add bx, word [bp + ?lt]
   257                              <1> 	mov si, word [ltDataToData + bx]
   258                              <1>  %else
   259 00000A27 8BB7200E            <1> 	mov si, word [linktable - code + ltDataToData + bx]
   260                              <1>  %endif
   261                              <1> %else
   262                              <1> 	mov si, internaldatatodatarelocations - code
   263                              <1> %endif
   264 00000A2B 01D6                <1> 	add si, dx
   265                              <1> @@:
   266 00000A2D AD                  <1> 	lodsw
   267 00000A2E 83F8FF              <1> 	cmp ax, -1		; was last ?
   268 00000A31 740D                <1> 	je @F			; yes -->
   269 00000A33 93                  <1> 	xchg bx, ax		; bx = entry
   270                              <1> 		; ! access the offset of the data area block, topmost on stack
   271 00000A34 58                  <1> 	pop ax			; ax -> heap data
   272 00000A35 50                  <1> 	push ax
   273 00000A36 01C3                <1> 	add bx, ax		; relocate the entry itself
   274                              <1> %if _ELD_DATA_VSTART
   275 00000A38 2D[0000]            <1> 	sub ax, datastart	; undo adjustment
   276                              <1> %endif
   277 00000A3B 360107              <1> 	add word [ss:bx], ax	; relocate word referenced by entry
   278 00000A3E EBED                <1> 	jmp @B
   279                              <1> 
   280                              <1> @@:
   281 00000A40 8B56FC              <1> 	mov dx, word [bp + ?instance]
   282                              <1> 				; reset (why??) -> ELD instance in ELD cs
   283                              <1> %if _ELD_LINKER_PASSES
   284 00000A43 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   285 00000A46 01D3                <1> 	add bx, dx
   286                              <1>  %if _ELD_IDENTICALISE
   287                              <1> 	add bx, word [bp + ?lt]
   288                              <1> 	add dx, word [ltLinkData + bx]
   289                              <1>  %else
   290 00000A48 0397240E            <1> 	add dx, word [linktable - code + ltLinkData + bx]
   291                              <1>  %endif
   292                              <1> %else
   293                              <1> 	add dx, linkerdatarelocations - code
   294                              <1> %endif
   295                              <1> .otherloop:
   296 00000A4C 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   297                              <1> 				; -> data link relocation table
   298                              <1> 
   299                              <1> .datarelocloop:		; must be done before further relocs
   300 00000A4F C576F2              <1> 	lds si, [bp + ?nextreloc]
   301 00000A52 AD                  <1> 	lodsw			; ax = section indicator
   302 00000A53 85C0                <1> 	test ax, ax		; end of table ?
   303 00000A55 7503E96601          <1> 	jz .donedatareloc
   304 00000A5A 48                  <1> 	dec ax			; al = 1 if data, 0 if code (NB ah may != 0)
   305                              <1> 		; ! access the offset of the data area block, topmost on stack
   306 00000A5B 5B                  <1> 	pop bx
   307 00000A5C 53                  <1> 	push bx			; bx -> ELD data block
   308 00000A5D 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   309 00000A60 84C0                <1> 	test al, al		; data ?
   310 00000A62 AD                  <1> 	lodsw
   311 00000A63 7504                <1> 	jnz @F			; yes -->
   312 00000A65 0346FC              <1> 	add ax, word [bp + ?instance]
   313                              <1> 				; relocate entry into code
   314 00000A68 A9                  <1> 	db __TEST_IMM16		; (skip add)
   315                              <1> @@:
   316 00000A69 01D8                <1> 	add ax, bx		; relocate entry into data
   317 00000A6B 8946EE              <1> 	mov word [bp + ?entry], ax
   318                              <1> 				; save away -> where to patch
   319 00000A6E AD                  <1> 	lodsw			; get unrelocated -> name
   320 00000A6F 8976F2              <1> 	mov word [bp + ?nextreloc], si
   321                              <1> 				; update -> behind relocation table entry
   322                              <1> %if _ELDDATA_NEXT
   323                              <1> 	rol byte [bp + ?skip_last], 1	; skipping ?
   324                              <1> 	jnc @F				; no -->
   325                              <1> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   326                              <1> 	jz .datarelocloop		; no, leave skip_last set -->
   327                              <1> 	not byte [bp + ?skip_last]	; disable skip_last
   328                              <1> 	jmp .datarelocloop
   329                              <1> @@:
   330                              <1> %endif
   331 00000A72 E81001              <1> 	call .build_match	; get ax = scan value, si -> counted string,
   332                              <1> 				;  dl = original value at byte [si]
   333                              <1> 				; NC if symbol already not found before
   334                              <1> 				; CY if to search for the symbol
   335                              <1> %if _ELD_LINKER_PASSES
   336 00000A75 73D8                <1> 	jnc .datarelocloop	; if duplicate of a not found symbol -->
   337                              <1> %endif
   338 00000A77 C45EF6              <1> 	les bx, [bp + ?linkinfo]
   339                              <1> %if ELDOTHER
   340                              <1> 	rol byte [bp + ?other], 1
   341                              <1> 	jnc @F
   342                              <1> 	les bx, [bp + ?linkinfo_other]
   343                              <1> @@:
   344                              <1> %endif				; es:bx -> link info table of the ELD host
   345 00000A7A 268B4F08            <1> 	mov cx, word [es:bx + eldlDataAmount]	; amount data link info
   346 00000A7E 268B7F0A            <1> 	mov di, word [es:bx + eldlDataPrefixes]	; -> prefixes or hashes
   347                              <1> .datarelocfind:
   348 00000A82 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   349 00000A85 F2AF                <1> 	repne scasw			; scan initial
   350                              <1> %if _ELDDATA_OPTIONAL
   351                              <1> 	jne .datanotfound_may_be_optional
   352                              <1> %else
   353 00000A87 7403E98900          <1> 	jne .datanotfound
   354                              <1> %endif
   355 00000A8C 57                  <1> 	push di
   356 00000A8D 51                  <1> 	push cx
   357 00000A8E 56                  <1> 	push si
   358 00000A8F 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   359 00000A93 4F                  <1> 	dec di
   360 00000A94 4F                  <1> 	dec di				; 0-based
   361 00000A95 26037F0C            <1> 	add di, word [es:bx + eldlDataEntries]	; -> entry
   362 00000A99 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   363 00000A9C B500                <1> 	mov ch, 0
   364 00000A9E 8A0C                <1> 	mov cl, byte [si]		; cx = length
   365 00000AA0 41                  <1> 	inc cx
   366                              <1> 	; cmp al, al			; ZR if length is zero
   367 00000AA1 F3A6                <1> 	repe cmpsb			; match ?
   368 00000AA3 5E                  <1> 	pop si
   369 00000AA4 59                  <1> 	pop cx
   370 00000AA5 5F                  <1> 	pop di
   371 00000AA6 75DA                <1> 	jne .datarelocfind		; if not found this time,
   372                              <1> 					;  scan for next initial -->
   373 00000AA8 8814                <1> 	mov byte [si], dl		; restore the original byte at counter
   374 00000AAA 262B7F0A            <1> 	sub di, word [es:bx + eldlDataPrefixes]	; = double index, 1-based
   375 00000AAE 4F                  <1> 	dec di
   376 00000AAF 4F                  <1> 	dec di				; 0-based
   377 00000AB0 26037F0E            <1> 	add di, word [es:bx + eldlDataAddresses]	; -> address (offset)
   378 00000AB4 268B05              <1> 	mov ax, word [es:di]		; get link data from the table
   379 00000AB7 E80700              <1> 	call .address_data_reloc
   380                              <1> %if _ELD_RELOC_VSTART
   381 00000ABA 2D[0000]            <1> 	sub ax, relocateddata		; *not* a relocation
   382                              <1> %endif
   383 00000ABD 0104                <1> 	add word [si], ax		; relocate
   384                              <1> %if _ELDDATA_NEXT
   385                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   386                              <1> 	jz .datarelocloop
   387                              <1> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   388                              <1> %endif
   389 00000ABF EB8E                <1> 	jmp .datarelocloop
   390                              <1> 
   391                              <1> .address_data_reloc:
   392 00000AC1 C576EE              <1> 	lds si, [bp + ?entry]		; -> entry if in ELD code instance
   393 00000AC4 807EFA00            <1> 	cmp byte [bp + ?targetsection], 0
   394                              <1> 					; relocation in code ?
   395 00000AC8 7402                <1> 	je @F				; yes -->
   396 00000ACA 16                  <1> 	push ss
   397 00000ACB 1F                  <1> 	pop ds				; => our ELD data block
   398                              <1> @@:
   399 00000ACC C3                  <1> 	retn
   400                              <1> 
   401                              <1> %if _ELDDATA_OPTIONAL
   402                              <1> .datanotfound_may_be_optional:
   403                              <1> 	mov byte [si], dl		; restore the original byte at counter
   404                              <1> %if _ELDDATA_NEXT
   405                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   406                              <1> %else
   407                              <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   408                              <1> %endif
   409                              <1> %if _ELD_DEBUG
   410                              <1> 	jnz @F
   411                              <1>  %ifn _ELD_LINKER_PASSES
   412                              <1> 	mov si, 0			; (invalid link)
   413                              <1> linkdatarelocation internalflags6
   414                              <1> 	test si, si
   415                              <1> 	jz .datanotfound
   416                              <1> 	mov si, 0			; (invalid link)
   417                              <1> linkdatarelocation options7
   418                              <1> 	test si, si
   419                              <1> 	jz .datanotfound
   420                              <1>  %else
   421                              <1> 	cmp byte [bp + ?pass], 0
   422                              <1> 	je .datanotfound
   423                              <1>  %endif
   424                              <1> 	houdini				; (the above conditions are for this)
   425                              <1> 	jmp .datanotfound
   426                              <1> @@:
   427                              <1> %else
   428                              <1> 	jz .datanotfound		; no, handle as an error -->
   429                              <1> %endif
   430                              <1> 
   431                              <1> %if ELDDATA_PMREQUIRED_STATUS
   432                              <1> 	mov si, relocateddata
   433                              <1> linkdatarelocation build_option_PM
   434                              <1> 	test si, si			; is it a PM build ?
   435                              <1> 	jz @F				; no --> (treat PM required as optional)
   436                              <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   437                              <1> 	jnz .datanotfound		; yes, handle as an error -->
   438                              <1> @@:
   439                              <1> %endif
   440                              <1> 
   441                              <1> %if _ELD_LINKER_PASSES
   442                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   443                              <1> 	rol byte [bp + ?optionalmissing], 1
   444                              <1> 	jnc .optionaldatamissingmsg
   445                              <1> 	mov si, [bp + ?name]
   446                              <1> 	or byte [si], 80h
   447                              <1> 	not byte [bp + ?optionalmissing]
   448                              <1> 	jmp @F
   449                              <1> .optionaldatamissingmsg:
   450                              <1> %endif
   451                              <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   452                              <1> linkdatarelocation options7, -3
   453                              <1> 	jz @F				; no -->
   454                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   455                              <1> 	mov byte [bp + ?optionalmissing + 1], -1
   456                              <1> %endif
   457                              <1> 	mov si, lmsg.warning_data_optional
   458                              <1> internalcoderelocation
   459                              <1> 	call .notfound			; display a warning
   460                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   461                              <1> 	not byte [bp + ?optionalmissing + 1]
   462                              <1> %endif
   463                              <1> @@:
   464                              <1> %endif
   465                              <1> %if _ELDDATA_NEXT
   466                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   467                              <1> 	jnz .datarelocloop
   468                              <1> %endif
   469                              <1> 	call .address_data_reloc
   470                              <1> 	and word [si], 0		; indicate optional data link failed
   471                              <1> 	jmp .datarelocloop
   472                              <1> %endif
   473                              <1> 
   474                              <1> 
   475                              <1> %if _ELDCALL_OPTIONAL
   476                              <1> .codenotfound_may_be_optional:
   477 00000ACD 8814                <1> 	mov byte [si], dl		; restore the original byte at counter
   478                              <1> %if _ELDCALL_NEXT
   479                              <1> 	test byte [bp + ?optional], 3	; is it an optional relocation ?
   480                              <1> %else
   481 00000ACF 807EFB00            <1> 	cmp byte [bp + ?optional], 0	; is it an optional relocation ?
   482                              <1> %endif
   483                              <1> %if _ELD_DEBUG
   484                              <1> 	jnz @F
   485                              <1>  %ifn _ELD_LINKER_PASSES
   486                              <1> 	mov si, 0			; (invalid link)
   487                              <1> linkdatarelocation internalflags6
   488                              <1> 	test si, si
   489                              <1> 	jz .codenotfound
   490                              <1> 	mov si, 0			; (invalid link)
   491                              <1> linkdatarelocation options7
   492                              <1> 	test si, si
   493                              <1> 	jz .codenotfound
   494                              <1>  %else
   495                              <1> 	cmp byte [bp + ?pass], 0
   496                              <1> 	je .codenotfound
   497                              <1>  %endif
   498                              <1> 	houdini				; (the above conditions are for this)
   499                              <1> 	jmp .codenotfound
   500                              <1> @@:
   501                              <1> %else
   502 00000AD3 7451                <1> 	jz .codenotfound		; no, handle as an error -->
   503                              <1> %endif
   504                              <1> 
   505                              <1> %if ELDCALL_PMREQUIRED_STATUS
   506                              <1>  %if _ELD_LINKER_PASSES
   507                              <1>   %assign ELDLINKER 0
   508                              <1>  %endif
   509 00000AD5 BE[0000]            <1> 	mov si, relocateddata
   510                              <1> linkdatarelocation build_option_PM
   511                              <1>  %if _ELD_LINKER_PASSES
   512                              <1>   %assign ELDLINKER 1
   513                              <1>  %endif
   514 00000AD8 85F6                <1> 	test si, si			; is it a PM build ?
   515 00000ADA 7406                <1> 	jz @F				; no --> (treat PM required as optional)
   516 00000ADC F646FB02            <1> 	test byte [bp + ?optional], 2	; optional status is PM required ?
   517 00000AE0 7544                <1> 	jnz .codenotfound		; yes, handle as an error -->
   518                              <1> @@:
   519                              <1> %endif
   520                              <1> 
   521                              <1> %if _ELD_LINKER_PASSES
   522                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   523 00000AE2 D046E4              <1> 	rol byte [bp + ?optionalmissing], 1
   524 00000AE5 730B                <1> 	jnc .optionalcodemissingmsg
   525 00000AE7 8B76E6              <1> 	mov si, [bp + ?name]
   526 00000AEA 800C80              <1> 	or byte [si], 80h
   527 00000AED F656E4              <1> 	not byte [bp + ?optionalmissing]
   528 00000AF0 EB15                <1> 	jmp @F
   529                              <1> .optionalcodemissingmsg:
   530                              <1> %endif
   531 00000AF2 36F606[0000]02      <1> 	testopt [ss:relocateddata], 2	; debug optional link ?
   532                              <1> linkdatarelocation options7, -3
   533 00000AF8 740D                <1> 	jz @F				; no -->
   534                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   535 00000AFA C646E5FF            <1> 	mov byte [bp + ?optionalmissing + 1], -1
   536                              <1> %endif
   537 00000AFE BE[2E14]            <1> 	mov si, lmsg.warning_code_optional
   538                              <1> internalcoderelocation
   539 00000B01 E83000              <1> 	call .notfound			; display a warning
   540                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   541 00000B04 F656E5              <1> 	not byte [bp + ?optionalmissing + 1]
   542                              <1> %endif
   543                              <1> @@:
   544                              <1> %endif
   545                              <1> %if _ELDCALL_NEXT
   546                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   547                              <1> 	jnz .coderelocloop
   548                              <1> %endif
   549 00000B07 C576EE              <1> 	lds si, [bp + ?entry]		; -> code site (must be in ELD cs)
   550 00000B0A C7049090            <1> 	mov word [si], 9090h
   551 00000B0E C6440290            <1> 	mov byte [si + 2], 90h		; indicate optional code link failed
   552                              <1> 					;  (NOP out the 3-byte call near imm)
   553 00000B12 E9BA00              <1> 	jmp .coderelocloop
   554                              <1> %endif
   555                              <1> 
   556                              <1> 
   557                              <1> %if _ELD_LINKER_PASSES
   558                              <1> .datanotfound:
   559 00000B15 BE[5014]            <1> 	mov si, lmsg.error_data
   560                              <1> internalcoderelocation
   561 00000B18 E81900              <1> 	call .notfound			; display error
   562 00000B1B 7306                <1> 	jnc .error_j3			; NC if in pass 0, error out now -->
   563 00000B1D FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   564 00000B20 E92CFF              <1> 	jmp .datarelocloop		; go to next relocation entry -->
   565                              <1> 
   566                              <1> .error_j3:
   567 00000B23 E9BD01              <1> 	jmp .error
   568                              <1> 
   569                              <1> .codenotfound:
   570 00000B26 BE[6914]            <1> 	mov si, lmsg.error_code
   571                              <1> internalcoderelocation
   572 00000B29 E80800              <1> 	call .notfound			; display error
   573 00000B2C 73F5                <1> 	jnc .error_j3			; NC if in pass 0 -->
   574 00000B2E FF46E8              <1> 	inc word [bp + ?amounterrors]	; count the amount of errors
   575 00000B31 E99B00              <1> 	jmp .coderelocloop		; go to next -->
   576                              <1> 
   577                              <1> .notfound:
   578 00000B34 807EEA00            <1> 	cmp byte [bp + ?pass], 0	; pass 0 ?
   579 00000B38 7442                <1> 	je .notfound.retn		; yes, do not try displaying --> (NC)
   580 00000B3A 16                  <1> 	 push ss
   581 00000B3B 07                  <1> 	 pop es
   582 00000B3C BF[0000]            <1> 	mov di, relocateddata
   583                              <1> linkdatarelocation line_out		; es:di -> line_out buffer
   584 00000B3F E83B00              <1> 	call .copy			; copy prefix message
   585 00000B42 8B76E6              <1> 	mov si, word [bp + ?name]
   586 00000B45 AD                  <1> 	lodsw				; = hash
   587 00000B46 E8[0000]EB020000    <1> 	extcall hexword			; display the hash in hex
   588 00000B4D 56                  <1> 	push si
   589 00000B4E BE[8214]            <1> 	mov si, lmsg.error.2
   590                              <1> internalcoderelocation
   591 00000B51 E82900              <1> 	call .copy			; display message fragment
   592 00000B54 5E                  <1> 	pop si
   593                              <1> %if _ELD_LINKER_PASSES
   594 00000B55 56                  <1> 	push si
   595 00000B56 E82400              <1> 	call .copy			; copy over the full name
   596 00000B59 5E                  <1> 	pop si
   597                              <1>  %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   598 00000B5A 800C80              <1> 	or byte [si], 80h		; mark as failed optional link
   599 00000B5D D046E5              <1> 	rol byte [bp + ?optionalmissing + 1], 1
   600                              <1> 					; was it optional ?
   601 00000B60 7203                <1> 	jc @F				; yes -->
   602                              <1>  %endif
   603 00000B62 C60400              <1> 	mov byte [si], 0		; mark as failed (counter byte = 0)
   604                              <1> @@:
   605                              <1> %else
   606                              <1> 	call .copy
   607                              <1> %endif
   608 00000B65 B022                <1> 	mov al, '"'
   609 00000B67 AA                  <1> 	stosb				; end message with a closing quote mark
   610 00000B68 16                  <1> 	 push ss
   611 00000B69 1F                  <1> 	 pop ds
   612 00000B6A E8[0000]EB020000    <1> 	extcall putsline_crlf		; display diagnostic line
   613 00000B71 B8350E              <1> 	mov ax, 0E35h
   614 00000B74 E8[0000]EB020000    <1> 	extcall setrc
   615 00000B7B F9                  <1> 	stc				; CY, diagnostic displayed
   616                              <1> .notfound.retn:
   617 00000B7C C3                  <1> 	retn
   618                              <1> 
   619                              <1> .copy:		; (cannot use extcallcall here)
   620 00000B7D E8[0000]EB020000    <1> 	extcall copy_single_counted_string
   621 00000B84 C3                  <1> 	retn
   622                              <1> %else
   623                              <1> .datanotfound: equ .error
   624                              <1> .codenotfound: equ .error
   625                              <1> %endif
   626                              <1> 
   627                              <1> .build_match:
   628                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   629 00000B85 C646E400            <1> 	mov byte [bp + ?optionalmissing], 0
   630                              <1> 		; This is needed for eldtestj.asm with debugoptlink.
   631                              <1> 		;  The optional data link sets flag 80h, then the
   632                              <1> 		;  required data link to the same symbol sets this
   633                              <1> 		;  flag but doesn't reset it. So the first optional
   634                              <1> 		;  code link still had this set. Reset here to fix.
   635                              <1> %endif
   636                              <1> %if _ELD_CODE_VSTART
   637 00000B89 2D[0000]            <1> 	sub ax, code			; revert adjustment (= displacement)
   638                              <1> %endif
   639 00000B8C 0346FC              <1> 	add ax, word [bp + ?instance]	; make displacement into -> name string
   640 00000B8F 96                  <1> 	xchg si, ax			; si -> hash word, counted name string
   641                              <1> %if _ELD_LINKER_PASSES || _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   642 00000B90 8976E6              <1> 	mov word [bp + ?name], si	; save away for diagnostics
   643                              <1> %endif
   644 00000B93 AD                  <1> 	lodsw			; = hash, si -> counted string
   645 00000B94 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   646                              <1> %if _ELD_LINKER_PASSES
   647 00000B96 84D2                <1> 	test dl, dl		; marked as already failed ?
   648                              <1> 				;  (80h = optional, 0 = required)
   649 00000B98 750A                <1> 	jnz @F			; no -->
   650 00000B9A 837EE800            <1> 	cmp word [bp + ?amounterrors], 0
   651                              <1> 				; validate error status
   652 00000B9E 7503E9B300          <1> 	je .error_j		; no error known ?! cancel quickly -->
   653 00000BA3 C3                  <1> 	retn			; (NC)
   654                              <1> 
   655                              <1> @@:
   656                              <1> %else
   657                              <1> 	test dl, dl
   658                              <1> %endif
   659                              <1> %if _ELDDATA_OPTIONAL || _ELDCALL_OPTIONAL
   660 00000BA4 7909                <1> 	jns @F
   661 00000BA6 80E27F              <1> 	and dl, 7Fh
   662 00000BA9 8814                <1> 	mov byte [si], dl
   663 00000BAB C646E4FF            <1> 	mov byte [bp + ?optionalmissing], -1
   664                              <1> @@:
   665                              <1> %endif
   666                              <1> %if ELDOTHER
   667                              <1> 	rol byte [bp + ?other], 1
   668                              <1> 	jnc @F
   669                              <1> 	rol byte [bp + ?use_hash_other], 1
   670                              <1> 	jmp @FF
   671                              <1> 
   672                              <1> @@:
   673                              <1> %endif
   674 00000BAF D046EC              <1> 	rol byte [bp + ?use_hash], 1
   675                              <1> @@:
   676                              <1> 		; If to use the hash, then ax = hash and si ->
   677                              <1> 		;  the entire symbol name as a counted string.
   678 00000BB2 720A                <1> 	jc @F			; if to use hash, return now -->
   679 00000BB4 AC                  <1> 	lodsb			; al = length
   680 00000BB5 91                  <1> 	xchg cx, ax		; cl = length
   681 00000BB6 AD                  <1> 	lodsw			; ax = prefix
   682 00000BB7 49                  <1> 	dec cx
   683 00000BB8 49                  <1> 	dec cx			; cl = adjusted length
   684 00000BB9 4E                  <1> 	dec si			; -> second byte of prefix
   685 00000BBA 8A14                <1> 	mov dl, byte [si]	; dl = original start byte of match
   686 00000BBC 880C                <1> 	mov byte [si], cl	; si -> counted string suffix
   687                              <1> 		; (this name entry has been edited to provide the
   688                              <1> 		;  name suffix as a counted string, as required by
   689                              <1> 		;  the old-style non-hash link info tables.
   690                              <1> 		; it will be reset later by writing dl to si -> the
   691                              <1> 		;  first byte of the match string.)
   692                              <1> @@:
   693                              <1> %if _ELD_LINKER_PASSES
   694 00000BBE F9                  <1> 	stc			; CY
   695                              <1> %endif
   696 00000BBF C3                  <1> 	retn
   697                              <1> 
   698                              <1> 
   699                              <1> .donedatareloc:
   700                              <1> %if ELDOTHER
   701                              <1> 	rol byte [bp + ?other], 1
   702                              <1> 	jc .otherdone		; other link only has data links,
   703                              <1> 				;  so at this point we're done -->
   704                              <1> %endif
   705                              <1> 
   706 00000BC0 8B56FC              <1> 	mov dx, word [bp + ?instance]
   707                              <1> %if _ELD_LINKER_PASSES
   708 00000BC3 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   709 00000BC6 01D3                <1> 	add bx, dx
   710                              <1>  %if _ELD_IDENTICALISE
   711                              <1> 	add bx, word [bp + ?lt]
   712                              <1> 	add dx, word [ltLinkCode + bx]
   713                              <1>  %else
   714 00000BC8 0397280E            <1> 	add dx, word [linktable - code + ltLinkCode + bx]
   715                              <1>  %endif
   716                              <1> %else
   717                              <1> 	add dx, linkercoderelocations - code
   718                              <1> %endif
   719 00000BCC 8956F2              <1> 	mov word [bp + ?nextreloc], dx
   720                              <1> 
   721                              <1> .coderelocloop:
   722 00000BCF C576F2              <1> 	lds si, [bp + ?nextreloc]
   723 00000BD2 AD                  <1> 	lodsw
   724                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   725 00000BD3 48                  <1> 	dec ax				; optional word is 1-based, get 0-based
   726 00000BD4 7903E98F00          <1> 	js .donecodereloc
   727 00000BD9 8946FA              <1> 	mov word [bp + ?targetsection_low_optional_high], ax
   728 00000BDC AD                  <1> 	lodsw
   729                              <1> %endif
   730 00000BDD 0346FC              <1> 	add ax, word [bp + ?instance]
   731 00000BE0 8946EE              <1> 	mov word [bp + ?entry], ax
   732 00000BE3 AD                  <1> 	lodsw
   733 00000BE4 8976F2              <1> 	mov word [bp + ?nextreloc], si
   734                              <1> %ifn _ELDCALL_OPTIONAL || _ELDCALL_NEXT
   735                              <1> 	test ax, ax			; if no optional word, check -> match
   736                              <1> 	jz .donecodereloc
   737                              <1> %endif
   738                              <1> %if _ELDCALL_NEXT
   739                              <1> 	rol byte [bp + ?skip_last], 1	; skipping ?
   740                              <1> 	jnc @F				; no -->
   741                              <1> 	test byte [bp + ?optional], 8	; is it a last relocation ?
   742                              <1> 	jz .coderelocloop		; no, leave skip_last set -->
   743                              <1> 	not byte [bp + ?skip_last]	; disable skip_last
   744                              <1> 	jmp .coderelocloop
   745                              <1> @@:
   746                              <1> %endif
   747 00000BE7 E89BFF              <1> 	call .build_match
   748                              <1> %if _ELD_LINKER_PASSES
   749 00000BEA 73E3                <1> 	jnc .coderelocloop
   750                              <1> %endif
   751 00000BEC C45EF6              <1> 	les bx, [bp + ?linkinfo]
   752 00000BEF 268B4F10            <1> 	mov cx, word [es:bx + eldlCodeAmount]	; amount code link info
   753 00000BF3 268B7F12            <1> 	mov di, word [es:bx + eldlCodePrefixes]	; -> prefixes or hashes
   754                              <1> .coderelocfind:
   755 00000BF7 83F901              <1> 	cmp cx, 1			; NZ if cx == 0
   756 00000BFA F2AF                <1> 	repne scasw			; scan initial
   757                              <1> %if _ELDCALL_OPTIONAL
   758 00000BFC 7403E9CCFE          <1> 	jne .codenotfound_may_be_optional
   759                              <1> %else
   760                              <1>  %if _ELD_DEBUG
   761                              <1> 	je @F
   762                              <1> 	houdini
   763                              <1> 	jmp .codenotfound
   764                              <1> @@:
   765                              <1>  %else
   766                              <1> 	jne .codenotfound
   767                              <1>  %endif
   768                              <1> %endif
   769 00000C01 57                  <1> 	push di
   770 00000C02 51                  <1> 	push cx
   771 00000C03 56                  <1> 	push si
   772 00000C04 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   773 00000C08 4F                  <1> 	dec di
   774 00000C09 4F                  <1> 	dec di				; 0-based
   775 00000C0A 26037F14            <1> 	add di, word [es:bx + eldlCodeEntries]	; -> entry
   776 00000C0E 268B3D              <1> 	mov di, [es:di]			; -> counted suffix/string
   777 00000C11 B500                <1> 	mov ch, 0
   778 00000C13 8A0C                <1> 	mov cl, byte [si]		; cx = length
   779 00000C15 41                  <1> 	inc cx
   780                              <1> 	; cmp al, al			; ZR if length is zero
   781 00000C16 F3A6                <1> 	repe cmpsb			; match ?
   782 00000C18 5E                  <1> 	pop si
   783 00000C19 59                  <1> 	pop cx
   784 00000C1A 5F                  <1> 	pop di
   785 00000C1B 75DA                <1> 	jne .coderelocfind
   786 00000C1D 8814                <1> 	mov byte [si], dl
   787 00000C1F 262B7F12            <1> 	sub di, word [es:bx + eldlCodePrefixes]	; = double index, 1-based
   788 00000C23 4F                  <1> 	dec di
   789 00000C24 4F                  <1> 	dec di				; 0-based
   790 00000C25 01FF                <1> 	add di, di			; quadruple index
   791 00000C27 26037F16            <1> 	add di, word [es:bx + eldlCodeAddresses]	; -> address (offset, segment)
   792 00000C2B 26FF35              <1> 	push word [es:di]
   793 00000C2E C576EE              <1> 	lds si, [bp + ?entry]
   794 00000C31 8F4405              <1> 	pop word [si + 3 + 2]		; call near imm (3), jmp short (2)
   795                              <1> 					;  patch the destination address
   796 00000C34 803CE8              <1> 	cmp byte [si], 0E8h		; is it as expected ?
   797 00000C37 751D                <1> 	jne .error_j
   798 00000C39 268B7D02            <1> 	mov di, word [es:di + 2]
   799 00000C3D BB[0000]            <1> 	mov bx, relocateddata
   800                              <1> linkdatarelocation linkcall_table	; ss:bx -> link call table
   801 00000C40 36833F01            <1> 	cmp word [ss:bx], 1		; is it initialised to format 1 ?
   802 00000C44 7510                <1> 	jne .error_j			; no -->
   803 00000C46 368B4F02            <1> 	mov cx, word [ss:bx + 2]	; get amount of segments
   804 00000C4A E30A                <1> 	jcxz .error_j			; none -->
   805                              <1> @@:
   806 00000C4C 83C304              <1> 	add bx, 4			; -> next segment
   807 00000C4F 36393F              <1> 	cmp word [ss:bx], di		; value matches ?
   808 00000C52 7405                <1> 	je @F				; yes, found -->
   809 00000C54 E2F6                <1> 	loop @B				; try remaining segments
   810                              <1> .error_j:
   811 00000C56 E98A00              <1> 	jmp .error
   812                              <1> 
   813                              <1> @@:
   814 00000C59 368B5F02            <1> 	mov bx, word [ss:bx + 2]	; -> call destination offset
   815                              <1> 		; si + 3 + delta = bx
   816                              <1> 		; delta = bx - si - 3
   817 00000C5D 29F3                <1> 	sub bx, si
   818 00000C5F 83EB03              <1> 	sub bx, 3
   819 00000C62 895C01              <1> 	mov word [si + 1], bx		; patch the call instruction
   820                              <1> %if _ELDCALL_NEXT
   821                              <1> 	test byte [bp + ?optional], 4	; is it a next relocation ?
   822                              <1> 	jz .coderelocloop
   823                              <1> 	mov byte [bp + ?skip_last], -1	; skip subsequent next/last relocs
   824                              <1> %endif
   825 00000C65 E967FF              <1> 	jmp .coderelocloop
   826                              <1> 
   827                              <1> .donecodereloc:
   828                              <1> %if _ELD_LINKER_PASSES
   829 00000C68 8B46E8              <1> 	mov ax, word [bp + ?amounterrors]
   830 00000C6B 85C0                <1> 	test ax, ax
   831 00000C6D 75E7                <1> 	jnz .error_j
   832 00000C6F 8B5EEA              <1> 	mov bx, word [bp + ?pass]
   833 00000C72 85DB                <1> 	test bx, bx
   834 00000C74 750B                <1> 	jnz @F
   835 00000C76 43                  <1> 	inc bx
   836 00000C77 43                  <1> 	inc bx
   837 00000C78 895EEA              <1> 	mov word [bp + ?pass], bx
   838 00000C7B 8B56FC              <1> 	mov dx, word [bp + ?instance]
   839 00000C7E E94AFD              <1> 	jmp .pass
   840                              <1> 
   841                              <1> @@:
   842                              <1> %endif
   843                              <1> 
   844                              <1> %ifnidni _LISTING, ""
   845                              <1> %assign ELDLINKER 0
   846                              <1> .hint:
   847 00000C81 16                  <1> 	push ss
   848 00000C82 1F                  <1> 	pop ds
   849 00000C83 B02D                <1> 	mov al, 2Dh
   850 00000C85 E8[0000]EB020000    <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   851                              <1> 					; CHG: ax, dx, bx
   852 00000C8C 7437                <1> 	jz .no_hint
   853                              <1> 
   854                              <1> %if ELDOTHER
   855                              <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   856                              <1> internalcoderelocation
   857                              <1> %endif
   858                              <1> 
   859 00000C8E 8A26[0000]          <1> 	mov ah, byte [relocateddata]
   860                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   861 00000C92 E85500              <1> 	call plex_check
   862 00000C95 7305                <1> 	jnc @F
   863                              <1> 
   864 00000C97 B4FF                <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   865                              <1> .loop_hint:
   866 00000C99 E84E00              <1> 	call plex_check
   867                              <1> @@:
   868 00000C9C 7307                <1> 	jnc .end_hint		; if found --> (NC)
   869 00000C9E 80EC01              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   870 00000CA1 73F6                <1> 	jnc .loop_hint		; try next if we didn't check all yet -->
   871 00000CA3 EB20                <1> 	jmp .no_hint
   872                              <1> 
   873                              <1> .end_hint:
   874 00000CA5 50                  <1> 	push ax
   875 00000CA6 C446FC              <1> 	les ax, [bp + ?instance]
   876 00000CA9 BF[E710]            <1> 	mov di, listmsg.hint.offset
   877                              <1> internalcoderelocation
   878 00000CAC E8[0000]EB020000    <1> 	extcall hexword
   879 00000CB3 BB[CC10]            <1> 	mov bx, listmsg.hint
   880                              <1> internalcoderelocation
   881 00000CB6 368B16[0000]        <1> 	mov dx, [ss:relocateddata]
   882                              <1> linkdatarelocation extseg	; must be 86 Mode segment even in PM
   883 00000CBB 58                  <1> 	pop ax
   884 00000CBC B040                <1> 	mov al, 40h		; AMIS message display service
   885 00000CBE E8[0000]EB020000    <1> 	extcall call_int2D
   886                              <1> .no_hint:
   887                              <1> %endif
   888                              <1> 
   889                              <1> %if ELDOTHER
   890                              <1> %assign ELDLINKER 0
   891                              <1> 	not byte [bp + ?other]
   892                              <1> 
   893                              <1> 	push ss
   894                              <1> 	pop ds
   895                              <1> 	mov al, 2Dh
   896                              <1> 	extcall intchk			; ZR if offset = -1 or segment = 0
   897                              <1> 					; CHG: ax, dx, bx
   898                              <1> 	jz .no_other
   899                              <1> 
   900                              <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
   901                              <1> internalcoderelocation
   902                              <1> 
   903                              <1> 	mov ah, byte [relocateddata]
   904                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   905                              <1> 	call plex_check
   906                              <1> 	jnc @F
   907                              <1> 
   908                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   909                              <1> .loop_other_debug:
   910                              <1> 	call plex_check
   911                              <1> @@:
   912                              <1> 	jnc .end_other		; if found --> (NC)
   913                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   914                              <1> 	jnc .loop_other_debug	; try next if we didn't check all yet -->
   915                              <1> 
   916                              <1> 	mov si, loaderamissig	; ds:si -> our AMIS name strings
   917                              <1> internalcoderelocation
   918                              <1> 
   919                              <1> 	mov ah, byte [relocateddata]
   920                              <1> linkdatarelocation try_debugger_amis_multiplex_number
   921                              <1> 	call plex_check
   922                              <1> 	jnc @F
   923                              <1> 
   924                              <1> 	mov ah, 0FFh		; start with multiplex number 0FFh
   925                              <1> .loop_other_loader:
   926                              <1> 	call plex_check
   927                              <1> @@:
   928                              <1> 	jnc .end_other		; if found --> (NC)
   929                              <1> 	sub ah, 1		; search is backward (to find latest installed first), from 0FFh to 00h including
   930                              <1> 	jnc .loop_other_loader	; try next if we didn't check all yet -->
   931                              <1> 
   932                              <1> 	jmp .no_other
   933                              <1> 
   934                              <1> .end_other:
   935                              <1> 	mov al, 42h		; AMIS get other link info service
   936                              <1> 	extcall call_int2D
   937                              <1> 	cmp al, 0FFh
   938                              <1> 	jne .no_other
   939                              <1> 
   940                              <1> 	mov ax, si		; selector => PSP
   941                              <1> 	extcall ispm
   942                              <1> 	jz @F
   943                              <1> 	mov ax, dx		; segment => PSP
   944                              <1> @@:
   945                              <1> 	 push ss
   946                              <1> 	 pop ds
   947                              <1> 	mov word [otherds], ax
   948                              <1> internaldatarelocation		; current mode sel/seg
   949                              <1> 	mov word [otherseg], dx
   950                              <1> internaldatarelocation		; remember segment
   951                              <1> 
   952                              <1> 	mov ax, cx		; selector => link info
   953                              <1> 	extcall ispm
   954                              <1> 	jz @F
   955                              <1> 	mov ax, bx		; segment => link info
   956                              <1> @@:
   957                              <1> 	mov word [bp + ?linkinfo_other], di
   958                              <1> 	mov word [bp + ?linkinfo_other + 2], ax
   959                              <1> 
   960                              <1> 	mov ds, ax		; => link info
   961                              <1> 	xor ax, ax
   962                              <1> 	cmp word [di + eldlSignature], 0E1D1h
   963                              <1> 	jne .error_other
   964                              <1> 	cmp word [di + eldlUseLinkHash], 1
   965                              <1> 	ja .error_other
   966                              <1> 	jb @F
   967                              <1> 	dec ax
   968                              <1> @@:
   969                              <1> 	mov word [bp + ?use_hash_other], ax
   970                              <1> 
   971                              <1> 	mov dx, word [bp + ?instance]
   972                              <1> 	add dx, linkerotherdatarelocations - code
   973                              <1> 	jmp .otherloop
   974                              <1> 
   975                              <1> .error_other:
   976                              <1> 	push cs
   977                              <1> 	pop ds
   978                              <1> 	mov ax, 0E33h
   979                              <1> 	extcall setrc
   980                              <1> 	mov dx, lmsg.error_other
   981                              <1> internalcoderelocation
   982                              <1> 	jmp @F
   983                              <1> 
   984                              <1> .no_other:
   985                              <1> 	push cs
   986                              <1> 	pop ds
   987                              <1> 	mov ax, 0E34h
   988                              <1> 	extcall setrc
   989                              <1> 	mov dx, lmsg.no_other
   990                              <1> internalcoderelocation
   991                              <1> @@:
   992                              <1> 	extcall putsz
   993                              <1> .error_j2:
   994                              <1> 	jmp .error
   995                              <1> 
   996                              <1> .otherdone:
   997                              <1>  %if _ELD_LINKER_PASSES
   998                              <1> 	mov ax, word [bp + ?amounterrors]
   999                              <1> 	test ax, ax
  1000                              <1> 	jnz .error_j2
  1001                              <1>  %endif
  1002                              <1> %endif
  1003                              <1> 
  1004 00000CC5 5B                  <1> 	pop bx				; -> our heap data
  1005 00000CC6 5E                  <1> 	pop si				; -> our command line tail
  1006 00000CC7 16                  <1> 	 push ss
  1007 00000CC8 1F                  <1> 	 pop ds
  1008 00000CC9 C47EFC              <1> 	les di, [bp + ?instance]
  1009 00000CCC 268B4502            <1> 	mov ax, word [es:di + eldiEndCode]
  1010                              <1> houdini
  1011 00000CD0 2D[A009]            <1> 	sub ax, strict word endresident + code
  1012                              <1> internalcoderelocation
  1013 00000CD3 26C74502[A009]      <1> 	mov word [es:di + eldiEndCode], endresident + code
  1014                              <1> internalcoderelocation
  1015 00000CD9 2906[0000]          <1> 	sub word [relocateddata], ax
  1016                              <1> linkdatarelocation extseg_used
  1017                              <1> %if _DATA_SIZE == 0
  1018                              <1> 	xor ax, ax
  1019                              <1> 	mov word [es:di + eldiStartData], ax
  1020                              <1> 	mov word [es:di + eldiEndData], ax
  1021                              <1> %endif
  1022 00000CDD 89EC5D              <1> 	lleave code
  1023                              <1> 		; INP:	es => ELD code segment
  1024                              <1> 		;	ds:si -> command line tail
  1025                              <1> 		;	ds:bx -> ELD data block
  1026                              <1> 		;	ss:sp -> far return address for current mode
  1027                              <1> 		; STT:	ds = ss, UP, EI
  1028 00000CE0 E9EDFB              <1> 	jmp start
  1029                              <1> 
  1030                              <1> .error:
  1031 00000CE3 89EC5D              <1> 	lleave
  1032 00000CE6 B8FFFF              <1> 	mov ax, -1
  1033 00000CE9 CB                  <1> 	retf
  1034                              <1> 
  1035                              <1> 
  1036                              <1> %ifnidni _LISTING, ""
  1037                              <1>  %assign ELDHINT 1
  1038                              <1> %else
  1039                              <1>  %assign ELDHINT 0
  1040                              <1> %endif
  1041                              <1> 
  1042                              <1> %if ELDOTHER || ELDHINT
  1043                              <1> 		; INP:	ah = multiplex number to check
  1044                              <1> 		;	(if ELDOTHER:)
  1045                              <1> 		;	 cs:si -> 16-byte AMIS signature to check
  1046                              <1> 		; OUT:	CY if multiplex number unused or no signature match,
  1047                              <1> 		;	 bp, ah, ds unmodified
  1048                              <1> 		;	NC if match found,
  1049                              <1> 		;	 ah = multiplex number (unmodified)
  1050                              <1> 		; CHG:	di, es, cx, dx
  1051                              <1> 		;	(if ELDOTHER:) bx
  1052                              <1> 		;	(if not ELDOTHER:) si
  1053                              <1> plex_check:
  1054 00000CEA 16                  <1> 	push ss
  1055 00000CEB 1F                  <1> 	pop ds
  1056 00000CEC F606[0000]08        <1> 	testopt [relocateddata], 8
  1057                              <1> linkdatarelocation internalflags4, -3
  1058 00000CF1 740B                <1> 	jz @F
  1059                              <1> %if ELDOTHER
  1060                              <1> 	mov bx, relocateddata
  1061                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1062                              <1> 	test bx, bx
  1063                              <1> 	jz @F
  1064                              <1> 	cmp ah, byte [bx]
  1065                              <1> 	je .notfound		; do not use our own multiplexer -->
  1066                              <1> %else
  1067 00000CF3 BE[0000]            <1> 	mov si, relocateddata
  1068                              <1> linkdatarelocation amis_multiplex_number, -2, optional
  1069 00000CF6 85F6                <1> 	test si, si
  1070 00000CF8 7404                <1> 	jz @F
  1071 00000CFA 3A24                <1> 	cmp ah, byte [si]
  1072 00000CFC 7420                <1> 	je .notfound		; do not use our own multiplexer -->
  1073                              <1> %endif
  1074                              <1> @@:
  1075 00000CFE B000                <1> 	mov al, 00h		; AMIS installation check
  1076 00000D00 E8[0000]EB020000    <1> 	extcall call_int2D	; AMIS (or "DOS reserved" = iret if no AMIS present)
  1077 00000D07 3CFF                <1> 	cmp al, 0FFh
  1078 00000D09 7513                <1> 	jne .notfound
  1079 00000D0B 0E                  <1> 	push cs
  1080 00000D0C 1F                  <1> 	pop ds
  1081                              <1> %if ELDOTHER
  1082                              <1> 	push si
  1083                              <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1084                              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1085                              <1> 	repe cmpsw
  1086                              <1> 	pop si
  1087                              <1> %else
  1088 00000D0D BE[BC10]            <1> 	mov si, debuggeramissig	; ds:si -> our AMIS name strings
  1089                              <1> internalcoderelocation
  1090 00000D10 E8[0000]EB020000    <1> 	extcall setes2dx	; es:di -> name strings of AMIS multiplexer that just answered
  1091 00000D17 B90800              <1> 	mov cx, 8		; Ignore description, only compare vendor and program name
  1092 00000D1A F3A7                <1> 	repe cmpsw
  1093                              <1> %endif
  1094 00000D1C 7401                <1> 	je .checkret		; ZR, NC = match -->
  1095                              <1> .notfound:
  1096 00000D1E F9                  <1> 	stc			; CY no match
  1097                              <1> .checkret:
  1098 00000D1F C3                  <1> 	retn
  1099                              <1> %endif
  1100                              <1> 
  1101                              <1> 
  1102                              <1> 	align 4, db 0
  1103                              <1> linkercoderelocations:
  1104                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1105 00000D20 01002200[EF10]0101- <1> 	dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
  1105 00000D28 9F01[FE10]01000602- <1>
  1105 00000D30 [0C11]01039F04-     <1>
  1105 00000D36 [1711]01037105-     <1>
  1105 00000D3C [2611]0100C307-     <1>
  1105 00000D42 [3111]0100D007-     <1>
  1105 00000D48 [3911]0100D807-     <1>
  1105 00000D4E [4511]0100E007-     <1>
  1105 00000D54 [5111]0100E807-     <1>
  1105 00000D5A [5811]0100F007-     <1>
  1105 00000D60 [6111]0100F807-     <1>
  1105 00000D66 [6811]01000008-     <1>
  1105 00000D6C [7011]01000808-     <1>
  1105 00000D72 [7811]01001008-     <1>
  1105 00000D78 [8411]01001808-     <1>
  1105 00000D7E [9011]01002008-     <1>
  1105 00000D84 [9D11]01002808-     <1>
  1105 00000D8A [A811]01003008-     <1>
  1105 00000D90 [B111]01003808-     <1>
  1105 00000D96 [BA11]01004008-     <1>
  1105 00000D9C [C411]01004808-     <1>
  1105 00000DA2 [CF11]01005008-     <1>
  1105 00000DA8 [DA11]01005808-     <1>
  1105 00000DAE [EA11]01006008-     <1>
  1105 00000DB4 [FC11]01006808-     <1>
  1105 00000DBA [0612]01007008-     <1>
  1105 00000DC0 [0F12]01007808-     <1>
  1105 00000DC6 [2412]01008008-     <1>
  1105 00000DCC [3A12]01008808-     <1>
  1105 00000DD2 [4412]01005A09-     <1>
  1105 00000DD8 [5811]0100850C-     <1>
  1105 00000DDE [6B12]0100AC0C-     <1>
  1105 00000DE4 [BA11]0100BE0C-     <1>
  1105 00000DEA [7412]0100000D-     <1>
  1105 00000DF0 [7412]0100100D-     <1>
  1105 00000DF6 [8112]0000          <1>
  1106                              <1> %else
  1107                              <1> 	dw ELDCALL_CODE_RELOCATIONS, 0, 0
  1108                              <1> %endif
  1109                              <1> 
  1110                              <1> %if _ELD_LINKER_PASSES
  1111                              <1> linkerlinkercoderelocations:
  1112                              <1> %if _ELDCALL_OPTIONAL || _ELDCALL_NEXT
  1113 00000DFA 0100460B[BA11]0100- <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
  1113 00000E02 6A0B[DA11]0100740B- <1>
  1113 00000E0A [7011]01007D0B-     <1>
  1113 00000E10 [4E12]0000          <1>
  1114                              <1> %else
  1115                              <1> 	dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
  1116                              <1> %endif
  1117                              <1> 
  1118                              <1> 	align 2, db 0
  1119                              <1> linktable:
  1120                              <1> 	istruc LINKTABLE
  1121                              <1> at ltCodeToCode
  1122 00000E14 AC10                <1> 	dw internallinkercodetocoderelocations - code
  1123 00000E16 E40F                <1> 	dw internalcodetocoderelocations - code
  1124                              <1> at ltCodeToData
  1125 00000E18 B610                <1> 	dw internallinkercodetodatarelocations - code
  1126 00000E1A 1A10                <1> 	dw internalcodetodatarelocations - code
  1127                              <1> at ltDataToCode
  1128 00000E1C B810                <1> 	dw internallinkerdatatocoderelocations - code
  1129 00000E1E 8010                <1> 	dw internaldatatocoderelocations - code
  1130                              <1> at ltDataToData
  1131 00000E20 BA10                <1> 	dw internallinkerdatatodatarelocations - code
  1132 00000E22 9610                <1> 	dw internaldatatodatarelocations - code
  1133                              <1> at ltLinkData
  1134 00000E24 9810                <1> 	dw linkerlinkerdatarelocations - code
  1135 00000E26 2C0E                <1> 	dw linkerdatarelocations - code
  1136                              <1> at ltLinkCode
  1137 00000E28 FA0D                <1> 	dw linkerlinkercoderelocations - code
  1138 00000E2A 200D                <1> 	dw linkercoderelocations - code
  1139                              <1> 	iend
  1140                              <1> %endif
  1141                              <1> 
  1142                              <1> 	align 2, db 0
  1143                              <1> linkerdatarelocations:
  1144 00000E2C 01004700[8C12]0100- <1> 	dw LINK_DATA_RELOCATIONS, 0
  1144 00000E34 4900[9612]01004C00- <1>
  1144 00000E3C [9F12]01006000-     <1>
  1144 00000E42 [AF12]01006900-     <1>
  1144 00000E48 [BA12]01007500-     <1>
  1144 00000E4E [C312]01009900-     <1>
  1144 00000E54 [C312]0100D800-     <1>
  1144 00000E5A [D912]0100DD00-     <1>
  1144 00000E60 [EA12]0100EF00-     <1>
  1144 00000E66 [F312]01000D01-     <1>
  1144 00000E6C [D912]01002401-     <1>
  1144 00000E72 [0B13]01002801-     <1>
  1144 00000E78 [0B13]01002C01-     <1>
  1144 00000E7E [F312]01005801-     <1>
  1144 00000E84 [EA12]01007501-     <1>
  1144 00000E8A [1E13]01008001-     <1>
  1144 00000E90 [1E13]0100AA01-     <1>
  1144 00000E96 [2913]0100AE01-     <1>
  1144 00000E9C [3A13]0100B101-     <1>
  1144 00000EA2 [5213]0100C001-     <1>
  1144 00000EA8 [6413]0100C301-     <1>
  1144 00000EAE [6413]01001502-     <1>
  1144 00000EB4 [5213]01003402-     <1>
  1144 00000EBA [D912]01009402-     <1>
  1144 00000EC0 [1E13]01009702-     <1>
  1144 00000EC6 [6413]0100A102-     <1>
  1144 00000ECC [6413]0100CC02-     <1>
  1144 00000ED2 [6413]0100D302-     <1>
  1144 00000ED8 [6413]0100D702-     <1>
  1144 00000EDE [3A13]0100DC02-     <1>
  1144 00000EE4 [5213]0100EC02-     <1>
  1144 00000EEA [2913]0100F302-     <1>
  1144 00000EF0 [5213]01000103-     <1>
  1144 00000EF6 [6413]01000603-     <1>
  1144 00000EFC [6413]01000B03-     <1>
  1144 00000F02 [F312]01001003-     <1>
  1144 00000F08 [0B13]01001403-     <1>
  1144 00000F0E [0B13]01001E03-     <1>
  1144 00000F14 [0B13]01002303-     <1>
  1144 00000F1A [0B13]01002903-     <1>
  1144 00000F20 [1E13]01003803-     <1>
  1144 00000F26 [7013]0100B803-     <1>
  1144 00000F2C [D912]01004404-     <1>
  1144 00000F32 [6413]01004904-     <1>
  1144 00000F38 [3A13]01005904-     <1>
  1144 00000F3E [2913]01006904-     <1>
  1144 00000F44 [6413]01006D04-     <1>
  1144 00000F4A [F312]01007404-     <1>
  1144 00000F50 [0B13]01008304-     <1>
  1144 00000F56 [0B13]01008804-     <1>
  1144 00000F5C [0B13]01008E04-     <1>
  1144 00000F62 [1E13]0100AB04-     <1>
  1144 00000F68 [7013]01005005-     <1>
  1144 00000F6E [1E13]0100C306-     <1>
  1144 00000F74 [1E13]02001400-     <1>
  1144 00000F7A [7A13]02001600-     <1>
  1144 00000F80 [7A13]02001800-     <1>
  1144 00000F86 [7A13]0100D608-     <1>
  1144 00000F8C [8913]01002509-     <1>
  1144 00000F92 [9913]01003909-     <1>
  1144 00000F98 [A713]01004909-     <1>
  1144 00000F9E [B213]01005609-     <1>
  1144 00000FA4 [C013]01006D09-     <1>
  1144 00000FAA [B213]01007109-     <1>
  1144 00000FB0 [C312]01008C09-     <1>
  1144 00000FB6 [C312]01009209-     <1>
  1144 00000FBC [A713]0100D60A-     <1>
  1144 00000FC2 [5213]0100900C-     <1>
  1144 00000FC8 [E013]0100B90C-     <1>
  1144 00000FCE [BA12]0100DB0C-     <1>
  1144 00000FD4 [B213]0100EE0C-     <1>
  1144 00000FDA [0514]0101F40C-     <1>
  1144 00000FE0 [1614]0000          <1>
  1145                              <1> 
  1146                              <1> 	align 2, db 0
  1147                              <1> internalcodetocoderelocations:
  1148 00000FE4 7000BD0000015401D0- <1> 	dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
  1148 00000FED 01D301D801DB01FC01- <1>
  1148 00000FF6 D208DC08E708EF0840- <1>
  1148 00000FFF 0945094D0952096909- <1>
  1148 00001008 740987098E09AA0CB4- <1>
  1148 00001011 0CD10CD70C0E0D0000  <1>
  1149                              <1> 
  1150                              <1> 	align 2, db 0
  1151                              <1> internalcodetodatarelocations:
  1152 0000101A 3400C100D200F400F9- <1> 	dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
  1152 00001023 00FE00030115013301- <1>
  1152 0000102C 40014D0152016B018D- <1>
  1152 00001035 01CA01DE01E201E601- <1>
  1152 0000103E ED01FA010102040241- <1>
  1152 00001047 02490263026B02AA02- <1>
  1152 00001050 B802C703CF03ED03F5- <1>
  1152 00001059 032B044505B305D605- <1>
  1152 00001062 E7054206A206B606CF- <1>
  1152 0000106B 06EE06FE0608071607- <1>
  1152 00001074 310749075C07A90798- <1>
  1152 0000107D 090000              <1>
  1153                              <1> 
  1154                              <1> 	align 2, db 0
  1155                              <1> internaldatatocoderelocations:
  1156 00001080 000002000400060008- <1> 	dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
  1156 00001089 000A000C000E001000- <1>
  1156 00001092 1200FFFF            <1>
  1157                              <1> 
  1158                              <1> 	align 2, db 0
  1159                              <1> internaldatatodatarelocations:
  1160 00001096 FFFF                <1> 	dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
  1161                              <1> 
  1162                              <1> %if _ELD_LINKER_PASSES
  1163                              <1> 	align 2, db 0
  1164                              <1> linkerlinkerdatarelocations:
  1165 00001098 0100F50A[A713]0100- <1> 	dw LINK_LINKER_DATA_RELOCATIONS, 0
  1165 000010A0 3D0B[1E13]01003E0C- <1>
  1165 000010A8 [CF13]0000          <1>
  1166                              <1> 
  1167                              <1> 	align 2, db 0
  1168                              <1> internallinkercodetocoderelocations:
  1169 000010AC FF0A160B270B4F0B00- <1> 	dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
  1169 000010B5 00                  <1>
  1170                              <1> 
  1171                              <1> 	align 2, db 0
  1172                              <1> internallinkercodetodatarelocations:
  1173 000010B6 0000                <1> 	dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
  1174                              <1> 
  1175                              <1> 	align 2, db 0
  1176                              <1> internallinkerdatatocoderelocations:
  1177 000010B8 FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
  1178                              <1> 
  1179                              <1> 	align 2, db 0
  1180                              <1> internallinkerdatatodatarelocations:
  1181 000010BA FFFF                <1> 	dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
  1182                              <1> %endif
  1183                              <1> 
  1184                              <1> %if ELDOTHER
  1185                              <1> 	align 2, db 0
  1186                              <1> linkerotherdatarelocations:
  1187                              <1> 	dw LINK_OTHER_DATA_RELOCATIONS, 0
  1188                              <1> 
  1189                              <1>  %ifnidn LINK_OTHER_LINKER_DATA_RELOCATIONS, ""
  1190                              <1>   %error Other linker data links not supported
  1191                              <1>  %endif
  1192                              <1> %endif
  1193                              <1> 
  1194                              <1> %if ELDOTHER || ELDHINT
  1195                              <1> 	align 2, db 0
  1196                              <1> debuggeramissig:
  1197 000010BC 65636D20<rep 5h>    <1> 		fill 8, 32, db "ecm"
  1198 000010C4 6C446562756720-     <1> 		fill 8, 32, db "lDebug"
  1198 000010C4 <rep 2h>            <1>
  1199                              <1> %endif
  1200                              <1> 
  1201                              <1> %if ELDOTHER
  1202                              <1> 	align 2, db 0
  1203                              <1> loaderamissig:
  1204                              <1> 		fill 8, 32, db "ecm"
  1205                              <1> 		fill 8, 32, db "Loader"
  1206                              <1> %endif
  1207                              <1> 
  1208                              <1> %ifnidni _LISTING, ""
  1209                              <1> listmsg:
  1210 000010CC 547261634C6973742D- <1> .hint:		db "TracList-add-offset=",_LISTING,"::"
  1210 000010D5 6164642D6F66667365- <1>
  1210 000010DE 743D732E6C73743A3A  <1>
  1211 000010E7 2D2D2D2D680D0A00    <1> .hint.offset:	asciz "----h",13,10
  1212                              <1> %endif
  1213                              <1> 
  1214 000010EF 30CD0C636D64335F6E- <1> 	eldcall_dump_names ELDCALL_CODE_NAMES
  1214 000010F8 6F745F657874100B0B- <1>
  1214 00001101 636F756E745F73746F- <1>
  1214 0000110A 7265CFF10870726570- <1>
  1214 00001113 6861636B7D670C6865- <1>
  1214 0000111C 78776F72645F686967- <1>
  1214 00001125 68348A086865786477- <1>
  1214 0000112E 6F7264A7AA05657272- <1>
  1214 00001137 6F72D55509736B6970- <1>
  1214 00001140 636F6D6D6103C30969- <1>
  1214 00001149 73737472696E673FBA- <1>
  1214 00001152 BD04636D6433DDB906- <1>
  1214 0000115B 63686B656F6C289004- <1>
  1214 00001164 6973706D5512057075- <1>
  1214 0000116D 74737AB21205736574- <1>
  1214 00001176 7263B0960967657472- <1>
  1214 0000117F 616E676558A4550973- <1>
  1214 00001188 6B6970636F6D6D30BF- <1>
  1214 00001191 BC0A736B6970657175- <1>
  1214 0000119A 616C73D9FA08676574- <1>
  1214 000011A3 64776F72646DC90664- <1>
  1214 000011AC 6F6861636B7B140675- <1>
  1214 000011B5 6E6861636B84810768- <1>
  1214 000011BE 6578776F7264398C08- <1>
  1214 000011C7 707574736C696E6563- <1>
  1214 000011D0 770864645F73746F72- <1>
  1214 000011D9 656FA20D707574736C- <1>
  1214 000011E2 696E655F63726C668A- <1>
  1214 000011EB 0A0F746573745F6869- <1>
  1214 000011F4 67685F6C696D697482- <1>
  1214 000011FD 1B0768657862797465- <1>
  1214 00001206 E83A066973656F6C3F- <1>
  1214 0000120F 5AA3126765745F6C65- <1>
  1214 00001218 6E6774685F6B657977- <1>
  1214 00001221 6F7264849013697365- <1>
  1214 0000122A 6F6C3F2E6E6F747365- <1>
  1214 00001233 6D69636F6C6F6E3D82- <1>
  1214 0000123C 07676574627974653F- <1>
  1214 00001245 E807676574776F7264- <1>
  1214 0000124E D0BB1A636F70795F73- <1>
  1214 00001257 696E676C655F636F75- <1>
  1214 00001260 6E7465645F73747269- <1>
  1214 00001269 6E67986906696E7463- <1>
  1214 00001272 686B21300A63616C6C- <1>
  1214 0000127B 5F696E743244B77408- <1>
  1214 00001284 7365746573326478    <1>
  1215 0000128C C30B076C617374636D- <1> 	link_data_dump_names LINK_DATA_NAMES
  1215 00001295 646B5D06646D79636D- <1>
  1215 0000129E 6454400D6D73672E75- <1>
  1215 000012A7 6E696E7374616C6CEB- <1>
  1215 000012B0 420865787464737365- <1>
  1215 000012B9 6CD52D066578747365- <1>
  1215 000012C2 6797B6136578745F63- <1>
  1215 000012CB 6F6D6D616E645F6861- <1>
  1215 000012D4 6E646C6572CA510E69- <1>
  1215 000012DD 6E7465726E616C666C- <1>
  1215 000012E6 616773335B3B067265- <1>
  1215 000012EF 675F64738AF2157373- <1>
  1215 000012F8 735F73696C656E745F- <1>
  1215 00001301 636F756E745F757365- <1>
  1215 0000130A 645235107373735F73- <1>
  1215 00001313 696C656E745F636F75- <1>
  1215 0000131C 6E7484E3086C696E65- <1>
  1215 00001325 5F6F7574A08A0E7365- <1>
  1215 0000132E 617263685F72657375- <1>
  1215 00001337 6C7473D78E15736561- <1>
  1215 00001340 7263685F726573756C- <1>
  1215 00001349 74735F616D6F756E74- <1>
  1215 00001352 55030F6275696C645F- <1>
  1215 0000135B 6F7074696F6E5F504D- <1>
  1215 00001364 BBCC097373636F756E- <1>
  1215 0000136D 7465727DB3076F7074- <1>
  1215 00001376 696F6E73A0390C6C69- <1>
  1215 0000137F 6E655F6F75745F656E- <1>
  1215 00001388 64899F0D696E746572- <1>
  1215 00001391 6E616C666C6167738D- <1>
  1215 0000139A 710B6D73672E696E73- <1>
  1215 000013A3 74616C6C5ABC086F70- <1>
  1215 000013AC 74696F6E7337E7D30B- <1>
  1215 000013B5 6578747365675F7573- <1>
  1215 000013BE 6564B2400C65787464- <1>
  1215 000013C7 6174615F7573656468- <1>
  1215 000013D0 440E6C696E6B63616C- <1>
  1215 000013D9 6C5F7461626C65F09E- <1>
  1215 000013E2 227472795F64656275- <1>
  1215 000013EB 676765725F616D6973- <1>
  1215 000013F4 5F6D756C7469706C65- <1>
  1215 000013FD 785F6E756D626572CB- <1>
  1215 00001406 510E696E7465726E61- <1>
  1215 0000140F 6C666C61677334688C- <1>
  1215 00001418 15616D69735F6D756C- <1>
  1215 00001421 7469706C65785F6E75- <1>
  1215 0000142A 6D626572            <1>
  1216                              <1> %if ELDOTHER
  1217                              <1> 	link_data_dump_names LINK_OTHER_DATA_NAMES
  1218                              <1> %endif
  1219                              <1> 
  1220                              <1> lmsg:
  1221                              <1> %if _ELD_LINKER_PASSES
  1222                              <1> %if _ELDCALL_OPTIONAL
  1223 0000142E 214F7074696F6E616C- <1> .warning_code_optional:		counted "Optional code link missing, hash="
  1223 00001437 20636F6465206C696E- <1>
  1223 00001440 6B206D697373696E67- <1>
  1223 00001449 2C20686173683D      <1>
  1224                              <1> %endif
  1225                              <1> %if _ELDDATA_OPTIONAL
  1226                              <1> .warning_data_optional:		counted "Optional data link missing, hash="
  1227                              <1> %endif
  1228 00001450 1844617461206C696E- <1> .error_data:			counted "Data link missing, hash="
  1228 00001459 6B206D697373696E67- <1>
  1228 00001462 2C20686173683D      <1>
  1229 00001469 18436F6465206C696E- <1> .error_code:			counted "Code link missing, hash="
  1229 00001472 6B206D697373696E67- <1>
  1229 0000147B 2C20686173683D      <1>
  1230 00001482 0A682C206C6162656C- <1> .error.2:			counted "h, label ",'"'
  1230 0000148B 2022                <1>
  1231                              <1> %endif
  1232                              <1> %if ELDOTHER
  1233                              <1> .no_other:		asciz "ELD linker: No other link info found!",13,10
  1234                              <1> .error_other:		asciz "ELD linker: Other link info unknown format!",13,10
  1235                              <1> %endif
  1236                              <1> 
  1237 0000148D 00<rep 3h>          <1> 	align 16, db 0
   777                                  
   778                                  	align 16
   779                                  code_size equ $ - code
