     1                                  
     2                                  ; Public Domain
     3                                  
     4                                  %include "lmacros3.mac"
     1                              <1> [list -]
    14                              <2> [list -]
    14                              <1> [list -]
     5                                  	gendef MAP, ""
     6                                  
     7                                  %ifnidni _MAP, ""
     8                                   [map all _MAP]
     9                                  %endif
    10                                  
    11                                  %assign _COMPRESSLIB 1
    12                                  
    13                                  %include "extlib.asm"
     1                              <1> 
     2                              <1> ; Public Domain
     3                              <1> 
     4                              <1> ; test run command: ; .; .
     5                              <1> 
     6                              <1> %include "lmacros3.mac"
     1                              <2> [list -]
     7                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22 00000000 ????????            <2> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <2> 			resb 3	; reserved
    24 00000007 ??                  <2> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <2> eldhDataOffset:		resd 1
    29 00000014 ????                <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <2> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <2> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50 0000000C ????                <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56 00000000 ????                <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <2> eldltAmount:		resw 1
    62 00000004 ????????            <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69 00000000 ????                <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <2> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76 00000012 <res Eh>            <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84 00000000 ????                <2> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <2> eldlReserved:		resw 2
    86 00000006 ????                <2> eldlUseLinkHash:	resw 1
    87 00000008 ????                <2> eldlDataAmount:		resw 1
    88 0000000A ????                <2> eldlDataPrefixes:	resw 1
    89 0000000C ????                <2> eldlDataEntries:	resw 1
    90 0000000E ????                <2> eldlDataAddresses:	resw 1
    91 00000010 ????                <2> eldlCodeAmount:		resw 1
    92 00000012 ????                <2> eldlCodePrefixes:	resw 1
    93 00000014 ????                <2> eldlCodeEntries:	resw 1
    94 00000016 ????                <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
     8                              <1> %include "eldcall.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug call macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDCALL_MAC
    16                              <2> %define ELDCALL_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> %include "nasmhash.mac"
     1                              <3> 
     2                              <3> %if 0
     3                              <3> 
     4                              <3> Hashing macros
     5                              <3>  by E. C. Masloch, 2019
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef __NASMHASH_MAC__
    16                              <3> %assign __NASMHASH_MAC__ 1
    17                              <3> 
    18                              <3> 
    19                              <3> 	%macro hashdef 2+.nolist
    20                              <3> %ifempty %2
    21                              <3>  %assign _%1 1
    22                              <3> %else
    23                              <3> %ifstr %2
    24                              <3>  %define %%string %2
    25                              <3> %elifid %2
    26                              <3>  %defstr %%string %2
    27                              <3> %elifnum %2
    28                              <3>  %defstr %%string %2
    29                              <3> %eliftok %2
    30                              <3>  %defstr %%string %2
    31                              <3> %else
    32                              <3>  %error Unknown input
    33                              <3> %endif
    34                              <3> %strlen %%length %%string
    35                              <3> %assign %%hash 1
    36                              <3> %assign %%index 1
    37                              <3> %rep %%length
    38                              <3>  %substr %%char %%string %%index
    39                              <3>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <3>  %assign %%index %%index + 1
    41                              <3> %endrep
    42                              <3> %assign _%1 %%hash
    43                              <3> %endif
    44                              <3> 	%endmacro
    45                              <3> 
    46                              <3> 
    47                              <3> %endif
    20                              <2> %include "elddata.mac"
     1                              <3> %if 0
     2                              <3> 
     3                              <3> Extensions for lDebug data relocation macros
     4                              <3> 
     5                              <3> Copyright (C) 2008-2024 E. C. Masloch
     6                              <3> 
     7                              <3> Usage of the works is permitted provided that this
     8                              <3> instrument is retained with the works, so that any entity
     9                              <3> that uses the works is notified of this instrument.
    10                              <3> 
    11                              <3> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <3> 
    13                              <3> %endif
    14                              <3> 
    15                              <3> %ifndef ELDDATA_MAC
    16                              <3> %define ELDDATA_MAC 1
    17                              <3> 
    18                              <3> %include "lmacros3.mac"
     1                              <4> [list -]
    19                              <3> %include "nasmhash.mac"
     1                              <4> 
     2                              <4> %if 0
     3                              <4> 
     4                              <4> Hashing macros
     5                              <4>  by E. C. Masloch, 2019
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef __NASMHASH_MAC__
    16                              <4> %assign __NASMHASH_MAC__ 1
    17                              <4> 
    18                              <4> 
    19                              <4> 	%macro hashdef 2+.nolist
    20                              <4> %ifempty %2
    21                              <4>  %assign _%1 1
    22                              <4> %else
    23                              <4> %ifstr %2
    24                              <4>  %define %%string %2
    25                              <4> %elifid %2
    26                              <4>  %defstr %%string %2
    27                              <4> %elifnum %2
    28                              <4>  %defstr %%string %2
    29                              <4> %eliftok %2
    30                              <4>  %defstr %%string %2
    31                              <4> %else
    32                              <4>  %error Unknown input
    33                              <4> %endif
    34                              <4> %strlen %%length %%string
    35                              <4> %assign %%hash 1
    36                              <4> %assign %%index 1
    37                              <4> %rep %%length
    38                              <4>  %substr %%char %%string %%index
    39                              <4>  %assign %%hash (%%hash * 31 + %%char) & 0FFFFh
    40                              <4>  %assign %%index %%index + 1
    41                              <4> %endrep
    42                              <4> %assign _%1 %%hash
    43                              <4> %endif
    44                              <4> 	%endmacro
    45                              <4> 
    46                              <4> 
    47                              <4> %endif
    20                              <3> %include "eldcheck.mac"
     1                              <4> %if 0
     2                              <4> 
     3                              <4> Extensions for lDebug relocation check macros
     4                              <4> 
     5                              <4> Copyright (C) 2008-2023 E. C. Masloch
     6                              <4> 
     7                              <4> Usage of the works is permitted provided that this
     8                              <4> instrument is retained with the works, so that any entity
     9                              <4> that uses the works is notified of this instrument.
    10                              <4> 
    11                              <4> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <4> 
    13                              <4> %endif
    14                              <4> 
    15                              <4> %ifndef ELDCHECK_MAC
    16                              <4> %define ELDCHECK_MAC 1
    17                              <4> 
    18                              <4> %assign ELDSTRICT 0
    19                              <4> %assign ELDSTRICTCOUNTER 0
    20                              <4> 
    21                              <4> 	%imacro eldstrict 1.nolist
    22                              <4> %ifidni %1, on
    23                              <4>  %assign ELDSTRICT 1
    24                              <4>  [warning +error=reloc-abs]
    25                              <4>  [warning +reloc-abs]
    26                              <4> %elifidni %1, off
    27                              <4>  %assign ELDSTRICT 0
    28                              <4>  [warning -reloc-abs]
    29                              <4> %else
    30                              <4>  %error Unknown keyword
    31                              <4> %endif
    32                              <4> 	%endmacro
    33                              <4> 
    34                              <4> 	%imacro reloc 1+.nolist
    35                              <4> %if ELDSTRICT
    36                              <4>  %if ELDSTRICTCOUNTER
    37                              <4>   %error Missing relocation
    38                              <4>  %endif
    39                              <4>  [warning -reloc-abs]
    40                              <4>  %assign ELDSTRICTCOUNTER 1
    41                              <4> %endif
    42                              <4> %1
    43                              <4> 	%endmacro
    44                              <4> 
    45                              <4> 	%imacro reloc2 1+.nolist
    46                              <4> %if ELDSTRICT
    47                              <4>  %if ELDSTRICTCOUNTER
    48                              <4>   %error Missing relocation
    49                              <4>  %endif
    50                              <4>  [warning -reloc-abs]
    51                              <4>  %assign ELDSTRICTCOUNTER 2
    52                              <4> %endif
    53                              <4> %1
    54                              <4> 	%endmacro
    55                              <4> 
    56                              <4> 	%imacro eldstrictcheck 0.nolist
    57                              <4> %if ELDSTRICT
    58                              <4>  %ifn ELDSTRICTCOUNTER
    59                              <4>   %error Unexpected relocation
    60                              <4>  %else
    61                              <4>   %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
    62                              <4>   %ifn ELDSTRICTCOUNTER
    63                              <4>    [warning +reloc-abs]
    64                              <4>   %endif
    65                              <4>  %endif
    66                              <4> %endif
    67                              <4> 	%endmacro
    68                              <4> 
    69                              <4> %endif
    70                              <4> 
    21                              <3> 
    22                              <3> 
    23                              <3> %assign ELDLINKER 0
    24                              <3> 
    25                              <3> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <3> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <3> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <3> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <3> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <3> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <3> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <3> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <3> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <3> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <3> 
    36                              <3> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <3> %if ELDLINKER
    39                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <3>  %else
    42                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <3>  %endif
    44                              <3> %else
    45                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <3>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <3>  %else
    48                              <3>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <3>  %endif
    50                              <3> %endif
    51                              <3> 	eldstrictcheck
    52                              <3> 	%endmacro
    53                              <3> 
    54                              <3> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <3> %if ELDLINKER
    57                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <3>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <3>  %else
    60                              <3>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <3>  %endif
    62                              <3> %else
    63                              <3>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <3>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <3>  %else
    66                              <3>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <3>  %endif
    68                              <3> %endif
    69                              <3> 	eldstrictcheck
    70                              <3> 	%endmacro
    71                              <3> 
    72                              <3> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <3> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <3> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <3> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <3> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <3> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <3> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <3> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <3> 
    81                              <3> 
    82                              <3> %define LINK_DATA_RELOCATIONS ""
    83                              <3> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <3> %define LINK_DATA_NAMES db ""
    85                              <3> %define LINK_DATA_DETECTION none, none
    86                              <3> 
    87                              <3> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <3> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <3> %define LINK_OTHER_DATA_NAMES db ""
    90                              <3> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <3> 
    92                              <3> %ifndef ELDOTHER
    93                              <3>  %assign ELDOTHER 0
    94                              <3> %endif
    95                              <3> %assign ELDOTHERLINK 0
    96                              <3> 
    97                              <3> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <3> %if ELDOTHER
    99                              <3>  %assign ELDOTHERLINK 1
   100                              <3> %endif
   101                              <3> 	linkdatarelocation %1, %2, %3
   102                              <3> %assign ELDOTHERLINK 0
   103                              <3> 	%endmacro
   104                              <3> 
   105                              <3> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <3> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <3> %ifidni %3, required
   108                              <3>  %assign %%optional 0
   109                              <3> %elifidni %3, optional
   110                              <3>  %assign %%optional 100h
   111                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <3>  %else
   115                              <3>   %error Optional data link not allowed here
   116                              <3>  %endif
   117                              <3> %elifidni %3, PM required
   118                              <3>  %assign %%optional 300h
   119                              <3>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <3>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <3>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <3>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <3>  %else
   124                              <3>   %error Optional data link not allowed here
   125                              <3>  %endif
   126                              <3> %else
   127                              <3>  %fatal Unknown optional keyword
   128                              <3> %endif
   129                              <3> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <3>  %assign %%DATASECTION 1
   131                              <3> %else
   132                              <3>  %assign %%DATASECTION 0
   133                              <3> %endif
   134                              <3> 	%if ELDOTHERLINK
   135                              <3> %if ELDLINKER
   136                              <3>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <3> %else
   138                              <3>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <3> %endif
   140                              <3> 	%else
   141                              <3> %if ELDLINKER
   142                              <3>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <3> %else
   144                              <3>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <3> %endif
   146                              <3> 	%endif
   147                              <3> %defstr %%string %1
   148                              <3> %strlen %%length %%string
   149                              <3> %if %%length > 64
   150                              <3>  %error Too long link name: %1
   151                              <3> %endif
   152                              <3> %define LINK_DATA_CHECK %1
   153                              <3> 	%if ELDOTHERLINK
   154                              <3> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <3> %if LINK_DATA_NEW
   156                              <3>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <3> 	hashdef HASH, %%string
   158                              <3>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <3> %else
   161                              <3>  %%name equ LINK_DATA_DUPLICATE
   162                              <3> %endif
   163                              <3> 	%else
   164                              <3> 	linkdata_detect LINK_DATA_DETECTION
   165                              <3> %if LINK_DATA_NEW
   166                              <3>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <3> 	hashdef HASH, %%string
   168                              <3>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <3> %else
   171                              <3>  %%name equ LINK_DATA_DUPLICATE
   172                              <3> %endif
   173                              <3> 	%endif
   174                              <3> 	eldstrictcheck
   175                              <3> 	%endmacro
   176                              <3> 
   177                              <3> 	%imacro linkdata_detect 2-*.nolist
   178                              <3> %assign LINK_DATA_NEW 1
   179                              <3> %rep (%0 - 2) / 2
   180                              <3>  %rotate 2
   181                              <3>  %ifidni %1, LINK_DATA_CHECK
   182                              <3>   %assign LINK_DATA_NEW 0
   183                              <3>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <3>   %exitrep
   185                              <3>  %endif
   186                              <3> %endrep
   187                              <3> 	%endmacro
   188                              <3> 
   189                              <3> 	%imacro link_data_dump_names 1-*.nolist
   190                              <3> %rep %0
   191                              <3> 	%1
   192                              <3>  %rotate 1
   193                              <3> %endrep
   194                              <3> 	%endmacro
   195                              <3> 
   196                              <3> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <3> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <3> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <3> 
   200                              <3> %endif
    21                              <2> 
    22                              <2> %assign ELDLINKER 0
    23                              <2> 
    24                              <2> [section relocatedzero nobits vstart=0]
    25                              <2> relocatedzero:
    26                              <2> __SECT__
    27                              <2> 
    28                              <2> 	numdef HOUDINI, 1
    29                              <2> 	numdef HOUDINI_CONDITIONAL, 1
    30                              <2> 
    31                              <2> %imacro houdini 0.nolist
    32                              <2> %if _HOUDINI
    33                              <2>  %if _HOUDINI_CONDITIONAL
    34                              <2> reloc	testopt [ss:relocateddata], 100h
    35                              <2> linkdatarelocation options7, -3
    36                              <2> 	jz %%skip
    37                              <2>  %endif
    38                              <2> reloc	testopt [ss:relocateddata], 100h
    39                              <2> linkdatarelocation internalflags6, -3
    40                              <2> 	jz %%skip
    41                              <2> 	int3
    42                              <2> %%skip:
    43                              <2> %endif
    44                              <2> %endmacro
    45                              <2> 
    46                              <2> %define ELDCALL_CODE_RELOCATIONS ""
    47                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS ""
    48                              <2> %define ELDCALL_CODE_RELOCATIONS_OPTIONAL ""
    49                              <2> %define ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ""
    50                              <2> %define ELDCALL_CODE_NAMES db ""
    51                              <2> %define ELDCALL_CODE_DETECTION none, none
    52                              <2> %assign ELDCALL_OPTIONAL_STATUS 0		; not any seen yet
    53                              <2> %assign ELDCALL_PMREQUIRED_STATUS 0		; not any seen yet
    54                              <2> 
    55                              <2> 	%imacro extcall 1-2.nolist required
    56                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
    57                              <2>  %error "ELD call cannot be used in ELD data block"
    58                              <2> %endif
    59                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP
    60                              <2> %ifidni %2, required
    61                              <2>  %assign %%optional 0
    62                              <2> %elifidni %2, optional
    63                              <2>  %assign %%optional 100h
    64                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    65                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    66                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    67                              <2>  %else
    68                              <2>   %error Optional code link not allowed here
    69                              <2>  %endif
    70                              <2> %elifidni %2, PM required
    71                              <2>  %assign %%optional 300h
    72                              <2>  %assign ELDCALL_PMREQUIRED_STATUS 1
    73                              <2>  %if ELDCALL_OPTIONAL_STATUS == 0
    74                              <2>   %assign ELDCALL_OPTIONAL_STATUS 1
    75                              <2>  %elif ELDCALL_OPTIONAL_STATUS == 1
    76                              <2>  %else
    77                              <2>   %error Optional code link not allowed here
    78                              <2>  %endif
    79                              <2> %else
    80                              <2>  %fatal Unknown optional keyword
    81                              <2> %endif
    82                              <2> %if 0
    83                              <2> [warning -reloc-rel-word]
    84                              <2> 	call near relocatedzero
    85                              <2> [warning +reloc-rel-word]
    86                              <2> %else
    87                              <2> 	db 0E8h
    88                              <2> reloc	dw relocatedzero
    89                              <2> 	eldstrictcheck
    90                              <2> %endif
    91                              <2> 	jmp strict short %%skipparameter
    92                              <2> 	dw 0
    93                              <2> %%skipparameter:
    94                              <2> %if ELDLINKER
    95                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS ELDCALL_LINKER_CODE_RELOCATIONS, %%entry, %%name
    96                              <2>  %xdefine ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
    97                              <2> %else
    98                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS ELDCALL_CODE_RELOCATIONS, %%entry, %%name
    99                              <2>  %xdefine ELDCALL_CODE_RELOCATIONS_OPTIONAL ELDCALL_CODE_RELOCATIONS_OPTIONAL, 1 + %%optional, %%entry, %%name
   100                              <2> %endif
   101                              <2> %defstr %%string %1
   102                              <2> %strlen %%length %%string
   103                              <2> %if %%length > 64
   104                              <2>  %error Too long link name: %1
   105                              <2> %endif
   106                              <2> %define ELDCALL_CODE_CHECK %1
   107                              <2> 	linkcode_detect ELDCALL_CODE_DETECTION
   108                              <2> %if ELDCALL_CODE_NEW
   109                              <2>  %xdefine ELDCALL_CODE_DETECTION ELDCALL_CODE_DETECTION, %1, %%name
   110                              <2> 	hashdef HASH, %%string
   111                              <2> %xdefine ELDCALL_CODE_NAMES 	ELDCALL_CODE_NAMES, %%name:, dw _HASH, {counted %%string}
   113                              <2> %else
   114                              <2>  %%name equ ELDCALL_CODE_DUPLICATE
   115                              <2> %endif
   116                              <2> 	%endmacro
   117                              <2> 
   118                              <2> 	%imacro linkcode_detect 2-*.nolist
   119                              <2> %assign ELDCALL_CODE_NEW 1
   120                              <2> %rep (%0 - 2) / 2
   121                              <2>  %rotate 2
   122                              <2>  %ifidni %1, ELDCALL_CODE_CHECK
   123                              <2>   %assign ELDCALL_CODE_NEW 0
   124                              <2>   %xdefine ELDCALL_CODE_DUPLICATE %2
   125                              <2>   %exitrep
   126                              <2>  %endif
   127                              <2> %endrep
   128                              <2> 	%endmacro
   129                              <2> 
   130                              <2> 
   131                              <2> %define ELDCALL_CALLCALL_LIST none
   132                              <2> 
   133                              <2> 	%imacro extcallcall 1.nolist
   134                              <2> 	call %1
   135                              <2> %xdefine ELDCALL_CALLCALL_LIST ELDCALL_CALLCALL_LIST, %1
   136                              <2> 	%endmacro
   137                              <2> 
   138                              <2> %assign ELDCALLCALL_DUMPED 0
   139                              <2> 
   140                              <2> 	%imacro eldcall_dump_callcall 1-*.nolist
   141                              <2> %define ELDCALL_CALLCALL_PROCESSED none
   142                              <2>  %rep %0 - 1
   143                              <2>   %rotate 1
   144                              <2>   %define ELDCALL_CHECK %1
   145                              <2> 	eldcall_callcall_detect ELDCALL_CALLCALL_PROCESSED
   146                              <2>   %if ELDCALL_NEW
   147                              <2>    %xdefine ELDCALL_CALLCALL_PROCESSED ELDCALL_CALLCALL_PROCESSED, %1
   148                              <2> 	align 8, nop
   149                              <2> %1:
   150                              <2> 	extcall %1
   151                              <2> 	retn
   152                              <2>   %endif
   153                              <2>  %endrep
   154                              <2> %unimacro extcallcall 1.nolist
   155                              <2> %assign ELDCALLCALL_DUMPED 1
   156                              <2> %define ELDCALL_CALLCALL_LIST none
   157                              <2> 	%endmacro
   158                              <2> 
   159                              <2> 	%imacro eldcall_callcall_detect 1-*.nolist
   160                              <2> %assign ELDCALL_NEW 1
   161                              <2> %rep %0 - 1
   162                              <2>  %rotate 1
   163                              <2>  %ifidni %1, ELDCALL_CHECK
   164                              <2>   %assign ELDCALL_NEW 0
   165                              <2>   %exitrep
   166                              <2>  %endif
   167                              <2> %endrep
   168                              <2> 	%endmacro
   169                              <2> 
   170                              <2> 	%imacro eldcall_dump_names 1-*.nolist
   171                              <2> %rep %0
   172                              <2> 	%1
   173                              <2>  %rotate 1
   174                              <2> %endrep
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> ; eldcall_dump_callcall ELDCALL_CALLCALL_LIST
   178                              <2> ; if using optional code links:
   179                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS_OPTIONAL, 0
   180                              <2> ;  dw ELDCALL_CODE_RELOCATIONS_OPTIONAL, 0
   181                              <2> ; if not using optional code links:
   182                              <2> ;  dw ELDCALL_LINKER_CODE_RELOCATIONS, 0, 0
   183                              <2> ;  dw ELDCALL_CODE_RELOCATIONS, 0, 0
   184                              <2> ; eldcall_dump_names ELDCALL_CODE_NAMES
   185                              <2> 
   186                              <2> %endif
     9                              <1> %include "elddata.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug data relocation macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2024 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELDDATA_MAC
    16                              <2> %define ELDDATA_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
    19                              <2> %include "nasmhash.mac"
    20                              <2> %include "eldcheck.mac"
    21                              <2> 
    22                              <2> 
    23                              <2> %assign ELDLINKER 0
    24                              <2> 
    25                              <2> %define INTERNAL_CODE_TO_CODE_RELOCATIONS ""
    26                              <2> %define INTERNAL_CODE_TO_DATA_RELOCATIONS ""
    27                              <2> %define INTERNAL_DATA_TO_CODE_RELOCATIONS ""
    28                              <2> %define INTERNAL_DATA_TO_DATA_RELOCATIONS ""
    29                              <2> %define INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS ""
    30                              <2> %define INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS ""
    31                              <2> %define INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS ""
    32                              <2> %define INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS ""
    33                              <2> %assign ELDDATA_OPTIONAL_STATUS 0		; not any seen yet
    34                              <2> %assign ELDDATA_PMREQUIRED_STATUS 0		; not any seen yet
    35                              <2> 
    36                              <2> 	%imacro internalcoderelocation 0-1.nolist -2
    37                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    38                              <2> %if ELDLINKER
    39                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    40                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, %%entry
    41                              <2>  %else
    42                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, %%entry
    43                              <2>  %endif
    44                              <2> %else
    45                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    46                              <2>   %xdefine INTERNAL_DATA_TO_CODE_RELOCATIONS INTERNAL_DATA_TO_CODE_RELOCATIONS, %%entry
    47                              <2>  %else
    48                              <2>   %xdefine INTERNAL_CODE_TO_CODE_RELOCATIONS INTERNAL_CODE_TO_CODE_RELOCATIONS, %%entry
    49                              <2>  %endif
    50                              <2> %endif
    51                              <2> 	eldstrictcheck
    52                              <2> 	%endmacro
    53                              <2> 
    54                              <2> 	%imacro internaldatarelocation 0-1.nolist -2
    55                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %1
    56                              <2> %if ELDLINKER
    57                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    58                              <2>   %xdefine INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, %%entry
    59                              <2>  %else
    60                              <2>   %xdefine INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, %%entry
    61                              <2>  %endif
    62                              <2> %else
    63                              <2>  %ifidni _CURRENT_SECTION_TYPE, DATA
    64                              <2>   %xdefine INTERNAL_DATA_TO_DATA_RELOCATIONS INTERNAL_DATA_TO_DATA_RELOCATIONS, %%entry
    65                              <2>  %else
    66                              <2>   %xdefine INTERNAL_CODE_TO_DATA_RELOCATIONS INTERNAL_CODE_TO_DATA_RELOCATIONS, %%entry
    67                              <2>  %endif
    68                              <2> %endif
    69                              <2> 	eldstrictcheck
    70                              <2> 	%endmacro
    71                              <2> 
    72                              <2> ; dw INTERNAL_LINKER_CODE_TO_CODE_RELOCATIONS, 0
    73                              <2> ; dw INTERNAL_LINKER_CODE_TO_DATA_RELOCATIONS, 0
    74                              <2> ; dw INTERNAL_LINKER_DATA_TO_CODE_RELOCATIONS, -1
    75                              <2> ; dw INTERNAL_LINKER_DATA_TO_DATA_RELOCATIONS, -1
    76                              <2> ; dw INTERNAL_CODE_TO_CODE_RELOCATIONS, 0
    77                              <2> ; dw INTERNAL_CODE_TO_DATA_RELOCATIONS, 0
    78                              <2> ; dw INTERNAL_DATA_TO_CODE_RELOCATIONS, -1
    79                              <2> ; dw INTERNAL_DATA_TO_DATA_RELOCATIONS, -1
    80                              <2> 
    81                              <2> 
    82                              <2> %define LINK_DATA_RELOCATIONS ""
    83                              <2> %define LINK_LINKER_DATA_RELOCATIONS ""
    84                              <2> %define LINK_DATA_NAMES db ""
    85                              <2> %define LINK_DATA_DETECTION none, none
    86                              <2> 
    87                              <2> %define LINK_OTHER_DATA_RELOCATIONS ""
    88                              <2> %define LINK_OTHER_LINKER_DATA_RELOCATIONS ""
    89                              <2> %define LINK_OTHER_DATA_NAMES db ""
    90                              <2> %define LINK_OTHER_DATA_DETECTION none, none
    91                              <2> 
    92                              <2> %ifndef ELDOTHER
    93                              <2>  %assign ELDOTHER 0
    94                              <2> %endif
    95                              <2> %assign ELDOTHERLINK 0
    96                              <2> 
    97                              <2> 	%imacro otherlinkdatarelocation 1-3.nolist -2, required
    98                              <2> %if ELDOTHER
    99                              <2>  %assign ELDOTHERLINK 1
   100                              <2> %endif
   101                              <2> 	linkdatarelocation %1, %2, %3
   102                              <2> %assign ELDOTHERLINK 0
   103                              <2> 	%endmacro
   104                              <2> 
   105                              <2> 	%imacro linkdatarelocation 1-3.nolist -2, required
   106                              <2> %assign %%entry $ + _CURRENT_SECTION %+ FIXUP + %2
   107                              <2> %ifidni %3, required
   108                              <2>  %assign %%optional 0
   109                              <2> %elifidni %3, optional
   110                              <2>  %assign %%optional 100h
   111                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   112                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   113                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   114                              <2>  %else
   115                              <2>   %error Optional data link not allowed here
   116                              <2>  %endif
   117                              <2> %elifidni %3, PM required
   118                              <2>  %assign %%optional 300h
   119                              <2>  %assign ELDDATA_PMREQUIRED_STATUS 1
   120                              <2>  %if ELDDATA_OPTIONAL_STATUS == 0
   121                              <2>   %assign ELDDATA_OPTIONAL_STATUS 1
   122                              <2>  %elif ELDDATA_OPTIONAL_STATUS == 1
   123                              <2>  %else
   124                              <2>   %error Optional data link not allowed here
   125                              <2>  %endif
   126                              <2> %else
   127                              <2>  %fatal Unknown optional keyword
   128                              <2> %endif
   129                              <2> %ifidni _CURRENT_SECTION_TYPE, DATA
   130                              <2>  %assign %%DATASECTION 1
   131                              <2> %else
   132                              <2>  %assign %%DATASECTION 0
   133                              <2> %endif
   134                              <2> 	%if ELDOTHERLINK
   135                              <2> %if ELDLINKER
   136                              <2>  %xdefine LINK_OTHER_LINKER_DATA_RELOCATIONS LINK_OTHER_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   137                              <2> %else
   138                              <2>  %xdefine LINK_OTHER_DATA_RELOCATIONS LINK_OTHER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   139                              <2> %endif
   140                              <2> 	%else
   141                              <2> %if ELDLINKER
   142                              <2>  %xdefine LINK_LINKER_DATA_RELOCATIONS LINK_LINKER_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   143                              <2> %else
   144                              <2>  %xdefine LINK_DATA_RELOCATIONS LINK_DATA_RELOCATIONS, 1 + %%DATASECTION + %%optional, %%entry, %%name
   145                              <2> %endif
   146                              <2> 	%endif
   147                              <2> %defstr %%string %1
   148                              <2> %strlen %%length %%string
   149                              <2> %if %%length > 64
   150                              <2>  %error Too long link name: %1
   151                              <2> %endif
   152                              <2> %define LINK_DATA_CHECK %1
   153                              <2> 	%if ELDOTHERLINK
   154                              <2> 	linkdata_detect LINK_OTHER_DATA_DETECTION
   155                              <2> %if LINK_DATA_NEW
   156                              <2>  %xdefine LINK_OTHER_DATA_DETECTION LINK_OTHER_DATA_DETECTION, %1, %%name
   157                              <2> 	hashdef HASH, %%string
   158                              <2>  %xdefine LINK_OTHER_DATA_NAMES 	LINK_OTHER_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   160                              <2> %else
   161                              <2>  %%name equ LINK_DATA_DUPLICATE
   162                              <2> %endif
   163                              <2> 	%else
   164                              <2> 	linkdata_detect LINK_DATA_DETECTION
   165                              <2> %if LINK_DATA_NEW
   166                              <2>  %xdefine LINK_DATA_DETECTION LINK_DATA_DETECTION, %1, %%name
   167                              <2> 	hashdef HASH, %%string
   168                              <2>  %xdefine LINK_DATA_NAMES 	LINK_DATA_NAMES, %%name:, dw _HASH, {counted %%string}
   170                              <2> %else
   171                              <2>  %%name equ LINK_DATA_DUPLICATE
   172                              <2> %endif
   173                              <2> 	%endif
   174                              <2> 	eldstrictcheck
   175                              <2> 	%endmacro
   176                              <2> 
   177                              <2> 	%imacro linkdata_detect 2-*.nolist
   178                              <2> %assign LINK_DATA_NEW 1
   179                              <2> %rep (%0 - 2) / 2
   180                              <2>  %rotate 2
   181                              <2>  %ifidni %1, LINK_DATA_CHECK
   182                              <2>   %assign LINK_DATA_NEW 0
   183                              <2>   %xdefine LINK_DATA_DUPLICATE %2
   184                              <2>   %exitrep
   185                              <2>  %endif
   186                              <2> %endrep
   187                              <2> 	%endmacro
   188                              <2> 
   189                              <2> 	%imacro link_data_dump_names 1-*.nolist
   190                              <2> %rep %0
   191                              <2> 	%1
   192                              <2>  %rotate 1
   193                              <2> %endrep
   194                              <2> 	%endmacro
   195                              <2> 
   196                              <2> ; dw LINK_LINKER_DATA_RELOCATIONS, 0, 0
   197                              <2> ; dw LINK_DATA_RELOCATIONS, 0, 0
   198                              <2> ; link_data_dump_names ELDCALL_CODE_NAMES
   199                              <2> 
   200                              <2> %endif
    10                              <1> 
    11                              <1> 	numdef COMPRESSED, 0
    12                              <1> 	numdef COMPRESSLIB, 0
    13                              <1> %assign _ELDCOMPRESSED _COMPRESSED
    14                              <1> 	numdef ALIGNPAGE, 1
    15                              <1> 	excdef !_COMPRESSED, ALIGNPAGE
    16                              <1> 	numdef DATABUFFER, 1
    17                              <1> 	numdef ELD_TEST_LIB, 0
    18                              <1>  	numdef ELD_ZERO_OFFSETS, 1
    19                              <1> 
    20                              <1> %assign _DEBUG 1
    21                              <1> %assign _CATCHINT0C 0
    22                              <1> %assign _CATCHINT0D 0
    23                              <1> %assign _CATCHINTFAULTCOND 0
    24                              <1> %assign _DEBUG_COND 1
    25                              <1> %assign _DELAY_BEFORE_BP 0
    26                              <1> %assign _DHIGHLIGHT 0
    27                              <1> %assign _GETLINEHIGHLIGHT 0
    28                              <1> %assign _IMMASM 0
    29                              <1> %assign _INPUT_FILE_BOOT 0
    30                              <1> %assign _INPUT_FILE_HANDLES 0
    31                              <1> %assign _MS_0RANGE_COMPAT 0
    32                              <1> %assign _PM 0
    33                              <1> %assign _RH 0
    34                              <1> %assign _SYMBOLIC 0
    35                              <1> %assign _VXCHG 0
    36                              <1> %include "options.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug options and internal flags
     5                              <2> 
     6                              <2> Copyright (C) 2008-2023 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <2> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <2> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <2> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <2> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <2> 	; This option was never used anywhere:
    23                              <2> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <2> 				; paged output is by default on if the output device is StdOut, else off
    25                              <2> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <2> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <2> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <2> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <2> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <2> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <2> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <2> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <2> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <2> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <2> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <2> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <2> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <2> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <2> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <2> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <2> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <2> ss_no_dump:		equ 80_0000h
    43                              <2> %if _SYMBOLIC
    44                              <2> dd_no_blanks_sym:	equ 100_0000h
    45                              <2> zz_no_pm_xms:		equ 200_0000h
    46                              <2> %endif
    47                              <2> rr_disasm_no_rept:	equ 1000_0000h
    48                              <2> rr_disasm_no_show:	equ 2000_0000h
    49                              <2> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <2> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <2> %if _SYMBOLIC
    52                              <2> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <2> %else
    54                              <2> DEFAULTOPTIONS	equ 0
    55                              <2> %endif
    56                              <2> 
    57                              <2> 
    58                              <2> opt2_db_header:		equ 1
    59                              <2> opt2_db_trailer:	equ 2
    60                              <2> opt2_dw_header:		equ 10h
    61                              <2> opt2_dw_trailer:	equ 20h
    62                              <2> opt2_dd_header:		equ 100h
    63                              <2> opt2_dd_trailer:	equ 200h
    64                              <2> opt2_getinput_dpmi:	equ 800h
    65                              <2> opt2_hh_compat:		equ 1000h
    66                              <2> opt2_getc_idle:		equ 2000h
    67                              <2> opt2_getc_idle_dpmi:	equ 4000h
    68                              <2> opt2_re_cancel_tpg:	equ 8000h
    69                              <2> opt2_nn_compat:		equ 1_0000h
    70                              <2> opt2_nn_capitalise:	equ 2_0000h
    71                              <2> %if _MS_0RANGE_COMPAT
    72                              <2> opt2_0range_compat:	equ 4_0000h
    73                              <2> %endif
    74                              <2> opt2_rr16_compat:	equ 8_0000h
    75                              <2> opt2_r_prompt_compat:	equ 10_0000h
    76                              <2> opt2_r_separate:	equ 20_0000h
    77                              <2> opt2_r_linebreak_always:equ 40_0000h
    78                              <2> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <2> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <2> 
    81                              <2> 
    82                              <2> opt3_tt_no_paging:	equ 1
    83                              <2> opt3_tp_no_paging:	equ 2
    84                              <2> opt3_pp_no_paging:	equ 4
    85                              <2> opt3_gg_no_paging:	equ 8
    86                              <2> opt3_silence_paging_set:equ 100h
    87                              <2> opt3_silence_paging_on:	equ 200h
    88                              <2> opt3_paging_rc:		equ 1000h
    89                              <2> opt3_paging_yy:		equ 2000h
    90                              <2> opt3_paging_re:		equ 4000h
    91                              <2> opt3_r_highlight_diff:	equ 10000h
    92                              <2> opt3_r_highlight_dumb:	equ 20000h
    93                              <2> opt3_r_highlight_full:	equ 40000h
    94                              <2> opt3_r_highlight_eip:	equ 80000h
    95                              <2> %if _PM
    96                              <2> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <2>  %if _BREAK_INSTALLDPMI
    98                              <2> opt3_break_installdpmi:	equ   20_0000h
    99                              <2>  %endif
   100                              <2> %endif
   101                              <2> %if _DHIGHLIGHT
   102                              <2> opt3_d_highlight:	equ   80_0000h
   103                              <2> %endif
   104                              <2> %if _GETLINEHIGHLIGHT
   105                              <2> opt3_getline_highlight:	equ  100_0000h
   106                              <2> %endif
   107                              <2> opt3_no_idle_2F:	equ  200_0000h
   108                              <2> %if _DELAY_BEFORE_BP
   109                              <2> opt3_delay_before_bp:	equ  400_0000h
   110                              <2> %endif
   111                              <2> opt3_no_call_amis:	equ  800_0000h
   112                              <2> opt3_disable_autorepeat:equ 1000_0000h
   113                              <2> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <2> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <2> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <2> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <2> 
   120                              <2> 
   121                              <2> opt4_int_2F_hook:	equ 2
   122                              <2> opt4_int_08_hook:	equ 4
   123                              <2> opt4_int_2D_hook:	equ 8
   124                              <2> %if _CATCHINTFAULTCOND
   125                              <2> opt4_int_fault_hook:	equ 10h
   126                              <2> %endif
   127                              <2> opt4_int_serial_force:	equ 1_0000h
   128                              <2> opt4_int_2F_force:	equ 2_0000h
   129                              <2> opt4_int_08_force:	equ 4_0000h
   130                              <2> opt4_int_2D_force:	equ 8_0000h
   131                              <2> %if _CATCHINT0D
   132                              <2> opt4_int_0D_force:	equ   10_0000h
   133                              <2> %endif
   134                              <2> %if _CATCHINT0C
   135                              <2> opt4_int_0C_force:	equ   20_0000h
   136                              <2> %endif
   137                              <2> opt4_int_00_force:	equ  100_0000h
   138                              <2> opt4_int_01_force:	equ  200_0000h
   139                              <2> opt4_int_03_force:	equ  400_0000h
   140                              <2> opt4_int_06_force:	equ  800_0000h
   141                              <2> opt4_int_18_force:	equ 1000_0000h
   142                              <2> opt4_int_19_force:	equ 2000_0000h
   143                              <2> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <2> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <2> opt4_int_07_force:	equ 8000_0000h
   146                              <2> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <2> 
   148                              <2> 
   149                              <2> %if _VXCHG
   150                              <2> opt6_vv_mode:		equ 1
   151                              <2> opt6_vv_keep:		equ 2
   152                              <2> opt6_vv_int16:		equ 10h
   153                              <2>  %if _VXCHG_DEFAULT_ON
   154                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <2>  %else
   156                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <2>  %endif
   158                              <2> %else
   159                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <2> %endif
   161                              <2> %if _DEBUG
   162                              <2> opt6_debug_exception_late:	equ  20h
   163                              <2> opt6_debug_exception_early:	equ  40h
   164                              <2>  %if _DEBUG_COND
   165                              <2> opt6_debug_exception:	equ  80h
   166                              <2> opt6_debug_mode:	equ 100h
   167                              <2>  %endif
   168                              <2> %endif
   169                              <2> opt6_bios_output:	equ 200h
   170                              <2> opt6_flat_binary:	equ 400h
   171                              <2> opt6_big_stack:		equ 800h
   172                              <2> opt6_40_columns:	equ 1000h
   173                              <2> opt6_40_indent_odd:	equ 2000h
   174                              <2> opt6_40_dash:		equ 4000h
   175                              <2> opt6_share_serial_irq:	equ 1_0000h
   176                              <2> opt6_serial_EOI_call:	equ 2_0000h
   177                              <2> %if _RH
   178                              <2> opt6_rh_mode:		equ 10_0000h
   179                              <2> %endif
   180                              <2> %if _DEBUG
   181                              <2> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <2>  %if _DEBUG_COND
   183                              <2> opt6_debug_putrunint:		equ  80_0000h
   184                              <2>  %endif
   185                              <2> %endif
   186                              <2> opt6_bios_io:		equ 100_0000h
   187                              <2> opt6_immasm_display_uu:	equ 200_0000h
   188                              <2> opt6_immasm_debug:	equ 400_0000h
   189                              <2> opt6_immasm_flag:	equ 800_0000h
   190                              <2> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <2> opt6_r_flags_style2:	equ 2000_0000h
   192                              <2> opt6_r_flags_style3:	equ 4000_0000h
   193                              <2> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <2> 
   195                              <2> 
   196                              <2> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <2> opt7_no_free_oneshot_eld:	equ 1
   198                              <2> opt7_debug_optional_link:	equ 2
   199                              <2> opt7_quiet_install:		equ 4
   200                              <2> opt7_quick_run:			equ 8
   201                              <2> opt7_houdini:			equ 100h
   202                              <2> opt7_no_ensure:			equ 1000h
   203                              <2> opt7_no_tsr_ll:			equ 2000h
   204                              <2> 
   205                              <2> 
   206                              <2> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   207                              <2> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   208                              <2> ntpacket	equ	  4	; VDD registered and usable (L, W)
   209                              <2> pagedcommand	equ	  8	; allows paging in puts
   210                              <2> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   211                              <2> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   212                              <2> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   213                              <2> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   214                              <2> hooked2F	equ	 100h	; Int2F hooked
   215                              <2> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   216                              <2> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   217                              <2> protectedmode	equ	 800h	; in (DPMI) protected mode
   218                              <2> debuggeeA20	equ	1000h	; state of debuggee's A20
   219                              <2> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   220                              <2> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   221                              <2> has386		equ	8000h	; CPU is a 386
   222                              <2> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   223                              <2> runningnt	equ    2_0000h	; running in NTVDM
   224                              <2> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   225                              <2> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   226                              <2> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   227                              <2> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   228                              <2> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   229                              <2> attachedterm	equ   80_0000h	; the attached process terminated
   230                              <2> runningdosemu	equ  100_0000h	; running in dosemu
   231                              <2> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   232                              <2> tt_while:	equ  400_0000h	; tt: while condition specified
   233                              <2> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   234                              <2> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   235                              <2> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   236                              <2> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   237                              <2> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   238                              <2> 
   239                              <2> 
   240                              <2> dif2_gg_is_first:	equ   1
   241                              <2> dif2_gg_skip_non_cseip:	equ   2
   242                              <2> dif2_gg_skip_cseip:	equ   4
   243                              <2> dif2_gg_is_gg:		equ   8
   244                              <2> dif2_gg_first_detected:	equ  10h
   245                              <2> dif2_gg_again:		equ  20h
   246                              <2> dif2_tpg_proceed_bp_set:equ  40h
   247                              <2> dif2_tpg_keep_proceed_bp: equ 80h
   248                              <2> dif2_tpg_have_bp:	equ 100h
   249                              <2> dif2_tpg_adjusted_cseip:equ 200h
   250                              <2> dif2_tpg_do_not_adjust:	equ 400h
   251                              <2> dif2_bp_failure:	equ 800h
   252                              <2> dif2_is_pp:		equ 1000h
   253                              <2> %if _SYMBOLIC
   254                              <2> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   255                              <2> dif2_sym_req_xms:	equ 2000h
   256                              <2> dif2_sym_req_86mm:	equ 4000h
   257                              <2> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   258                              <2> dif2_no_pm_xms:		equ 1_0000h
   259                              <2> dif2_xms_detection_done:equ 2_0000h
   260                              <2> %endif
   261                              <2> %if _INPUT_FILE_HANDLES
   262                              <2> dif2_input_file:	equ 10_0000h
   263                              <2> dif2_closed_input_file:	equ 20_0000h
   264                              <2> %endif
   265                              <2> dif2_did_getline_file:	equ 40_0000h
   266                              <2> %if _SYMBOLIC
   267                              <2> dif2_poison:		equ 80_0000h
   268                              <2> %endif
   269                              <2> dif2_boot_loaded_kernel:equ 100_0000h
   270                              <2> %if _INPUT_FILE_BOOT
   271                              <2> dif2_input_file_boot:	equ 200_0000h
   272                              <2> dif2_closed_input_file_boot:	equ 400_0000h
   273                              <2> %endif
   274                              <2> dif2_in_silence_dump:	equ 1000_0000h
   275                              <2> dif2_int31_segment:	equ 2000_0000h
   276                              <2> dif2_nn_compat:		equ 4000_0000h
   277                              <2> dif2_nn_capitalise:	equ 8000_0000h
   278                              <2> 
   279                              <2> 
   280                              <2> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   281                              <2> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   282                              <2> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   283                              <2> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   286                              <2> dif3_load_dir_dir:	equ 8
   287                              <2> dif3_input_terminal_override:	equ 10h
   288                              <2> dif3_input_serial_override:	equ 20h
   289                              <2> dif3_if_not:		equ 40h
   290                              <2> dif3_partition_changed:	equ 80h
   291                              <2> ;
   292                              <2> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   293                              <2> dif3_input_cmdline_closed: equ 200h
   294                              <2> dif3_at_line_end:	equ 400h
   295                              <2> dif3_quiet_input_single:equ 800h
   296                              <2> dif3_quiet_output:	equ 1000h
   297                              <2> dif3_unquiet_error:	equ 2000h
   298                              <2> dif3_unquiet_prompt:	equ 4000h
   299                              <2> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   300                              <2> dif3_return_eof:	equ 8000h
   301                              <2> dif3_highlighting:	equ 1_0000h
   302                              <2> dif3_do_not_highlight:	equ 2_0000h
   303                              <2> dif3_int10_highlight:	equ 2_0000h
   304                              <2> dif3_nosymbols_1:	equ 4_0000h
   305                              <2> dif3_nosymbols_2:	equ 8_0000h
   306                              <2> %if _PM
   307                              <2> dif3_ss_b_bit_set:	equ  10_0000h
   308                              <2> %endif
   309                              <2> dif3_gotint19:		equ  20_0000h
   310                              <2> dif3_prior_pm:		equ  40_0000h
   311                              <2> %if _DELAY_BEFORE_BP
   312                              <2> dif3_delayed		equ  80_0000h
   313                              <2> %endif
   314                              <2> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   315                              <2> dif3_input_re_closed:	equ 200_0000h
   316                              <2> dif3_accept_getrange_0:	equ 400_0000h
   317                              <2> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   318                              <2> dif3_in_if:		equ 800_0000h
   319                              <2> %endif
   320                              <2> dif3_auxbuff_guarded_1:	equ 1000_0000h
   321                              <2> dif3_auxbuff_guarded_2:	equ 2000_0000h
   322                              <2> dif3_auxbuff_guarded_3:	equ 4000_0000h
   323                              <2> dif3_sss_is_reverse:	equ 8000_0000h
   324                              <2> 
   325                              <2> 
   326                              <2> dif4_int_serial_hooked:	equ 1
   327                              <2> dif4_int_2F_hooked:	equ 2
   328                              <2> dif4_int_08_hooked:	equ 4
   329                              <2> dif4_int_2D_hooked:	equ 8
   330                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0D
   331                              <2> dif4_int_0D_hooked:	equ 10h
   332                              <2> %endif
   333                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0C
   334                              <2> dif4_int_0C_hooked:	equ 20h
   335                              <2> %endif
   336                              <2> 
   337                              <2> 
   338                              <2> %if _VXCHG
   339                              <2> dif6_vv_mode:		equ 1
   340                              <2> %endif
   341                              <2> dif6_in_hook2F:		equ 2
   342                              <2> dif6_in_amis_hook2F:	equ 4
   343                              <2> dif6_debug_mode:	equ 100h
   344                              <2> dif6_locked:		equ 200h
   345                              <2> %if _RH
   346                              <2> dif6_rh_mode_was:	equ  8_0000h
   347                              <2> dif6_rh_mode:		equ 10_0000h
   348                              <2> dif6_rh_mode_2:		equ 20_0000h
   349                              <2> %endif
   350                              <2> dif6_device_mode:	equ 40_0000h
   351                              <2> dif6_cpdepchars:	equ 80_0000h
   352                              <2> %if _IMMASM
   353                              <2> dif6_immasm_no_output:	equ 100_0000h
   354                              <2> dif6_immasm:		equ 200_0000h
   355                              <2> dif6_immasm_rel8:	equ 400_0000h
   356                              <2> %endif
   357                              <2> 
   358                              <2> 
   359                              <2> disasm_lowercase	equ 1
   360                              <2> disasm_commablank	equ 2
   361                              <2> disasm_nasm		equ 4
   362                              <2> disasm_lowercase_refmem:equ 8
   363                              <2> disasm_show_short:	equ 10h
   364                              <2> disasm_show_near:	equ 20h
   365                              <2> disasm_show_far:	equ 40h
   366                              <2> disasm_nec:		equ 80h
   367                              <2> disasm_40_columns:	equ 100h
   368                              <2> disasm_no_indent:	equ 200h
   369                              <2> disasm_msdebug_mnemonofs: equ 400h
   370                              <2> disasm_a16_memref:	equ 1000h
   371                              <2> disasm_a32_memref:	equ 2000h
   372                              <2> disasm_a16_string:	equ 4000h
   373                              <2> disasm_a32_string:	equ 8000h
   374                              <2> disasm_hide_modrm:	equ 10000h
   375                              <2> disasm_asize_loop_nasm:	equ 20000h
   376                              <2> disasm_modrm_always:	equ 40000h
   377                              <2> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
    37                              <1> 
    38                              <1> %include "iniload.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug iniload/boot interfacing structs and macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2023 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> 
    16                              <2> 	struc BS
    17 00000000 ??????              <2> bsJump:	resb 3
    18 00000003 ????????????????    <2> bsOEM:	resb 8
    19                              <2> bsBPB:
    20                              <2> 	endstruc
    21                              <2> 
    22                              <2> 	struc EBPB		;        BPB sec
    23 00000000 ????                <2> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <2> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <2> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <2> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <2> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <2> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <2> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <2> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <2> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <2> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <2> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <2> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <2> bpbNew:				; offset 19h 24h
    36                              <2> 
    37 00000019 ????????            <2> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <2> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <2> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <2> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <2> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <2> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <2> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <2> ebpbNew:			; offset 35h 40h
    45                              <2> 	endstruc
    46                              <2> 
    47                              <2> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <2> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <2> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <2> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <2> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <2> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <2> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <2> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <2> 
    56                              <2> 	struc DIRENTRY
    57 00000000 ????????????????    <2> deName:		resb 8
    58 00000008 ??????              <2> deExt:		resb 3
    59 0000000B ??                  <2> deAttrib:	resb 1
    60 0000000C ??                  <2> dePlusSize:	resb 1
    61 0000000D ??????????????      <2> 		resb 7
    62 00000014 ????                <2> deClusterHigh:	resw 1
    63 00000016 ????                <2> deTime:		resw 1
    64 00000018 ????                <2> deDate:		resw 1
    65 0000001A ????                <2> deClusterLow:	resw 1
    66 0000001C ????????            <2> deSize:		resd 1
    67                              <2> 	endstruc
    68                              <2> 
    69                              <2> ATTR_READONLY	equ 1
    70                              <2> ATTR_HIDDEN	equ 2
    71                              <2> ATTR_SYSTEM	equ 4
    72                              <2> ATTR_VOLLABEL	equ 8
    73                              <2> ATTR_DIRECTORY	equ 10h
    74                              <2> ATTR_ARCHIVE	equ 20h
    75                              <2> 
    76                              <2> lsvclSignature		equ "CL"
    77                              <2> lsvclBufferLength	equ 256
    78                              <2> 
    79                              <2> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <2> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <2> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <2> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <2> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <2> lsvDataStart:		resd 1
    85                              <2> 	endstruc
    86                              <2> 
    87                              <2> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <2> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <2> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <2> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <2> ldFATType:	resb 1
    92                              <2> ldFlags:
    93 FFFFFFE7 ??                  <2> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <2> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <2> ldParaPerSector:resw 1
    96                              <2> ldDirCluster:			; dword
    97                              <2> ldLoadingSeg:		; word
    98                              <2> ldQueryPatchValue:	; word
    99                              <2> lsvCommandLine:		; word
   100                              <2> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <2> .signature:	resw 1
   102                              <2> ldLoadUntilSeg:		; word
   103                              <2> lsvExtra:		; word
   104 FFFFFFEE ??                  <2> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <2> .flags:		resb 1	; byte
   106                              <2> 	endstruc
   107                              <2> 
   108                              <2> lsvefNoDataStart	equ 1
   109                              <2> lsvefPartitionNumber	equ 2
   110                              <2> 
   111                              <2> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   112                              <2> ldCommandLine:
   113 FFFFFEE0 <res 100h>          <2> .start:		resb lsvclBufferLength
   114                              <2> 	endstruc
   115                              <2> 
   116                              <2> ldfHasLBA:	equ 1
   117                              <2> ldfFATInvalid:	equ 2
   118                              <2> ldfFATBuffered:	equ 4
   119                              <2> ldfDataBuffered: equ 8
   120                              <2> 
   121                              <2> 	struc LOADDATA2, LOADDATA - 10h
   122 FFFFFFD0 ????????            <2> ldRootSector:		resd 1
   123 FFFFFFD4 ????                <2> ldEntriesPerSector:	resw 1
   124                              <2> ldDataSegment:		; word
   125 FFFFFFD6 ????                <2> ldLastAvailableSector:	resw 1
   126                              <2> ldDataSector:		; dword
   127 FFFFFFD8 ????                <2> ldParasLeft:		resw 1
   128 FFFFFFDA ????                <2> ldParasDone:		resw 1
   129                              <2> 	endstruc
   130                              <2> 
   131                              <2> 	struc LOADDATA3, LOADDATA2 - 10h
   132 FFFFFFC0 ????????            <2> ldMaxCluster:		resd 1
   133 FFFFFFC4 ????????            <2> ldFileSize:		resd 1
   134 FFFFFFC8 ????????            <2> ldCurrentCluster:	resd 1
   135 FFFFFFCC ????????            <2> ldCurrentSeek:		resd 1
   136                              <2> 	endstruc
   137                              <2> 
   138                              <2> 	struc LBAPACKET
   139 00000000 ????                <2> lpSize:		resw 1
   140 00000002 ????                <2> lpCount:	resw 1
   141 00000004 ????????            <2> lpBuffer:	resd 1
   142 00000008 ????????????????    <2> lpSector:	resq 1
   143                              <2> 	endstruc
   144                              <2> 
   145                              <2> 	struc PARTINFO
   146 00000000 ??                  <2> piBoot:		resb 1
   147 00000001 ??????              <2> piStartCHS:	resb 3
   148 00000004 ??                  <2> piType:		resb 1
   149 00000005 ??????              <2> piEndCHS:	resb 3
   150 00000008 ????????            <2> piStart:	resd 1
   151 0000000C ????????            <2> piLength:	resd 1
   152                              <2> 	endstruc
   153                              <2> 
   154                              <2> ptEmpty:		equ 0
   155                              <2> ptFAT12:		equ 1
   156                              <2> ptFAT16_16BIT_CHS:	equ 4
   157                              <2> ptExtendedCHS:		equ 5
   158                              <2> ptFAT16_CHS:		equ 6
   159                              <2> ptFAT32_CHS:		equ 0Bh
   160                              <2> ptFAT32:		equ 0Ch
   161                              <2> ptFAT16:		equ 0Eh
   162                              <2> ptExtended:		equ 0Fh
   163                              <2> ptLinux:		equ 83h
   164                              <2> ptExtendedLinux:	equ 85h
   165                              <2> 
   166                              <2> 
   167                              <2> 		; Flags of load_unit_flags
   168                              <2> lufForceCHS:		equ 1
   169                              <2> lufForceLBA:		equ 2
   170                              <2> lufForceGeometry:	equ 4
   171                              <2> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
    39                              <1> 
    40                              <1> 	numdef XLD
    41                              <1> 
    42                              <1> %ifn _COMPRESSLIB
    43                              <1> 	cpu 8086
    44                              <1> 
    45                              <1> 	addsection RELOCATEDDATA, nobits vstart=_ELD_RELOC_VSTART
    46                              <1> relocateddata:
    47                              <1> 
    48                              <1> 	addsection HEADER, start=0
    49                              <1> 
    50                              <1> 	istruc ELD_HEADERX
    51                              <1> at eldhxHeader
    52                              <1> 		; ELD executable header
    53                              <1> 	istruc ELD_HEADER
    54                              <1> at eldhSignature,	db "ELD1"
    55                              <1> 			db 0,0,0
    56                              <1> 			db 26
    57                              <1> at eldhCodeOffset,	dd CODEOFFSET
    58                              <1> at eldhCodeImageLength,	dw code_size
    59                              <1> at eldhCodeAllocLength,	dw 0
    60                              <1> at eldhDataOffset,	dd DATAOFFSET
    61                              <1> at eldhDataImageLength,	dw data_size
    62                              <1> at eldhDataAllocLength,	dw total_data_size - data_size
    63                              <1> at eldhCodeEntrypoint,	dw linker - code
    64                              <1> at eldhReserved
    65                              <1> at eldhExtensionSize,	dw header_extension_end - $$
    66                              <1> 	iend
    67                              <1> at eldhxDescriptionOffset,	dd description
    68                              <1> at eldhxHelpOffset,		dd DATAOFFSET + msg.help - datastart
    69                              <1> at eldhxLibTable,		dd DATAOFFSET + libtable - datastart
    70                              <1> PUT_ELDHX_DATETIME_OFFSET
    71                              <1> header_extension_end:
    72                              <1> 	iend
    73                              <1> 
    74                              <1> description:		asciz "EXT LIB: library of ELDs."
    75                              <1> 
    76                              <1> 
    77                              <1> 	align 16, db 0
    78                              <1> 
    79                              <1> CODEOFFSET equ $ - $$
    80                              <1> 	addsection CODE, follows=HEADER vstart=_ELD_CODE_VSTART
    81                              <1> %define CODEFIXUP - code + 0
    82                              <1> code:
    83                              <1> 		; ELD instance header
    84                              <1> 	istruc ELD_INSTANCE
    85                              <1> at eldiStartCode
    86                              <1> at eldiEndCode
    87                              <1> at eldiStartData
    88                              <1> at eldiEndData
    89                              <1> at eldiIdentifier,	fill 8, 32, db "EXTLIB"
    90                              <1> at eldiListing,		asciz _ELD_LISTING
    91                              <1> 	iend
    92                              <1> 
    93                              <1> start:
    94                              <1> 	push ss
    95                              <1> 	pop es
    96                              <1> %if _DATABUFFER
    97                              <1> reloc	testopt [relocateddata], nodosloaded
    98                              <1> linkdatarelocation internalflags, -3
    99                              <1> 	jz .skipdatabuffer
   100                              <1> 	mov cl, 4
   101                              <1> 	mov ax, ss
   102                              <1> reloc	mov bx, databuffer
   103                              <1> internaldatarelocation
   104                              <1> 	test bl, 15
   105                              <1> 	jnz .skipdatabuffer
   106                              <1> 	shr bx, cl
   107                              <1> 	add ax, bx
   108                              <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSegment], ax
   109                              <1> linkdatarelocation load_data
   110                              <1> 	xor ax, ax
   111                              <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSector + 2], ax
   112                              <1> linkdatarelocation load_data
   113                              <1> reloc	mov word [relocateddata - LOADDATA2 + ldDataSector], ax
   114                              <1> linkdatarelocation load_data
   115                              <1> reloc	setopt [relocateddata - LOADDATA2 + ldFlags], ldfDataBuffered
   116                              <1> linkdatarelocation load_data, -3
   117                              <1> .skipdatabuffer:
   118                              <1> %endif
   119                              <1> 	extcallcall skipcomma
   120                              <1> 	dec si
   121                              <1> 	mov bx, si
   122                              <1> 	lodsb
   123                              <1> 	extcallcall iseol?
   124                              <1> 	lea si, [si - 1]
   125                              <1> 	je help
   126                              <1> 	mov dx, msg.help_keyword
   127                              <1> internaldatarelocation
   128                              <1> 	extcallcall isstring?
   129                              <1> 	je help
   130                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   131                              <1> 	mov dx, msg.test_keyword
   132                              <1> internaldatarelocation
   133                              <1> 	extcallcall isstring?
   134                              <1> 	je test
   135                              <1> %endif
   136                              <1> 	lodsb
   137                              <1> 	jmp getname
   138                              <1> 
   139                              <1> %if _COMPRESSED && _ELD_TEST_LIB
   140                              <1> test:
   141                              <1> 	xor cx, cx
   142                              <1> 	xor dx, dx
   143                              <1> 	call get_dxax_seek_lib_plus_cxdx
   144                              <1> 	jc .io_error
   145                              <1> 	mov word [libseek], ax
   146                              <1> internaldatarelocation
   147                              <1> 	mov word [libseek + 2], dx
   148                              <1> internaldatarelocation
   149                              <1> 
   150                              <1> 	mov cx, ELD_HEADERX_size
   151                              <1> 	sub sp, cx
   152                              <1> 
   153                              <1> 	xor ax, ax
   154                              <1> 	mov word [depackskip], ax
   155                              <1> internaldatarelocation
   156                              <1> 	mov word [depackskip + 2], ax
   157                              <1> internaldatarelocation
   158                              <1> 
   159                              <1> 	mov dx, sp
   160                              <1> 	call read_and_depack
   161                              <1> 	houdini
   162                              <1> 
   163                              <1> 	mov ax, (library_end_skip - library_start_skip - 16) & 0FFFFh
   164                              <1> 	mov dx, (library_end_skip - library_start_skip - 16) >> 16
   165                              <1> 
   166                              <1> 	mov word [depackskip], ax
   167                              <1> internaldatarelocation
   168                              <1> 	mov word [depackskip + 2], dx
   169                              <1> internaldatarelocation
   170                              <1> 
   171                              <1> 	mov cx, ELD_HEADERX_size
   172                              <1> 	mov dx, sp
   173                              <1> 	call read_and_depack
   174                              <1> 	houdini
   175                              <1> 	jc .io_error
   176                              <1> 	cmp cx, ax
   177                              <1> 	jne .io_error
   178                              <1> .io_error:
   179                              <1> 	mov word [depackskip], 30h
   180                              <1> internaldatarelocation -4
   181                              <1> 	mov word [depackskip + 2], 0
   182                              <1> internaldatarelocation -4
   183                              <1> 
   184                              <1> 	mov cx, 32
   185                              <1> 	mov dx, sp
   186                              <1> 	call read_and_depack
   187                              <1> 	houdini
   188                              <1> 
   189                              <1> 	extcallcall cmd3
   190                              <1> %endif
   191                              <1> 
   192                              <1> help:
   193                              <1> 	mov cx, 2
   194                              <1> 	extcallcall skipcomma
   195                              <1> 	extcallcall iseol?
   196                              <1> 	je .dispatch_eol
   197                              <1> 	dec si
   198                              <1> 	dec cx
   199                              <1> 	mov dx, msg.describe_keyword
   200                              <1> internaldatarelocation
   201                              <1> 	extcallcall isstring?
   202                              <1> 	je .dispatch
   203                              <1> %if _COMPRESSED
   204                              <1> 	not byte [partialdepack]
   205                              <1> internaldatarelocation
   206                              <1> %endif
   207                              <1> 	mov dx, msg.describex_keyword
   208                              <1> internaldatarelocation
   209                              <1> 	extcallcall isstring?
   210                              <1> 	je .dispatch
   211                              <1> 	dec cx
   212                              <1> 	mov dx, msg.wide_keyword
   213                              <1> internaldatarelocation
   214                              <1> 	extcallcall isstring?
   215                              <1> 	je .dispatch
   216                              <1> 	jmp error
   217                              <1> 
   218                              <1> .dispatch:
   219                              <1> 	lodsb
   220                              <1> 	extcallcall chkeol
   221                              <1> .dispatch_eol:
   222                              <1> 	mov dx, msg.help
   223                              <1> internaldatarelocation
   224                              <1> 	extcallcall putsz
   225                              <1> 
   226                              <1> 	cmp cl, 1
   227                              <1> 	jbe @F
   228                              <1> 	call zerooffsets
   229                              <1> 	extcallcall cmd3
   230                              <1> 
   231                              <1> @@:
   232                              <1> 	je describe
   233                              <1> 
   234                              <1> wide:
   235                              <1> 	mov dx, msg.list
   236                              <1> internaldatarelocation
   237                              <1> 	extcallcall putsz
   238                              <1> 
   239                              <1> 	mov si, lib
   240                              <1> internaldatarelocation
   241                              <1> 	jmp @F
   242                              <1> .loop:
   243                              <1> 	cmp di, relocateddata + 9 * 8
   244                              <1> linkdatarelocation line_out
   245                              <1> 	jb @FF
   246                              <1> 	extcallcall trimputs
   247                              <1> @@:
   248                              <1> reloc	mov di, relocateddata
   249                              <1> linkdatarelocation line_out
   250                              <1> @@:
   251                              <1> 	lea si, [si + 4]
   252                              <1> 	mov cx, 8
   253                              <1> 	rep movsb
   254                              <1> 	mov al, 32
   255                              <1> 	stosb
   256                              <1> 
   257                              <1> 	cmp si, strict word lib_end
   258                              <1> internaldatarelocation
   259                              <1> 	jb .loop
   260                              <1> 	extcallcall trimputs
   261                              <1> 	call zerooffsets
   262                              <1> 	extcallcall cmd3
   263                              <1> 
   264                              <1> 
   265                              <1> describe:
   266                              <1> 	mov dx, msg.list
   267                              <1> internaldatarelocation
   268                              <1> 	extcallcall putsz
   269                              <1> 
   270                              <1> 	xor cx, cx
   271                              <1> 	xor dx, dx
   272                              <1> 	call get_dxax_seek_lib_plus_cxdx
   273                              <1> 	jc .io_error
   274                              <1> 	mov word [libseek], ax
   275                              <1> internaldatarelocation
   276                              <1> 	mov word [libseek + 2], dx
   277                              <1> internaldatarelocation
   278                              <1> 
   279                              <1> 	mov si, lib
   280                              <1> internaldatarelocation
   281                              <1> .loop:
   282                              <1> 	lea dx, [si + 4]
   283                              <1> 	mov cx, 8
   284                              <1> 	push bx
   285                              <1> 	extcallcall puts
   286                              <1> 	pop bx
   287                              <1> 	mov dx, msg.between
   288                              <1> internaldatarelocation
   289                              <1> 	extcallcall putsz
   290                              <1> 
   291                              <1> %if _COMPRESSED
   292                              <1> 	mov ax, word [si]
   293                              <1> 	mov dx, word [si + 2]
   294                              <1> 
   295                              <1> 	mov word [eldheader], ax
   296                              <1> internaldatarelocation
   297                              <1> 	mov word [eldheader + 2], dx
   298                              <1> internaldatarelocation
   299                              <1> 
   300                              <1> 	mov word [depackskip], ax
   301                              <1> internaldatarelocation
   302                              <1> 	mov word [depackskip + 2], dx
   303                              <1> internaldatarelocation
   304                              <1> %else
   305                              <1> 	mov dx, word [libseek]
   306                              <1> internaldatarelocation
   307                              <1> 	mov cx, word [libseek + 2]
   308                              <1> internaldatarelocation
   309                              <1> 
   310                              <1> 	add dx, word [si]
   311                              <1> 	adc cx, word [si + 2]
   312                              <1> 
   313                              <1> 	mov ax, 4200h
   314                              <1> 	call dos_or_boot_io
   315                              <1> 	jc .io_error
   316                              <1> 	mov word [eldheader], ax
   317                              <1> internaldatarelocation
   318                              <1> 	mov word [eldheader + 2], dx
   319                              <1> internaldatarelocation
   320                              <1> %endif
   321                              <1> 
   322                              <1> 	mov cx, ELD_HEADERX_size
   323                              <1> 	sub sp, cx
   324                              <1> 	mov dx, sp
   325                              <1> %if _COMPRESSED
   326                              <1> 	call read_and_depack
   327                              <1> %else
   328                              <1> 	mov ax, 3F00h
   329                              <1> 	call dos_or_boot_io
   330                              <1> %endif
   331                              <1> 	jc .io_error
   332                              <1> 	cmp cx, ax
   333                              <1> 	jne .io_error
   334                              <1> 
   335                              <1> 	mov di, sp
   336                              <1> 	cmp word [di + eldhExtensionSize], eldhxDescriptionOffset + 4
   337                              <1> 	jb .nodesc
   338                              <1> 	mov cx, word [di + eldhxDescriptionOffset + 2]
   339                              <1> 	mov dx, word [di + eldhxDescriptionOffset]
   340                              <1> 	mov ax, cx
   341                              <1> 	or ax, dx
   342                              <1> 	jz .nodesc
   343                              <1> 
   344                              <1> 	mov ax, 4200h
   345                              <1> 	add dx, word [eldheader]
   346                              <1> internaldatarelocation
   347                              <1> 	adc cx, word [eldheader + 2]
   348                              <1> internaldatarelocation
   349                              <1> %if _COMPRESSED
   350                              <1> 	mov word [depackskip], dx
   351                              <1> internaldatarelocation
   352                              <1> 	mov word [depackskip + 2], cx
   353                              <1> internaldatarelocation
   354                              <1> %else
   355                              <1> 	call dos_or_boot_io
   356                              <1> 	jc .io_error
   357                              <1> %endif
   358                              <1> 
   359                              <1> 	mov di, relocateddata
   360                              <1> linkdatarelocation line_out
   361                              <1> 	mov dx, di
   362                              <1> 	xor ax, ax
   363                              <1> 	mov cx, words(128)
   364                              <1> 	rep stosw
   365                              <1> 	mov cl, 127
   366                              <1> %if _COMPRESSED
   367                              <1> 	call read_and_depack
   368                              <1> %else
   369                              <1> 	mov ax, 3F00h
   370                              <1> 	call dos_or_boot_io
   371                              <1> %endif
   372                              <1> 	jc .io_error
   373                              <1> 	; cmp cx, ax
   374                              <1> 	; jne .io_error
   375                              <1> 
   376                              <1> 	extcallcall putsz
   377                              <1> 	mov dx, msg.linebreak
   378                              <1> internaldatarelocation
   379                              <1> 	jmp @F
   380                              <1> .nodesc:
   381                              <1> 	mov dx, msg.nodesc
   382                              <1> internaldatarelocation
   383                              <1> @@:
   384                              <1> 	extcallcall putsz
   385                              <1> 	add sp, ELD_HEADERX_size
   386                              <1> 	add si, 4 + 8
   387                              <1> 	cmp si, strict word lib_end
   388                              <1> internaldatarelocation
   389                              <1> 	jb .loop
   390                              <1> 
   391                              <1> .io_error equ found.io_error
   392                              <1> 	call zerooffsets
   393                              <1> 	extcallcall cmd3
   394                              <1> 
   395                              <1> 
   396                              <1> zerooffsets:
   397                              <1> %if _ELD_ZERO_OFFSETS
   398                              <1> 		; for debugging with eldcomp, zero the offsets
   399                              <1> 	xor ax, ax
   400                              <1> 	mov di, ..@eldltOffset
   401                              <1> internaldatarelocation
   402                              <1> 	stosw
   403                              <1> 	stosw			; clear eldltOffset
   404                              <1>  %if _COMPRESSED
   405                              <1> 	stosw
   406                              <1> 	stosw			; clear libtab_compressed_length
   407                              <1>  %endif
   408                              <1> .loop:
   409                              <1> 	stosw
   410                              <1> 	stosw
   411                              <1> 	add di, 8
   412                              <1> 	cmp di, strict word lib_end
   413                              <1> internaldatarelocation
   414                              <1> 	jb .loop
   415                              <1> %endif
   416                              <1> 	retn
   417                              <1> 
   418                              <1> 
   419                              <1> getname:
   420                              <1> 	cmp al, '"'
   421                              <1> 	je quoted
   422                              <1> 	cmp al, "'"
   423                              <1> 	je quoted
   424                              <1> unquoted:
   425                              <1> 	dec si
   426                              <1> .loop:
   427                              <1> 	lodsb
   428                              <1> 	cmp al, 32
   429                              <1> 	je end
   430                              <1> 	cmp al, 9
   431                              <1> 	je end
   432                              <1> 	cmp al, ','
   433                              <1> 	je end
   434                              <1> 	extcallcall iseol?.notsemicolon
   435                              <1> 	jne .loop
   436                              <1> 	jmp end
   437                              <1> 
   438                              <1> quoted:
   439                              <1> 	inc bx
   440                              <1> 	mov ah, al
   441                              <1> .loop:
   442                              <1> 	lodsb
   443                              <1> 	cmp al, ah
   444                              <1> 	je end_quoted
   445                              <1> 	extcallcall iseol?.notsemicolon
   446                              <1> 	jne .loop
   447                              <1> unexpected_eol:
   448                              <1> 	mov ax, 0E36h
   449                              <1> 	extcallcall setrc
   450                              <1> 	mov dx, msg.unexpected_eol
   451                              <1> internaldatarelocation
   452                              <1> putsz_cmd3:
   453                              <1> 	extcallcall putsz
   454                              <1> cmd3_j:
   455                              <1> 	extcallcall cmd3
   456                              <1> 
   457                              <1> end_quoted:
   458                              <1> 	lea cx, [si - 1]
   459                              <1> 	lodsb
   460                              <1> 	jmp @F
   461                              <1> 
   462                              <1> end:
   463                              <1> 	lea cx, [si - 1]
   464                              <1> @@:
   465                              <1> 	extcallcall skipcomm0
   466                              <1> 	dec si
   467                              <1> 
   468                              <1> 	push si
   469                              <1> 	sub cx, bx
   470                              <1> 	jz notfound_invalid
   471                              <1> 
   472                              <1> 	cmp cx, 4
   473                              <1> 	jb .notext
   474                              <1> 	lea si, [bx - 4]
   475                              <1> 	add si, cx
   476                              <1> 	cmp byte [si], '.'
   477                              <1> 	jne .notext
   478                              <1> 	mov ax, word [si + 2]
   479                              <1> 	and ax, ~2020h
   480                              <1> 	cmp ax, "LD"
   481                              <1> 	jne .notext
   482                              <1> 	mov al, byte [si + 1]
   483                              <1> 	and al, ~20h
   484                              <1> 	cmp al, 'E'
   485                              <1> 	je .ext
   486                              <1> 	cmp al, 'X'
   487                              <1> 	jne .notext
   488                              <1> .ext:
   489                              <1> 	sub cx, 4
   490                              <1> 	jz notfound_invalid
   491                              <1> .notext:
   492                              <1> 
   493                              <1> 	cmp cx, 8
   494                              <1> 	ja notfound_invalid
   495                              <1> 	mov si, bx
   496                              <1> 	mov di, namebuffer
   497                              <1> internaldatarelocation
   498                              <1> 	mov dx, cx
   499                              <1> @@:
   500                              <1> 	lodsb
   501                              <1> 	extcallcall uppercase
   502                              <1> 	stosb
   503                              <1> 	loop @B
   504                              <1> 	neg dx
   505                              <1> 	add dx, 8
   506                              <1> 	xchg cx, dx
   507                              <1> 	mov al, 32
   508                              <1> 	rep stosb
   509                              <1> 	mov di, namebuffer
   510                              <1> internaldatarelocation
   511                              <1> 
   512                              <1> search_filename:
   513                              <1> 	mov si, lib + 4
   514                              <1> internaldatarelocation
   515                              <1> .loop:
   516                              <1> 	push di
   517                              <1> 	push si
   518                              <1> 	mov cx, 8
   519                              <1> @@:
   520                              <1> 	lodsb
   521                              <1> 	extcallcall uppercase
   522                              <1> 	scasb
   523                              <1> 	jne @F
   524                              <1> 	loop @B
   525                              <1> @@:
   526                              <1> 	pop si
   527                              <1> 	pop di
   528                              <1> 	je found
   529                              <1> 	add si, 8 + 4
   530                              <1> 	cmp si, strict word lib_end
   531                              <1> internaldatarelocation
   532                              <1> 	jb .loop
   533                              <1> 
   534                              <1> search_instancename:
   535                              <1> 	xor cx, cx
   536                              <1> 	xor dx, dx
   537                              <1> 	call get_dxax_seek_lib_plus_cxdx
   538                              <1> 	jc .io_error
   539                              <1> 	mov word [libseek], ax
   540                              <1> internaldatarelocation
   541                              <1> 	mov word [libseek + 2], dx
   542                              <1> internaldatarelocation
   543                              <1> 
   544                              <1> 	mov si, lib + 4
   545                              <1> internaldatarelocation
   546                              <1> 
   547                              <1> .loop:
   548                              <1> %if _COMPRESSED
   549                              <1> 	mov ax, word [si - 4]
   550                              <1> 	mov dx, word [si - 4 + 2]
   551                              <1> 
   552                              <1> 	mov word [depackskip], ax
   553                              <1> internaldatarelocation
   554                              <1> 	mov word [depackskip + 2], dx
   555                              <1> internaldatarelocation
   556                              <1> %else
   557                              <1> 	mov cx, word [si - 4 + 2]
   558                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   559                              <1> 	add dx, word [libseek]
   560                              <1> internaldatarelocation
   561                              <1> 	adc cx, word [libseek + 2]
   562                              <1> internaldatarelocation
   563                              <1> 	mov ax, 4200h
   564                              <1> 	call dos_or_boot_io
   565                              <1> 	jc .io_error
   566                              <1> %endif
   567                              <1> 
   568                              <1> 	mov word [eldheader], ax
   569                              <1> internaldatarelocation
   570                              <1> 	mov word [eldheader + 2], dx
   571                              <1> internaldatarelocation
   572                              <1> 
   573                              <1> 	mov cx, ELD_HEADER_size
   574                              <1> 	sub sp, cx
   575                              <1> 	mov dx, sp
   576                              <1> %if _COMPRESSED
   577                              <1> 	call read_and_depack
   578                              <1> %else
   579                              <1> 	mov ax, 3F00h
   580                              <1> 	call dos_or_boot_io
   581                              <1> %endif
   582                              <1> 	jc .io_error
   583                              <1> 	cmp cx, ax
   584                              <1> 	jne .io_error
   585                              <1> 
   586                              <1> 	mov di, sp
   587                              <1> 	mov cx, word [di + eldhCodeOffset + 2]
   588                              <1> 	mov dx, word [di + eldhCodeOffset] ; cx:dx = offset within ELD
   589                              <1> 	add dx, word [eldheader]
   590                              <1> internaldatarelocation
   591                              <1> 	adc cx, word [eldheader + 2]
   592                              <1> internaldatarelocation
   593                              <1> %if _COMPRESSED
   594                              <1> 	mov word [depackskip], dx
   595                              <1> internaldatarelocation
   596                              <1> 	mov word [depackskip + 2], cx
   597                              <1> internaldatarelocation
   598                              <1> %else
   599                              <1> 	mov ax, 4200h
   600                              <1> 	call dos_or_boot_io
   601                              <1> 	jc .io_error
   602                              <1> %endif
   603                              <1> 
   604                              <1> 	mov dx, sp
   605                              <1> 	mov cx, eldiIdentifier + 8
   606                              <1> %if (eldiIdentifier + 8) > ELD_HEADER_size
   607                              <1>  %error Expected shorter instance header
   608                              <1> %endif
   609                              <1> %if _COMPRESSED
   610                              <1> 	call read_and_depack
   611                              <1> %else
   612                              <1> 	mov ax, 3F00h
   613                              <1> 	call dos_or_boot_io
   614                              <1> %endif
   615                              <1> 	jc .io_error
   616                              <1> 	cmp cx, ax
   617                              <1> 	jne .io_error
   618                              <1> 
   619                              <1> 	push si
   620                              <1> 	lea si, [di + eldiIdentifier]
   621                              <1> 	mov di, namebuffer
   622                              <1> internaldatarelocation
   623                              <1> 
   624                              <1> 	push di
   625                              <1> 	mov cx, 8
   626                              <1> @@:
   627                              <1> 	lodsb
   628                              <1> 	extcallcall uppercase
   629                              <1> 	scasb
   630                              <1> 	jne @F
   631                              <1> 	loop @B
   632                              <1> @@:
   633                              <1> 	pop di
   634                              <1> 	pop si
   635                              <1> 	je .found
   636                              <1> 	add sp, ELD_HEADER_size
   637                              <1> 
   638                              <1> 	add si, 8 + 4
   639                              <1> 	cmp si, strict word lib_end
   640                              <1> internaldatarelocation
   641                              <1> 	jb .loop
   642                              <1> 	jmp notfound
   643                              <1> 
   644                              <1> .found:
   645                              <1> 	add sp, ELD_HEADER_size
   646                              <1> 
   647                              <1> %ifn _COMPRESSED
   648                              <1> 	mov dx, word [eldheader]
   649                              <1> internaldatarelocation
   650                              <1> 	mov cx, word [eldheader + 2]
   651                              <1> internaldatarelocation
   652                              <1> 	mov ax, 4200h
   653                              <1> 	call dos_or_boot_io
   654                              <1> 	jc .io_error
   655                              <1> %endif
   656                              <1> 	jmp found.header_variable
   657                              <1> 
   658                              <1> .io_error equ found.io_error
   659                              <1> 
   660                              <1> 
   661                              <1> notfound:
   662                              <1> 	mov ax, 0E37h
   663                              <1> 	extcallcall setrc
   664                              <1> 	mov dx, msg.notfound.1
   665                              <1> internaldatarelocation
   666                              <1> 	extcallcall putsz
   667                              <1> 	mov dx, di
   668                              <1> 	mov cx, 8
   669                              <1> 	extcallcall puts
   670                              <1> 	mov dx, msg.notfound.2
   671                              <1> internaldatarelocation
   672                              <1> 	call zerooffsets
   673                              <1> 	jmp putsz_cmd3
   674                              <1> 
   675                              <1> notfound_invalid:
   676                              <1> 	mov ax, 0E38h
   677                              <1> 	extcallcall setrc
   678                              <1> 	mov dx, msg.notfound.invalid
   679                              <1> internaldatarelocation
   680                              <1> 	call zerooffsets
   681                              <1> 	jmp putsz_cmd3
   682                              <1> 
   683                              <1> found:
   684                              <1> %if 0
   685                              <1> 	xor ax, ax
   686                              <1> 	retf
   687                              <1> %endif
   688                              <1> 
   689                              <1> %if _COMPRESSED
   690                              <1> 	xor cx, cx
   691                              <1> 	xor dx, dx
   692                              <1> 	call get_dxax_seek_lib_plus_cxdx
   693                              <1> 	jc .io_error
   694                              <1> 	mov word [libseek], ax
   695                              <1> internaldatarelocation
   696                              <1> 	mov word [libseek + 2], dx
   697                              <1> internaldatarelocation
   698                              <1> 
   699                              <1> 	mov dx, word [si - 4 + 2]
   700                              <1> 	mov ax, word [si - 4]		; dx:ax = offset within lib section
   701                              <1> %else
   702                              <1> 	mov cx, word [si - 4 + 2]
   703                              <1> 	mov dx, word [si - 4]		; cx:dx = offset within lib section
   704                              <1> 
   705                              <1> 	call get_dxax_seek_lib_plus_cxdx
   706                              <1> 	jc .io_error
   707                              <1> %endif
   708                              <1> 	mov word [eldheader], ax
   709                              <1> internaldatarelocation
   710                              <1> 	mov word [eldheader + 2], dx
   711                              <1> internaldatarelocation
   712                              <1> .header_variable:
   713                              <1> 
   714                              <1> %assign _BOOTLDR 1
   715                              <1> %assign _APPLICATION 1
   716                              <1> %assign _DEVICE 1
   717                              <1> %assign _PM 1
   718                              <1> %define relocated(address) relocateddata
   719                              <1> %define doscall extcallcall _doscall
   720                              <1> %assign ELD 1
   721                              <1> %assign _DOSORBOOTIO 1
   722                              <1> 
   723                              <1> %include "loadeld.asm"
   724                              <1> 
   725                              <1> .error_internal:
   726                              <1> 	mov dx, msg.ext_error_internal
   727                              <1> internaldatarelocation
   728                              <1> 	mov ax, 0E39h
   729                              <1> 	jmp @F
   730                              <1> 
   731                              <1> .io_error:
   732                              <1> 	mov dx, msg.ext_error_io
   733                              <1> internaldatarelocation
   734                              <1> 	mov ax, 0E3Ah
   735                              <1> 	jmp @F
   736                              <1> 
   737                              <1> .invalid:
   738                              <1> 	mov dx, msg.ext_error_invalid
   739                              <1> internaldatarelocation
   740                              <1> 	mov ax, 0E3Bh
   741                              <1> 	jmp @F
   742                              <1> 
   743                              <1> .oom:
   744                              <1> 	mov dx, msg.ext_error_oom
   745                              <1> internaldatarelocation
   746                              <1> 	mov ax, 0E3Ch
   747                              <1> 
   748                              <1> @@:
   749                              <1> 	extcallcall setrc
   750                              <1> 	push ss
   751                              <1> 	pop ds
   752                              <1> 	extcallcall putsz
   753                              <1> 	extcallcall cmd3
   754                              <1> 
   755                              <1> 
   756                              <1> get_dxax_seek_lib_plus_cxdx:
   757                              <1> 	mov bx, relocateddata
   758                              <1> linkdatarelocation load_data_lowest	; make yy_boot_get and yy_boot_update no-ops
   759                              <1> 	testopt [relocateddata], nodosloaded
   760                              <1> linkdatarelocation internalflags, -3
   761                              <1> 	jnz @F
   762                              <1> 	mov bx, [relocateddata]
   763                              <1> linkdatarelocation ext_handle
   764                              <1> 	extcallcall InDOS
   765                              <1> 	jz @F
   766                              <1> 	extcallcall error
   767                              <1> @@:
   768                              <1> 	mov ax, relocateddata
   769                              <1> linkdatarelocation ext_finish.bp_is_set
   770                              <1> 
   771                              <1> 	mov ax, 4201h
   772                              <1> lib_displacement equ LIBOFFSET - DATAOFFSET - data_size
   773                              <1> 	add dx, lib_displacement & 0FFFFh
   774                              <1> 	adc cx, (lib_displacement >> 16) & 0FFFFh
   775                              <1> 	; jmp dos_or_boot_io
   776                              <1> 
   777                              <1> 
   778                              <1> dos_or_boot_io:
   779                              <1> %if _BOOTLDR
   780                              <1> reloc	testopt [ss:relocateddata], nodosloaded
   781                              <1> linkdatarelocation internalflags, -3
   782                              <1> 	jnz .boot
   783                              <1> %endif
   784                              <1> .dos:
   785                              <1> 	cmp ax, 3FFFh
   786                              <1> 	je @F
   787                              <1> 	extcall _doscall
   788                              <1> 	retn
   789                              <1> 
   790                              <1> @@:
   791                              <1> 	extcall doscall_extseg
   792                              <1> 	retn
   793                              <1> 
   794                              <1> %if _BOOTLDR
   795                              <1> .boot:
   796                              <1> 	cmp ah, 3Fh
   797                              <1> 	jne @F
   798                              <1> 	cmp al, 0FFh
   799                              <1> 	jne .bootread
   800                              <1> .bootread_ext:
   801                              <1> 	push ds
   802                              <1> 	pop es
   803                              <1> 	push ss
   804                              <1> 	pop ds
   805                              <1> .bootread:
   806                              <1> 	extcall yy_boot_read.bx
   807                              <1> 	push ss
   808                              <1> 	pop es
   809                              <1> 	retn
   810                              <1> 
   811                              <1> @@:
   812                              <1> 	cmp ax, 4200h
   813                              <1> 	jne @F
   814                              <1> 	sub dx, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   815                              <1> linkdatarelocation load_data
   816                              <1> 	sbb cx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   817                              <1> linkdatarelocation load_data
   818                              <1> 
   819                              <1> .boot_seek_current:
   820                              <1> 	extcall yy_boot_seek_current.bx
   821                              <1> 	mov ax, word [relocateddata - LOADDATA2 + ldCurrentSeek]
   822                              <1> linkdatarelocation load_data
   823                              <1> 	mov dx, word [relocateddata - LOADDATA2 + ldCurrentSeek + 2]
   824                              <1> linkdatarelocation load_data
   825                              <1> 	retn
   826                              <1> 
   827                              <1> @@:
   828                              <1> 	cmp ax, 4201h
   829                              <1> 	je .boot_seek_current
   830                              <1> 	extcallcall error
   831                              <1> %endif
   832                              <1> 
   833                              <1> 
   834                              <1> %if _COMPRESSED
   835                              <1> %assign _STANDALONE 0
   836                              <1>  %include "depack.asm"
   837                              <1> %endif
   838                              <1> 
   839                              <1> 
   840                              <1> get_es_ext:
   841                              <1> reloc	mov es, word [relocateddata]
   842                              <1> linkdatarelocation extdssel
   843                              <1> 	extcallcall ispm
   844                              <1> 	jz @F
   845                              <1> reloc	mov es, word [relocateddata]
   846                              <1> linkdatarelocation extseg
   847                              <1> @@:
   848                              <1> 	retn
   849                              <1> 
   850                              <1> 
   851                              <1> 	align 16
   852                              <1> relocator:
   853                              <1> 	push si
   854                              <1> 	push di
   855                              <1> 	push ds
   856                              <1> 	push es
   857                              <1> 
   858                              <1> 	 push es
   859                              <1> 	 pop ds
   860                              <1> 	mov cx, 0
   861                              <1> .codelength equ $ - 2
   862                              <1> 	mov si, 0
   863                              <1> .codesource equ $ - 2
   864                              <1> 	mov di, code
   865                              <1> .codedestination equ $ - 2
   866                              <1> internalcoderelocation
   867                              <1> 	rep movsb
   868                              <1> 
   869                              <1> 	 push ss
   870                              <1> 	 pop es
   871                              <1> 	 push ss
   872                              <1> 	 pop ds
   873                              <1> 	mov cx, 0
   874                              <1> .datalength equ $ - 2
   875                              <1> 	mov si, 0
   876                              <1> .datasource equ $ - 2
   877                              <1> 	mov di, datastart
   878                              <1> .datadestination equ $ - 2
   879                              <1> internaldatarelocation
   880                              <1> 	rep movsb
   881                              <1> 
   882                              <1> 	pop es
   883                              <1> 	mov word [relocateddata], 0
   884                              <1> linkdatarelocation extseg_used, -4
   885                              <1> .extseg_used equ $ - 2
   886                              <1> 	mov word [relocateddata], 0
   887                              <1> linkdatarelocation extdata_used, -4
   888                              <1> .extdata_used equ $ - 2
   889                              <1> 
   890                              <1> 	mov cx, 0
   891                              <1> .entry equ $ - 2
   892                              <1> 	pop ds
   893                              <1> 	pop di
   894                              <1> 	pop si
   895                              <1> 	jmp cx
   896                              <1> 
   897                              <1> 	align 16
   898                              <1> 	endarea relocator
   899                              <1> 
   900                              <1> 
   901                              <1> DATAOFFSET equ CODEOFFSET + code_size
   902                              <1> 	addsection DATA, follows=CODE vstart=_ELD_DATA_VSTART
   903                              <1> datastart:
   904                              <1> PUT_ELD_DATETIME
   905                              <1> 
   906                              <1> %define INCBINLIST db ""
   907                              <1> 
   908                              <1> 	%imacro libeld 1-2.nolist
   909                              <1> %strcat %%label "lib_", %1
   910                              <1> %deftok %%token %%label
   911                              <1> %if _XLD
   912                              <1>  %strcat %%filename %1,".xld"
   913                              <1> %else
   914                              <1>  %strcat %%filename %1,".eld"
   915                              <1> %endif
   916                              <1> %xdefine INCBINLIST INCBINLIST, {align 16, db 0}, %%token:, incbin %%filename
   917                              <1> 	dd %%token
   918                              <1> 	fill 8, 32, db %1
   919                              <1> 	%endmacro
   920                              <1> 
   921                              <1> 	%imacro dump_incbin 1-*.nolist
   922                              <1> %rep %0
   923                              <1> 	%1
   924                              <1>  %rotate 1
   925                              <1> %endrep
   926                              <1> 	%endmacro
   927                              <1> 
   928                              <1> %ifn _COMPRESSED
   929                              <1> 	overridedef LZEXEDAT, 0
   930                              <1> %endif
   931                              <1> %ifn _LZEXEDAT
   932                              <1> 	overridedef LONGLITERAL, 0
   933                              <1> %endif
   934                              <1> 
   935                              <1> 	align 4, db 0
   936                              <1> libtable:
   937                              <1>  istruc ELD_LIBTABLE
   938                              <1> at eldltFormat,		dw 2 * !!_COMPRESSED + !!_LZEXEDAT + !!_LONGLITERAL
   939                              <1> 	; 0 = uncompressed
   940                              <1> 	; 1 = legacy heatshrink format (no libtab compressed length)
   941                              <1> 	; 2 = heatshrink format (prepended with -w and -l bytes)
   942                              <1> 	; 3 = lzexedat -4 format (current revision starts with a 1 bit)
   943                              <1> 	; 4 = lzexedat -4 -l format (current revision starts with a 1 bit)
   944                              <1> at eldltAmount,		dw (lib_end - lib) / 12
   945                              <1> at eldltOffset
   946                              <1> ..@eldltOffset:		dd LIBOFFSET
   947                              <1>  iend
   948                              <1>  %if _COMPRESSED
   949                              <1> libtab_compressed_length:
   950                              <1> 			dd (lib_compressed_end - lib_start)
   951                              <1>  %endif
   952                              <1> %else
   953                              <1> 		; Collect the binaries and compress them solidly.
   954                              <1> 	%imacro libeld 1-2.nolist
   955                              <1> %strcat %%label "lib_", %1
   956                              <1> %deftok %%token %%label
   957                              <1> %if _XLD
   958                              <1>  %strcat %%filename %1,".xld"
   959                              <1> %else
   960                              <1>  %strcat %%filename %1,".eld"
   961                              <1> %endif
   962                              <1> 	align 16, db 0
   963                              <1> %%token:
   964                              <1> 	incbin %%filename
   965                              <1> 	%endmacro
   966                              <1> %endif
   967                              <1> 
   968                              <1> 	numdef ELD_DEBUG_LIB, 0
   969                              <1> lib:
   970                              <1> %if _ELD_DEBUG_LIB
   971                              <1> libeld "eldteste"
   972                              <1> libeld "eldtestf"
   973                              <1> %else
   974 00000000 <bin CF0h>          <1> libeld "aformat"
   975 00000CF0 <bin 1050h>         <1> libeld "alias"
   976 00001D40 <bin C90h>          <1> libeld "amiscmd"
   977 000029D0 <bin C40h>          <1> libeld "amismsg"
   978 00003610 <bin B00h>          <1> libeld "amisoth"
   979 00004110 <bin 18E0h>         <1> libeld "amitsrs"
   980 000059F0 <bin B90h>          <1> libeld "amount"
   981 00006580 <bin D40h>          <1> libeld "bases"
   982 000072C0 <bin 1770h>         <1> libeld "bootdir"
   983 00008A30 <bin C80h>          <1> libeld "checksum"
   984 000096B0 <bin 1A90h>         <1> libeld "chstool"
   985 0000B140 <bin 1210h>         <1> libeld "co"
   986 0000C350 <bin A10h>          <1> libeld "config"
   987 0000CD60 <bin 1350h>         <1> libeld "dbitmap"
   988 0000E0B0 <bin E10h>          <1> libeld "devices"
   989 0000EEC0 <bin E10h>          <1> libeld "dhm"
   990 0000FCD0 <bin 13C0h>         <1> libeld "di"
   991 00011090 <bin 1160h>         <1> libeld "dm"
   992 000121F0 <bin 840h>          <1> libeld "doscd"
   993 00012A30 <bin 16F0h>         <1> libeld "dosdir"
   994 00014120 <bin 840h>          <1> libeld "dosdrive"
   995 00014960 <bin 7F0h>          <1> libeld "dospwd"
   996 00015150 <bin C30h>          <1> libeld "dosseek"
   997 00015D80 <bin 1280h>         <1> libeld "dosspace"
   998 00017000 <bin AE0h>          <1> libeld "dosstrat"
   999 00017AE0 <bin 16B0h>         <1> libeld "dpb"
  1000 00019190 <bin 780h>          <1> libeld "dtadisp"
  1001 00019910 <bin E90h>          <1> libeld "dx"
  1002 0001A7A0 <bin E20h>          <1> libeld "errfix"
  1003 0001B5C0 <bin 1150h>         <1> libeld "extname"
  1004 0001C710 <bin CC0h>          <1> libeld "hint"
  1005 0001D3D0 <bin CB0h>          <1> libeld "hintoth"
  1006 0001E080 <bin BD0h>          <1> libeld "history"
  1007 0001EC50 <bin D40h>          <1> libeld "ifext"
  1008 0001F990 <bin BC0h>          <1> libeld "inject"
  1009 00020550 <bin E00h>          <1> libeld "instnoth"
  1010 00021350 <bin C50h>          <1> libeld "instnoun"
  1011 00021FA0 <bin C20h>          <1> libeld "kcmdline"
  1012 00022BC0 <bin 940h>          <1> libeld "kdisplay"
  1013 00023500 <bin 26C0h>         <1> libeld "ldmem"
  1014 00025BC0 <bin 2990h>         <1> libeld "ldmemoth"
  1015 00028550 <bin 10F0h>         <1> libeld "linfo"
  1016 00029640 <bin 23C0h>         <1> libeld "list"
  1017 0002BA00 <bin 11D0h>         <1> libeld "path"
  1018 0002CBD0 <bin 13D0h>         <1> libeld "printf"
  1019 0002DFA0 <bin B60h>          <1> libeld "quiet"
  1020 0002EB00 <bin C10h>          <1> libeld "quit"
  1021 0002F710 <bin B30h>          <1> libeld "rcexec"
  1022 00030240 <bin C10h>          <1> libeld "rdumpidx"
  1023 00030E50 <bin BE0h>          <1> libeld "rdumpstr"
  1024 00031A30 <bin 740h>          <1> libeld "reclaim"
  1025 00032170 <bin 1610h>         <1> libeld "reserve"
  1026 00033780 <bin A50h>          <1> libeld "rm"
  1027 000341D0 <bin F50h>          <1> libeld "rn"
  1028 00035120 <bin 15B0h>         <1> libeld "s"
  1029 000366D0 <bin C40h>          <1> libeld "sbranch"
  1030 00037310 <bin 12D0h>         <1> libeld "set"
  1031 000385E0 <bin F80h>          <1> libeld "tsc"
  1032 00039560 <bin EF0h>          <1> libeld "useparat"
  1033 0003A450 <bin F80h>          <1> libeld "variable"
  1034 0003B3D0 <bin C60h>          <1> libeld "withhdr"
  1035 0003C030 <bin 12B0h>         <1> libeld "x"
  1036                              <1> %endif
  1037                              <1> lib_end:
  1038                              <1> 
  1039                              <1> %ifn _COMPRESSLIB
  1040                              <1> %if _COMPRESSED
  1041                              <1> 	align 2, db 0
  1042                              <1> depack_saved_sp:	dw 0FFFFh
  1043                              <1> partialdepack:		db 0FFh
  1044                              <1> %endif
  1045                              <1> 
  1046                              <1> msg:
  1047                              <1> .ext_error_internal:	asciz "Internal error in EXT LIB command.",13,10
  1048                              <1> .ext_error_io:		asciz "EXT LIB command got I/O error.",13,10
  1049                              <1> .ext_error_invalid:	asciz "EXT LIB: No or invalid Extension for lDebug header.",13,10
  1050                              <1> .ext_error_oom:		asciz "Out of memory in EXT LIB command.",13,10
  1051                              <1> .notfound.1:		asciz 'EXT LIB: No ELD found by the name "'
  1052                              <1> .notfound.2:		asciz '"!',13,10
  1053                              <1> .notfound.invalid:	asciz "EXT LIB: No ELD found, invalid name!",13,10
  1054                              <1> .between:		asciz "  "
  1055                              <1> .nodesc:		db "No description."
  1056                              <1> .linebreak:		asciz 13,10
  1057                              <1> 
  1058                              <1> depack_stack: equ $
  1059                              <1> 
  1060                              <1> .unexpected_eol:	asciz "EXT LIB: Unexpected End Of Line, expected closing quote mark!",13,10
  1061                              <1> .help_keyword:		asciz "HELP"
  1062                              <1> .describe_keyword:	asciz "DESCRIBE"
  1063                              <1> .describex_keyword:	asciz "DESCRIBEX"
  1064                              <1> %if _COMPRESSED && _ELD_TEST_LIB
  1065                              <1> .test_keyword:		asciz "TEST"
  1066                              <1> %endif
  1067                              <1> .wide_keyword:		asciz "WIDE"
  1068                              <1> .help:			db "EXT LIB command. This ELD is a library of other ELDs.",13,10
  1069                              <1> 			db "Run with an ELD instance name to run another ELD.",13,10
  1070                              <1> 			db "Run with HELP DESCRIBE to dump descriptions (slow)",13,10
  1071                              <1> 			db " or with HELP WIDE to display only known ELD names (fast).",13,10
  1072                              <1> 			asciz
  1073                              <1> .list:			db 13,10
  1074                              <1> 			asciz "List of contained ELDs:",13,10
  1075                              <1> 
  1076                              <1> uinit_data: equ $
  1077                              <1> 
  1078                              <1> 	align 16, db 0
  1079                              <1> init_data_end:
  1080                              <1> data_size equ $ - datastart
  1081                              <1> transient_data_size equ data_size
  1082                              <1> 
  1083                              <1> %if _COMPRESSED
  1084                              <1> 	absolute depack_stack
  1085                              <1> 	alignb 2
  1086                              <1> 		resb 256
  1087                              <1> depack_stack.top:
  1088                              <1> 
  1089                              <1>  %if uinit_data > depack_stack.top
  1090                              <1> 	absolute uinit_data
  1091                              <1>  %endif
  1092                              <1> %else
  1093                              <1> 	absolute uinit_data
  1094                              <1> %endif
  1095                              <1> 
  1096                              <1> 	alignb 2
  1097                              <1> namebuffer:	resb 8
  1098                              <1> libseek:	resd 1
  1099                              <1> eldheader:	resd 1
  1100                              <1> 
  1101                              <1> %if _COMPRESSED
  1102                              <1> depackskip:	resd 1
  1103                              <1> depackseek:	resd 1
  1104                              <1> depacked_buffer:resd 1
  1105                              <1> depack_left_length:	resw 1
  1106                              <1> depack_left_address:	resw 1
  1107                              <1> depacked_length:resw 1
  1108                              <1> depack_prior_sp:resw 1
  1109                              <1> 	alignb 2
  1110                              <1> filebuffer:
  1111                              <1> %if _ALIGNPAGE
  1112                              <1> 	resb 512
  1113                              <1> %else
  1114                              <1> 	resb 256
  1115                              <1> %endif
  1116                              <1> .end:
  1117                              <1> 	alignb 2
  1118                              <1> .next:		resw 1
  1119                              <1> .tail:		resw 1
  1120                              <1> handle:		resw 1
  1121                              <1> 
  1122                              <1> 	alignb 16
  1123                              <1> resultbuffer:
  1124                              <1> .size equ 4096
  1125                              <1> 		resb .size
  1126                              <1> .end:
  1127                              <1> %endif
  1128                              <1> 
  1129                              <1> %if _DATABUFFER
  1130                              <1> 	alignb 16
  1131                              <1> databuffer:
  1132                              <1> 	resb 512
  1133                              <1> %endif
  1134                              <1> 
  1135                              <1> 	alignb 16
  1136                              <1> uinit_data_end:
  1137                              <1> 
  1138                              <1> %if uinit_data_end >= init_data_end
  1139                              <1>  total_data_size equ $ - datastart
  1140                              <1> %else
  1141                              <1>  total_data_size equ init_data_end - datastart
  1142                              <1> %endif
  1143                              <1> %assign _DATA_SIZE total_data_size
  1144                              <1> 
  1145                              <1> 	usesection CODE
  1146                              <1> 
  1147                              <1> %include "eldlink.asm"
  1148                              <1> 
  1149                              <1> 	align 16
  1150                              <1> code_size equ $ - code
  1151                              <1> 
  1152                              <1> %if _ALIGNPAGE
  1153                              <1> LIBOFFSETUNALIGNED equ DATAOFFSET + data_size
  1154                              <1> 	addsection ALIGNED, follows=DATA vstart=0
  1155                              <1> aligned:
  1156                              <1> 	times (((512) - ((LIBOFFSETUNALIGNED) % (512))) % (512)) db 0
  1157                              <1> 	endarea aligned
  1158                              <1> 
  1159                              <1> LIBOFFSET equ LIBOFFSETUNALIGNED + aligned_size
  1160                              <1> 	addsection LIB, follows=ALIGNED vstart=0
  1161                              <1> %else
  1162                              <1> LIBOFFSET equ DATAOFFSET + data_size
  1163                              <1> 	addsection LIB, follows=DATA vstart=0
  1164                              <1> %endif
  1165                              <1> lib_start:
  1166                              <1> 
  1167                              <1>  %if _COMPRESSED
  1168                              <1>   %if _XLD
  1169                              <1>    %if _LZEXEDAT
  1170                              <1> 	incbin "packlib.xlz"
  1171                              <1>    %else
  1172                              <1> 	incbin "packlib.xhs"
  1173                              <1>    %endif
  1174                              <1>   %else
  1175                              <1>    %if _LZEXEDAT
  1176                              <1> 	incbin "packlib.elz"
  1177                              <1>    %else
  1178                              <1> 	incbin "packlib.ehs"
  1179                              <1>    %endif
  1180                              <1>   %endif
  1181                              <1> lib_compressed_end:
  1182                              <1> length_to_truncate equ $ - lib_start + LIBOFFSET
  1183                              <1> 
  1184                              <1> 	align 16, db 0
  1185                              <1> 
  1186                              <1> 	addsection LIBDEPACKED, follows=LIB vstart=0
  1187                              <1> library_start_skip:
  1188                              <1>  %endif
  1189                              <1> 
  1190                              <1> dump_incbin INCBINLIST
  1191                              <1> library_end_skip:
  1192                              <1> 
  1193                              <1>  %if _COMPRESSED
  1194                              <1> 	dd length_to_truncate
  1195                              <1>  %endif
  1196                              <1> %endif
