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