     1                                  ;*********************************************************************
     2                                  ;*   MLSHARED.ASM                                                    *
     3                                  ;*                                                                   *
     4                                  ;*   By:            Michael Devore                                   *
     5                                  ;*   Date:          12/21/92                                         *
     6                                  ;*   Model:         Small                                            *
     7                                  ;*   Version:       2.5                                              *
     8                                  ;*   Assembler:     MASM 5.0                                         *
     9                                  ;*   Environment:   MS-DOS 2.x+                                      *
    10                                  ;*                                                                   *
    11                                  ;*   routines shared by pass one and pass two                        *
    12                                  ;*                                                                   *
    13                                  ;*********************************************************************
    14                                  
    15                                  ;TITLE   WARPLINK mlshared
    16                                  ;PAGE    50,80
    17                                  
    18                                  ;.MODEL  SMALL
    19                                  
    20                                  ;*****************************
    21                                  ;* Include files             *
    22                                  ;*****************************
    23                                  
    24                                  [list -]
    14                              <1> [list -]
    26                                  [list -]
    31                                  
    32                                  ;*****************************
    33                                  ;* Public declarations       *
    34                                  ;*****************************
    35                                  
    36                                  ; procedures
    37                                  PUBLIC  perform_pass,get_name,get_hash,load_file
    38                                  PUBLIC  error_bx_pos,error_read_buff_pos,get_curr_obj,print_link_info
    39                                  
    40                                  ; variables
    41                                  PUBLIC  filename,pass_number,obj_block_ptr
    42                                  PUBLIC  ems_first_avail,ems_pages_flushed,obj_handle
    43                                  
    44                                  ;*****************************
    45                                  ;* Data begins               *
    46                                  ;*****************************
    47                                  
    48                                  .DATA
    49                                  
    50                                  ;*****************************
    51                                  ;* External declarations     *
    52                                  ;*****************************
    53                                  
    54                                  ; variables
    55                                  EXTRN   lib_handle:WORD,lib_read_amt:WORD
    56                                  EXTRN	is_local:BYTE
    57                                  
    58                                  ; initialized local variables
    59                                  
    60                                  ; byte values
    61 00000000 00                      use_ems_maps    DB  0       ; nonzero if object modules are, or can be, mapped to EMS pages
    62 00000001 00                      EVEN
    63 00000002 00                      ems_pages_flushed   DB  0   ; nonzero if EMS pages flushed to make room for ovl, temp file
    64 00000003 00                      EVEN
    65                                  
    66                                  ; word values
    67 00000004 0400                    ems_first_avail DW  4       ; first available ems logical page -- updated as used
    68                                  
    69                                  .DATA?
    70                                  
    71                                  ; uninitialized local variables
    72                                  
    73                                  ; byte values
    74                                  EVEN                        ; maximize speed on 8086 and better
    75 00000000 <res 80h>               filename    DB  128 DUP (?) ; current object module file name
    76 00000080 ??                      pass_number DB  ?           ; number of pass
    77                                  
    78                                  ; word values
    79 00000081 ??                      EVEN
    80 00000082 ????                    obj_handle  DW  ?           ; handle of currently open object file
    81 00000084 ????                    obj_block_ptr   DW  ?       ; segment of current object module name block
    82 00000086 ????                    pos_in_list DW  ?           ; position to read name in object name block namelist
    83 00000088 ????                    ems_map_blk DW  ?           ; segment of block hold 4 word entries for each obj, with EMS page maps
    84                                  
    85                                  ;*****************************
    86                                  ;* Constant data             *
    87                                  ;*****************************
    88                                  
    89                                  .CONST
    90                                  
    91 00000000 17                      proctext_len    DB  proctext_stop-proc_text
    92 00000001 0D0A2A2A2A2050726F-     proc_text       DB  CR,LF,'*** Processing file: '
    92 0000000A 63657373696E672066-
    92 00000013 696C653A20         
    93                                  proctext_stop   equ   $
    94                                  
    95                                  string_.end:
    96 00000018 2E454E44                .:		db ".END"
    97                                  .size equ $ - .
    98                                  
    99                                  string_.amount:
   100 0000001C 2E414D4F554E54          .:		db ".AMOUNT"
   101                                  .size equ $ - .
   102                                  
   103 00000023 150D0A557365642077-     msg_used_prefix:counted 13,10,"Used wllist label: "
   103 0000002C 6C6C697374206C6162-
   103 00000035 656C3A20           
   104                                  
   105                                  data_modend:
   106 00000039 8A02000074              .:		db MODEND, 2, 0, 0, -(MODEND + 2 + 0 + 0)
   107                                  .size equ $ - .
   108                                  
   109                                  data_segdef_be_127:
   110 0000003E 98                      .:		db SEGDEF
   111 0000003F 0700                    		dw .size - 3
   112 00000041 48                      		db 48h		; WORD, PUBLIC
   113 00000042 0000                    .segmentlength:	dw 0
   114 00000044 00                      .segmentlname:	db 0
   115 00000045 01                      		db 1		; class name (empty)
   116 00000046 01                      		db 1		; overlay name (empty)
   117 00000047 00                      		db 0		; checksum
   118                                  .size equ $ - .
   119                                  
   120                                  data_segdef_ae_128:
   121 00000048 98                      .:		db SEGDEF
   122 00000049 0800                    		dw .size - 3
   123 0000004B 48                      		db 48h		; WORD, PUBLIC
   124 0000004C 0000                    .segmentlength:	dw 0
   125 0000004E 80                      		db 80h		; high 7 bits of segment name lname index
   126 0000004F 00                      .segmentlname:	db 0
   127 00000050 01                      		db 1		; class name (empty)
   128 00000051 01                      		db 1		; overlay name (empty)
   129 00000052 00                      		db 0		; checksum
   130                                  .size equ $ - .
   131                                  
   132                                  data_theadr:
   133 00000053 80                      .:		db THEADR
   134 00000054 0A00                    		dw .size - 3
   135 00000056 0828776C6C69737429      		counted "(wllist)"
   136 0000005F 00                      		db 0		; checksum
   137                                  .size equ $ - .
   138                                  
   139                                  
   140                                  ;*****************************
   141                                  ;* Code begins               *
   142                                  ;*****************************
   143                                  
   144                                  .CODE
   145                                  
   146                                  ;*****************************
   147                                  ;* External declarations     *
   148                                  ;*****************************
   149                                  
   150                                  ; procedures
   151                                  EXTRN   link_error:NEAR,dos_error:NEAR,alloc_memory:NEAR
   152                                  EXTRN   pass1_obj_proc:NEAR,pass2_obj_proc:NEAR
   153                                  EXTRN   load_buffer:NEAR,read_to_ems:NEAR
   154                                  EXTRN   decrypt:NEAR,setup_incinfo:NEAR,map_ems_page:NEAR,restore_ems_map:NEAR
   155                                  
   156                                  ;*****************************
   157                                  ;* PERFORM_PASS              *
   158                                  ;*****************************
   159                                  
   160                                  ; perform generic pass 1 and pass 2 object module processing, route to appropriate pass code
   161                                  ; al has number of linker pass (1 or 2) upon entry
   162                                  ; destroys all registers
   163                                  
   164                                  perform_pass    PROC    NEAR
   165 00000000 A2[8000]                    mov [pass_number],al      ; save pass number to memory variable
   166 00000003 8326[0000]00                and word [current_obj],0       ; init current object module number
   167 00000008 A1[0000]                    mov ax,[first_objblk_ptr]
   168 0000000B A3[8400]                    mov [obj_block_ptr],ax    ; init current block pointer to first block
   169                                  
   170                                  pp_loop:
   171 0000000E A1[0000]                    mov ax,[obj_count]        ; get total count of object modules
   172 00000011 3B06[0000]                  cmp ax,[current_obj]      ; end loop when current equals total
   173 00000015 7703                        ja  pp_getobj           ; more object modules
   174 00000017 E98F00                      jmp NEAR PTR pp_ret     ; all done
   175                                  
   176                                  pp_getobj:
   177 0000001A D006[0000]              	rol byte [is_wllist_enabled], 1
   178 0000001E 7311                    	jnc @F
   179 00000020 803E[8000]01                cmp byte [pass_number],1       ; see if pass one processing
   180 00000025 750A                        jne @F
   181 00000027 48                      	dec ax			; count minus 1
   182 00000028 3906[0000]              	cmp word [current_obj], ax
   183                                  				; is it last ?
   184 0000002C 7503                    	jne @F			; no -->
   185 0000002E E8F603                  	call process_wllist	; process before continuing
   186                                  @@:
   187 00000031 E87D01                      call    get_curr_obj    ; get current object module in filename
   188                                  
   189 00000034 31C0                        xor ax,ax
   190 00000036 A3[0000]                    mov WORD PTR [file_pos_adj],ax    ; init file position adjustment
   191 00000039 A3[0200]                    mov WORD PTR [file_pos_adj+2],ax
   192                                  
   193 0000003C E86B00                      call    print_link_info
   194                                  
   195                                  pp_2:
   196 0000003F 803E[8000]01                cmp byte [pass_number],1       ; see if pass one processing
   197 00000044 752A                        jne pp_pass2            ; no, assume pass two
   198                                  
   199 00000046 BA[0000]                    mov dx,OFFSET filename wrt DGROUP   ; DS:DX -> ASCIIZ file specification
   200 00000049 B8003D                      mov ax,3d00h            ; open file with read access
   201 0000004C CD21                        int 21h
   202 0000004E E8(0000)                    call    restore_ems_map
   203 00000051 7303                        jnc pp_noerr            ; no errors
   204 00000053 E9(0000)                    jmp NEAR PTR dos_error  ; error opening file
   205                                  
   206                                  pp_noerr:
   207 00000056 A3[8200]                    mov [obj_handle],ax       ; save object module file handle
   208 00000059 89C3                        mov bx,ax               ; save handle in bx
   209 0000005B E8(0000)                    call    load_buffer     ; load the file in the i/o buffer
   210                                  
   211 0000005E 803E[0000]00                cmp byte [is_clpinc],0         ; see if clipper incremental link specified
   212 00000063 7403                        je  pp_noinc            ; no
   213 00000065 E8(0000)                    call    setup_incinfo   ; setup incremental info for file
   214                                  
   215                                  pp_noinc:
   216 00000068 E8(0000)                    call    pass1_obj_proc  ; perform pass 1 object module processing
   217                                  
   218                                  ; if using EMS, check if can map out page(s) used by i/o buffer
   219 0000006B E86800                      call    ems_page_mapout
   220 0000006E EB27                        jmp SHORT pp_closefile  ; skip over pass 2 code
   221                                  
   222                                  pp_pass2:
   223                                  
   224                                  ; if using EMS, check if object modules have page(s) to map in
   225 00000070 E8F300                      call    ems_page_mapin
   226 00000073 08C0                        or  al,al               ; nonzero return if page was successfully mapped in
   227 00000075 7405                        je  pp_loadfile         ; not mapped in, load file
   228 00000077 E8(0000)                    call    pass2_obj_proc  ; perform pass 2 object module processing
   229 0000007A EB26                        jmp SHORT pp_bumpobj
   230                                  
   231                                  pp_loadfile:
   232 0000007C BA[0000]                    mov dx,OFFSET filename wrt DGROUP   ; DS:DX -> ASCIIZ file specification
   233 0000007F B8003D                      mov ax,3d00h            ; open file with read access
   234 00000082 CD21                        int 21h
   235 00000084 E8(0000)                    call    restore_ems_map
   236 00000087 7303                        jnc pp_noerr2           ; no errors
   237 00000089 E9(0000)                    jmp NEAR PTR dos_error  ; error opening file
   238                                  
   239                                  pp_noerr2:
   240 0000008C A3[8200]                    mov [obj_handle],ax       ; save object module file handle
   241 0000008F 89C3                        mov bx,ax               ; save handle in bx
   242 00000091 E8(0000)                    call    load_buffer     ; load the file in the i/o buffer
   243 00000094 E8(0000)                    call    pass2_obj_proc  ; perform pass 2 object module processing
   244                                  
   245                                  pp_closefile:
   246 00000097 8B1E[8200]                  mov bx,[obj_handle]       ; get file handle of open object module file
   247 0000009B B43E                        mov ah,3eh              ; close file
   248 0000009D CD21                        int 21h
   249 0000009F E8(0000)                    call    restore_ems_map
   250                                  
   251                                  pp_bumpobj:
   252 000000A2 FF06[0000]                  inc word [current_obj]         ; bump number of current object module
   253 000000A6 E965FF                      jmp NEAR PTR pp_loop    ; loop back for next object module
   254                                  
   255                                  pp_ret:
   256 000000A9 C3                          ret
   257                                  perform_pass    ENDP
   258                                  
   259                                  ;*****************************
   260                                  ;* PRINT_LINK_INFO           *
   261                                  ;*****************************
   262                                  
   263                                  ; print linker files being processed, if option set
   264                                  ; upon entry filename holds the file name
   265                                  ; destroys ax,bx,cx,dx,si
   266                                  
   267                                  print_link_info PROC
   268 000000AA 803E[0000]00                cmp byte [is_linkinfo],0       ; see if linker information to be printed
   269 000000AF 7424                        je  pli_ret             ; no
   270                                  
   271 000000B1 BB[0100]                    mov bx,OFFSET proc_text wrt DGROUP
   272 000000B4 8A4FFF                      mov cl,[bx-1]           ; get length of string to print
   273 000000B7 89DA                        mov dx,bx               ; ds:dx -> string
   274 000000B9 30ED                        xor ch,ch               ; zap high byte of cx
   275 000000BB BB0100                      mov bx,STDOUT           ; write to standard output device
   276 000000BE B440                        mov ah,40h              ; write to device
   277 000000C0 CD21                        int 21h
   278                                  
   279 000000C2 BE[0000]                    mov si,OFFSET filename wrt DGROUP   ; print chars in filename one at a time
   280                                  
   281                                  pli_filename:
   282 000000C5 89F2                        mov dx,si
   283 000000C7 AC                          lodsb                   ; get char from filename
   284 000000C8 08C0                        or  al,al               ; see if null terminator
   285 000000CA 7409                        je  pli_ret             ; done
   286 000000CC B90100                      mov cx,1
   287 000000CF B440                        mov ah,40h              ; write to device
   288 000000D1 CD21                        int 21h
   289 000000D3 EBF0                        jmp SHORT pli_filename
   290                                  
   291                                  pli_ret:
   292 000000D5 C3                          ret
   293                                  print_link_info ENDP
   294                                  
   295                                  ;*****************************
   296                                  ;* EMS_PAGE_MAPOUT           *
   297                                  ;*****************************
   298                                  
   299                                  ; map pages out to EMS if possible
   300                                  ; if first object module, allocate block to hold object module mapped out pages
   301                                  ; destroys ax,bx,cx,dx,si,di,es
   302                                  
   303                                  ems_page_mapout PROC
   304 000000D6 31C0                        xor ax,ax
   305 000000D8 3806[0000]                  cmp [is_no_ems],al        ; see if EMS used
   306 000000DC 750C                        jne eout_ret            ; no
   307                                  
   308 000000DE 3806[0000]                  cmp [any_ddl],al          ; see if DDL's used
   309 000000E2 7506                        jne eout_ret            ; yes
   310                                  
   311 000000E4 3806[0000]                  cmp [is_inlib],al         ; see if processing library
   312 000000E8 7401                        je  eout_1              ; no
   313                                  
   314                                  eout_ret:
   315 000000EA C3                          ret
   316                                  
   317                                  eout_1:
   318 000000EB 3906[0000]                  cmp [current_obj],ax      ; see if first object module (== 0)
   319 000000EF 7514                        jne eout_2              ; no
   320                                  
   321                                  ; first object module, each module will have 4 word entries to hold EMS pages
   322                                  eout_first:
   323 000000F1 8B1E[0000]                  mov bx,[obj_count]        ; get object module count
   324 000000F5 83C301                      add bx,1                ; round up for 8-byte to paragraph conversion
   325 000000F8 D1EB                        shr bx,1                ; bx holds paragraphs to allocate
   326 000000FA E8(0000)                    call    alloc_memory
   327 000000FD A3[8800]                    mov [ems_map_blk],ax      ; save segment of ems map block for object modules
   328 00000100 C606[0000]01                mov byte [use_ems_maps],1      ; set ems maps used flag
   329                                  
   330                                  eout_2:
   331 00000105 8B3E[0000]                  mov di,[current_obj]
   332 00000109 D1E7                        shl di,1
   333 0000010B D1E7                        shl di,1
   334 0000010D D1E7                        shl di,1                ; x8, di holds offset into ems map block for object module
   335 0000010F 8E06[8800]                  mov es,[ems_map_blk]      ; es:di -> proper obj ems map block entry
   336 00000113 B8FFFF                      mov ax,-1               ; init to all -1's to show unused
   337 00000116 AB                          stosw
   338 00000117 AB                          stosw
   339 00000118 AB                          stosw
   340 00000119 AB                          stosw                   ; all four entries init'ed
   341 0000011A 83EF08                      sub di,8                ; point es:di back to beginning of entry
   342                                  
   343 0000011D A1[0000]                    mov ax,WORD PTR [file_pos_adj]
   344 00000120 0B06[0200]                  or  ax,WORD PTR [file_pos_adj+2]  ; see if buffer wrapped
   345 00000124 75C4                        jne eout_ret            ; yes, more than 4 pages used, cannot map out
   346 00000126 B90100                      mov cx,1                ; init count of pages to map out
   347                                  
   348                                  ; si holds final byte used+1, used to compute number of pages to map out
   349                                  eout_loop:
   350 00000129 81EE0040                    sub si,16384            ; back off one page
   351 0000012D 7603                        jbe eout_3              ; si ended on this page
   352 0000012F 41                          inc cx                  ; bump count of pages to map out
   353 00000130 EBF7                        jmp SHORT eout_loop     ; loop for next page check
   354                                  
   355                                  eout_3:
   356 00000132 833E[0000]04                cmp word [ems_page_avail],4    ; must have over four free pages
   357 00000137 76B1                        jbe eout_ret            ; not enough
   358                                  
   359 00000139 A1[0000]                    mov ax,[ems_page_avail]   ; get count of free pages
   360 0000013C 83E804                      sub ax,4                ; back off four free pages
   361 0000013F 29C8                        sub ax,cx               ; see if enough free pages to save this obj in ems
   362 00000141 72A7                        jc  eout_ret            ; no
   363                                  
   364                                  ; map obj to ems pages, bring in free pages
   365 00000143 83C004                      add ax,4                ; adjust back for four free pages
   366 00000146 A3[0000]                    mov [ems_page_avail],ax   ; save new count of free pages
   367                                  
   368 00000149 89C8                        mov ax,cx               ; save count of pages mapped out
   369 0000014B BE[0000]                    mov si,OFFSET ems_currmap wrt DGROUP    ; ds:si -> physical page entries
   370 0000014E F3A5                        rep movsw               ; move all used physical pages
   371                                  
   372 00000150 89C1                        mov cx,ax               ; restore count of pages mapped out
   373 00000152 30C0                        xor al,al
   374                                  
   375                                  eout_loop2:
   376 00000154 50                          push    ax              ; save physical page
   377 00000155 8B1E[0400]                  mov bx,[ems_first_avail]  ; map in first available free page
   378 00000159 FF06[0400]                  inc word [ems_first_avail]     ; bump first available page
   379 0000015D E8(0000)                    call    map_ems_page
   380 00000160 58                          pop ax                  ; restore physical page
   381 00000161 FEC0                        inc al                  ; bump physical page
   382 00000163 E2EF                        loop    eout_loop2      ; loop until all free pages are mapped in
   383                                  
   384 00000165 C3                          ret
   385                                  ems_page_mapout ENDP
   386                                  
   387                                  ;*****************************
   388                                  ;* EMS_PAGE_MAPIN            *
   389                                  ;*****************************
   390                                  
   391                                  ; returns al==0 if cannot map in from EMS, nonzero if page mapped from
   392                                  ; EMS and no file load required
   393                                  ; destroys ax,bx,cx,dx,si,es
   394                                  
   395                                  ems_page_mapin  PROC
   396 00000166 803E[0000]00                cmp byte [is_no_ems],0         ; see if EMS used
   397 0000016B 7541                        jne ein_usefile         ; no
   398                                  
   399 0000016D 803E[0000]00                cmp byte [is_inlib],0          ; see if processing library
   400 00000172 753A                        jne ein_usefile         ; yes
   401                                  
   402 00000174 803E[0000]00                cmp byte [use_ems_maps],0      ; see if EMS maps used
   403 00000179 7433                        je  ein_usefile         ; no
   404                                  
   405 0000017B 803E[0200]00                cmp byte [ems_pages_flushed],0 ; see if EMS pages flushed to store ovl, temporary file
   406 00000180 752C                        jne ein_usefile         ; yes
   407                                  
   408                                  ; it may be possible to map in page from EMS, check status
   409 00000182 8B36[0000]                  mov si,[current_obj]
   410 00000186 D1E6                        shl si,1
   411 00000188 D1E6                        shl si,1
   412 0000018A D1E6                        shl si,1                ; x8, si holds offset into ems map block for object module
   413 0000018C 8E06[8800]                  mov es,[ems_map_blk]      ; es:si -> proper obj ems map block entry
   414 00000190 30C9                        xor cl,cl               ; cl holds physical page
   415                                  
   416                                  ein_loop:
   417 00000192 26AD                        es lodsw   ; get map page
   418 00000194 83F8FF                      cmp ax,-1               ; see if not used (if not used, then no following ones are either)
   419 00000197 740E                        je  ein_chksuccess      ; not used
   420 00000199 89C3                        mov bx,ax               ; get logical page in bx
   421 0000019B 88C8                        mov al,cl               ; get physical page in al
   422 0000019D E8(0000)                    call    map_ems_page    ; map in used pages
   423 000001A0 FEC1                        inc cl                  ; bump physical page
   424 000001A2 80F904                      cmp cl,4                ; see if all physical pages mapped
   425 000001A5 72EB                        jb  ein_loop            ; not yet
   426                                  
   427                                  ein_chksuccess:
   428 000001A7 08C9                        or  cl,cl               ; if cl is zero then no pages mapped, not successful
   429 000001A9 7403                        je  ein_usefile         ; no pages mapped in
   430                                  
   431                                  ; at least one page mapped in, success
   432 000001AB B001                        mov al,1                ; return one to show success
   433 000001AD C3                          ret
   434                                  
   435                                  ein_usefile:
   436 000001AE 30C0                        xor al,al               ; return zero to show must load buffer from file
   437 000001B0 C3                          ret
   438                                  ems_page_mapin  ENDP
   439                                  
   440                                  ;*****************************
   441                                  ;* GET_CURR_OBJ              *
   442                                  ;*****************************
   443                                  
   444                                  ; get current object module name in filename
   445                                  ; destroys ax,si,di,es
   446                                  
   447                                  get_curr_obj    PROC
   448 000001B1 833E[0000]00                cmp word [current_obj],0       ; see if first object file, requires position initialization
   449 000001B6 7506                        jne gco_2               ; nope
   450                                  
   451                                  gco_5:
   452 000001B8 C706[8600]0400              mov word [pos_in_list],4       ; init position in name list to first position in block
   453                                  
   454                                  gco_2:
   455 000001BE 8B36[8600]                  mov si,[pos_in_list]      ; si will offset into block
   456 000001C2 A1[8400]                    mov ax,[obj_block_ptr]    ; get current object name block
   457 000001C5 8EC0                        mov es,ax               ; point extra segment at object name block
   458 000001C7 B81002                      mov ax,OBJ_NAMBLK_BYSIZE    ; size of block in bytes
   459 000001CA 262B060000                  sub ax,[es:0]           ; minus free space, ax == end of used namelist
   460 000001CF 39F0                        cmp ax,si               ; check that position in list is below end
   461 000001D1 7714                        ja  gco_3               ; not at end yet, pull name from this block's namelist
   462                                  
   463 000001D3 26A10200                    mov ax,[es:2]           ; get pointer to next block
   464 000001D7 A3[8400]                    mov [obj_block_ptr],ax    ; save back to memory variable
   465 000001DA 09C0                        or  ax,ax               ; check that is not null
   466 000001DC 75DA                        jne gco_5               ; non-null, next block exists, loop back and try with it
   467                                  
   468                                  ; A WarpLink internal error has occurred, no more object names were
   469                                  ; available before the count of all object modules was complete
   470 000001DE B80000                      mov ax,INTERNAL_ERR     ; put warplink error code in ax
   471 000001E1 B90200                      mov cx,2                ; internal error value
   472 000001E4 E9(0000)                    jmp NEAR PTR link_error ; transfer control to error handler
   473                                  
   474                                  gco_3:
   475 000001E7 26AC                    	es lodsb	; get flag byte
   476 000001E9 24C0                        and al,0c0h             ; only get overlay bits
   477 000001EB A2[0000]                    mov [obj_ovl_flag],al     ; save overlay status for module
   478 000001EE 2440                        and al,40h              ; get nonvector root call status
   479 000001F0 A2[0000]                    mov [nonovl_rvect],al     ; save it to global variable
   480 000001F3 8CC7                        mov di,es               ; get object name block segment in di
   481 000001F5 8CD8                        mov ax,ds
   482 000001F7 8EC0                        mov es,ax               ; es -> warplink data area
   483 000001F9 8EDF                        mov ds,di               ; ds -> object name block
   484 000001FB BF[0000]                    mov di,OFFSET filename wrt DGROUP   ; es:di -> destination of object module name
   485                                  
   486                                  gco_6:
   487 000001FE A4                          movsb                   ; transfer a char from the block to filename
   488 000001FF 807CFF00                    cmp BYTE PTR [si-1],0   ; zero byte signals end of transfer
   489 00000203 75F9                        jne gco_6               ; nonzero, keep looping
   490                                  
   491 00000205 8CC0                        mov ax,es
   492 00000207 8ED8                        mov ds,ax               ; ds -> warplink data
   493                                  
   494 00000209 8936[8600]                  mov [pos_in_list],si      ; si points to next name or end, save back to memory
   495 0000020D C3                          ret
   496                                  get_curr_obj    ENDP
   497                                  
   498                                  ;*****************************
   499                                  ;* GET_NAME                  *
   500                                  ;*****************************
   501                                  
   502                                  ; es:si -> string upon entry
   503                                  ; ds:di -> warplink data location to place string
   504                                  ; bp == buffer end (buffer_end)
   505                                  ; cx == length of current record
   506                                  ; is_local nonzero if local variable (mangle name to unique)
   507                                  ; destroys ax,dx,di
   508                                  ; updates si to point past string
   509                                  ; updates cx to record length after string
   510                                  
   511                                  get_name        PROC
   512 0000020E 89CA                        mov dx,cx               ; save object record length in dx
   513 00000210 268A0C                      mov cl,[es:si]          ; get 1-byte length of name
   514 00000213 30ED                        xor ch,ch               ; zap high byte
   515 00000215 51                          push    cx              ; save number of bytes to transfer
   516 00000216 46                          inc si                  ; point to first char of name
   517 00000217 4A                          dec dx                  ; decrement record length to parse
   518 00000218 E34B                        jcxz    gn_out          ; zero length name, no name chars to transfer
   519 0000021A 39EE                        cmp si,bp               ; check boundary conditions
   520 0000021C 7357                        jae gn_load1            ; out of bounds
   521                                  
   522                                  gn_1:
   523 0000021E 803E[0000]00                cmp byte [is_casesense],0      ; check to see if string should go to all caps
   524 00000223 8CC0                        mov ax,es
   525 00000225 8ED8                        mov ds,ax
   526 00000227 B8[ssss]                    mov ax,DGROUP
   527 0000022A 8EC0                        mov es,ax               ; swap es and ds for string operations
   528 0000022C 741D                        je  gn_5                ; not case sensitive, convert string to caps
   529                                  
   530                                  %IFNDEF DEMO
   531 0000022E 89F0                        mov ax,si
   532 00000230 01C8                        add ax,cx               ; get final char position of string
   533 00000232 720E                        jc  gn_3                ; overflow, buffer end will be reached during transfer
   534 00000234 39E8                        cmp ax,bp
   535 00000236 730A                        jae gn_3                ; buffer end will be reached during transfer
   536                                  
   537                                  ; names are case sensitive, no alteration (to all caps) of chars occurs
   538                                  ; buffer end will not be reached during transfer
   539                                  ; this allows a straight REP MOVS memory move
   540 00000238 D1E9                        shr cx,1                ; convert to words
   541 0000023A F3A5                        rep movsw               ; move the string
   542 0000023C D1D1                        rcl cx,1                ; pick up carry
   543 0000023E F3A4                        rep movsb               ; transfer leftover byte, if any
   544 00000240 EB1B                        jmp SHORT gn_seg_restore    ; bypass char by char transfer code
   545                                  
   546                                  ; transfer to destination, case sensitive, buffer end reached sometime during transfer
   547                                  gn_3:
   548 00000242 A4                          movsb                   ; transfer a byte
   549 00000243 39EE                        cmp si,bp               ; check boundary conditions
   550 00000245 7338                        jae gn_load3            ; out of bounds
   551                                  
   552                                  gn_4:
   553 00000247 E2F9                        loop    gn_3            ; loop back for next char transfer
   554 00000249 EB12                        jmp SHORT gn_seg_restore
   555                                  %ENDIF
   556                                  
   557                                  ; case insensitive, convert lowercase to upper, check for boundary conditions
   558                                  gn_5:
   559 0000024B AC                          lodsb                   ; get byte to transfer
   560 0000024C 3C61                        cmp al,'a'              ; check lowercase lower boundary
   561 0000024E 7206                        jb  gn_6                ; not a lowercase letter
   562 00000250 3C7A                        cmp al,'z'              ; check lowercase upper boundary
   563 00000252 7702                        ja  gn_6                ; not a lowercase letter
   564 00000254 2C20                        sub al,20h              ; convert to uppercase
   565                                  
   566                                  gn_6:
   567 00000256 AA                          stosb                   ; transfer char
   568 00000257 39EE                        cmp si,bp               ; check boundary conditions
   569 00000259 731F                        jae gn_load2            ; out of bounds
   570                                  
   571                                  gn_7:
   572 0000025B E2EE                        loop    gn_5            ; loop back for next char transfer
   573                                  
   574                                  gn_seg_restore:
   575 0000025D 8CC0                        mov ax,es
   576 0000025F 8CD9                        mov cx,ds
   577 00000261 8ED8                        mov ds,ax               ; restore ds -> warplink data
   578 00000263 8EC1                        mov es,cx               ; restore es
   579                                  
   580                                  ; 12/22/92
   581                                  gn_out:
   582 00000265 803E[0000]00            	cmp	byte [is_local],0			; see if local variable
   583 0000026A 7518                    	jne	gn_local			; yes
   584                                  
   585                                  gn_nullit:
   586 0000026C C60500                      mov BYTE PTR [di],0     ; null terminate the destination string
   587 0000026F 89D1                        mov cx,dx               ; restore remaining record length to cx
   588 00000271 58                          pop ax                  ; get bytes transferred
   589 00000272 29C1                        sub cx,ax               ; update record length
   590 00000274 C3                          ret
   591                                  
   592                                  gn_load1:
   593 00000275 E86000                      call    load_file       ; load next portion of file into buffer, at end position
   594 00000278 EBA4                        jmp SHORT gn_1
   595                                  
   596                                  gn_load2:
   597 0000027A E85B00                      call    load_file
   598 0000027D EBDC                        jmp SHORT gn_7
   599                                  
   600                                  %IFNDEF DEMO
   601                                  gn_load3:
   602 0000027F E85600                      call    load_file
   603 00000282 EBC3                        jmp SHORT gn_4
   604                                  %ENDIF
   605                                  
   606                                  ; 12/22/92
   607                                  ; local variable, mangle name by adding unique identifier at end
   608                                  gn_local:
   609 00000284 803E[0000]00            	cmp	byte [is_inlib],0			; see if processing library
   610 00000289 7516                    	jne	gn_loclib			; yes
   611                                  
   612                                  ; mangle based on current_obj word variable, set high word to 4001h
   613 0000028B A1[0000]                	mov	ax,[current_obj]		; (current_obj << 1) | 0x8001
   614 0000028E D1E0                    	shl	ax,1
   615 00000290 0D0180                  	or	ax,8001h
   616 00000293 8905                    	mov	[di],ax
   617 00000295 83C702                  	add	di,2
   618 00000298 C7050140                	mov	word [di],4001h
   619 0000029C 83C702                  	add	di,2
   620 0000029F EBCB                    	jmp	SHORT gn_nullit
   621                                  
   622                                  ; mangle based on lib_id dword variable
   623                                  gn_loclib:
   624 000002A1 52                      	push	dx
   625 000002A2 A1[0000]                	mov	ax,WORD PTR [lib_id]
   626 000002A5 8B16[0200]              	mov	dx,WORD PTR [lib_id+2]
   627 000002A9 D1E0                    	shl	ax,1
   628 000002AB D1D2                    	rcl	dx,1				; high word picks up rolled off high bit low word
   629 000002AD D1E2                    	shl	dx,1
   630 000002AF 0D0180                  	or	ax,8001h
   631 000002B2 8905                    	mov	[di],ax
   632 000002B4 83C702                  	add	di,2
   633 000002B7 81CA0180                	or	dx,08001h			; set high bit with libraries
   634 000002BB 8915                    	mov	[di],dx
   635 000002BD 83C702                  	add	di,2
   636 000002C0 5A                      	pop	dx
   637 000002C1 EBA9                    	jmp	SHORT gn_nullit
   638                                  
   639                                  get_name        ENDP
   640                                  
   641                                  ;*****************************
   642                                  ;* GET_HASH                  *
   643                                  ;*****************************
   644                                  
   645                                  ; returns 10-bit hashcode value in ax
   646                                  ; ds:si -> string upon entry
   647                                  ; destroys ax,si
   648                                  
   649                                  get_hash    PROC    NEAR
   650 000002C3 52                          push    dx              ; save critical registers
   651 000002C4 31D2                        xor dx,dx               ; dx==hashcode, init to zero
   652 000002C6 88D4                        mov ah,dl               ; zero high byte of char value
   653                                  
   654                                  gh_2:
   655 000002C8 AC                          lodsb                   ; get char from string
   656 000002C9 08C0                        or  al,al               ; check for null terminator in string
   657 000002CB 7404                        je  gh_out              ; hashcode computed
   658 000002CD 01C2                        add dx,ax               ; add in character value byte, ignore overflow
   659 000002CF EBF7                        jmp SHORT gh_2          ; loop until end of string
   660                                  
   661                                  gh_out:
   662 000002D1 89D0                        mov ax,dx               ; ax = hashcode
   663 000002D3 25FF03                      and ax,03ffh            ; make 10-bit value
   664 000002D6 5A                          pop dx
   665 000002D7 C3                          ret
   666                                  get_hash    ENDP
   667                                  
   668                                  ;*****************************
   669                                  ;* LOAD_FILE                 *
   670                                  ;*****************************
   671                                  
   672                                  ; load next chunk of file containing object records into file buffer
   673                                  ; updates si to point to first read in char
   674                                  ; updates bp to point to new buffer_tail
   675                                  ; destroys no other registers
   676                                  
   677                                  load_file   PROC
   678 000002D8 50                          push    ax              ; save critical registers
   679 000002D9 53                          push    bx
   680 000002DA 51                          push    cx
   681 000002DB 52                          push    dx
   682 000002DC 1E                          push    ds
   683 000002DD B8[ssss]                    mov ax,DGROUP
   684 000002E0 8ED8                        mov ds,ax               ; ds -> warplink data
   685 000002E2 3B36[0000]                  cmp si,[buffer_end]       ; see if buffer end overflow or buffer tail overflow
   686 000002E6 736A                        jae lf_3                ; buffer end overflow
   687                                  
   688                                  ; current buffer position >= buffer_tail and <= buffer_end
   689 000002E8 A1[0000]                    mov ax,[buffer_tail]
   690 000002EB 803E[0000]00                cmp byte [prev_flag],0         ; see if previous record needs to be preserved
   691 000002F0 7406                        je  lf_2                ; no
   692 000002F2 3B06[0000]                  cmp ax,[prev_read_ptr]    ; see if tail is at previous record position
   693 000002F6 7468                        je  lf_mem              ; yes, out of memory
   694                                  
   695                                  lf_2:
   696 000002F8 A3[0000]                    mov [buffer_head],ax      ; update buffer head to old buffer tail
   697 000002FB A1[0000]                    mov ax,[buffer_end]       ; get buffer end as new tail position
   698 000002FE 803E[0000]00                cmp byte [prev_flag],0         ; see if need to save previous record
   699 00000303 7411                        je  lf_2a               ; no
   700 00000305 8B1E[0000]                  mov bx,[prev_read_ptr]
   701 00000309 3B1E[0000]                  cmp bx,[buffer_head]      ; check previous record position against buffer head
   702 0000030D 7207                        jb  lf_2a               ; below buffer head, no overwrite problem
   703 0000030F 39C3                        cmp bx,ax               ; check previous record position against new tail position
   704 00000311 7303                        jae lf_2a               ; above or equal to buffer tail, no overwrite
   705 00000313 A1[0000]                    mov ax,[prev_read_ptr]    ; set tail so that previous record won't be overwritten
   706                                  
   707                                  lf_2a:
   708 00000316 803E[0000]00                cmp byte [is_inlib],0          ; see if processing library
   709 0000031B 7433                        je  to_lf_shared        ; no
   710 0000031D 803E[0000]01                cmp byte [udl_proc_pass],1     ; see if udl processing
   711 00000322 7407                        je  lf_noddl            ; yes
   712 00000324 803E[0000]00                cmp byte [any_ddl],0           ; see if creating/using DLL (all libraries treated as object modules)
   713 00000329 7525                        jne to_lf_shared		; yes
   714                                  
   715                                  lf_noddl:
   716 0000032B BB0010                      mov bx,LIB_MAX_READ
   717 0000032E 011E[0000]                  add [lib_read_amt],bx     ; reread on same library module, bump amount read this time by LIB_MAX_READ bytes
   718 00000332 7208                    	jc	lf_overflow			; can't read that much
   719 00000334 813E[0000]00FF          	cmp	word [lib_read_amt],0ff00h	; see if past max buffer
   720 0000033A 7604                    	jbe	lf_2b				; no
   721                                  
   722                                  lf_overflow:
   723 0000033C 291E[0000]              	sub	[lib_read_amt],bx		; adjust back
   724                                  
   725                                  lf_2b:
   726 00000340 8B1E[0000]                  mov bx,[buffer_tail]      ; get old buffer tail
   727 00000344 031E[0000]                  add bx,[lib_read_amt]     ; add maximum buffer read for library
   728 00000348 726F                        jc  lf_shared           ; overflow, new tail position won't exceed lib_read_amt from old tail position
   729 0000034A 39D8                        cmp ax,bx               ; see if new tail position is more than lib_read_amt from old position
   730 0000034C 766B                        jbe lf_shared           ; no
   731 0000034E 89D8                        mov ax,bx               ; use lib_read_amt from old tail position as new tail instead
   732                                  
   733                                  to_lf_shared:
   734 00000350 EB67                        jmp SHORT lf_shared     ; jump to shared code
   735                                  
   736                                  ; current buffer position >=buffer_end
   737                                  lf_3:
   738 00000352 803E[0000]00                cmp byte [prev_flag],0         ; see if previous record needs to be preserved
   739 00000357 740D                        je  lf_4                ; no
   740 00000359 833E[0000]00                cmp word [prev_read_ptr],0     ; see if previous record started at beginning of file buffer
   741 0000035E 7506                        jne lf_4                ; no
   742                                  
   743                                  ; previous record must be preserved and takes up remaining file buffer, out of memory
   744                                  lf_mem:
   745 00000360 B80800                      mov ax,8                ; force DOS out of memory error
   746 00000363 E9(0000)                    jmp NEAR PTR dos_error
   747                                  
   748                                  lf_4:
   749 00000366 A1[0000]                    mov ax,[buffer_end]       ; add buffer end to file position adjustment variable
   750 00000369 0106[0000]                  add WORD PTR [file_pos_adj],ax    ; update low word
   751 0000036D 8316[0200]00                adc WORD [file_pos_adj+2],0   ; carry to high word
   752 00000372 C706[0000]0000              mov word [buffer_head],0       ; set buffer head to physical beginning of buffer
   753 00000378 A1[0000]                    mov ax,[read_buff_ptr]    ; get current beginning of record as new tail position
   754                                  
   755 0000037B 803E[0000]00                cmp byte [prev_flag],0         ; see if previous record used
   756 00000380 7403                        je  lf_5                ; no
   757 00000382 A1[0000]                    mov ax,[prev_read_ptr]    ; use previous record position as tail
   758                                  
   759                                  lf_5:
   760 00000385 803E[0000]00                cmp byte [is_inlib],0          ; see if processing library
   761 0000038A 742D                        je  lf_shared           ; no
   762 0000038C 803E[0000]01                cmp byte [udl_proc_pass],1     ; see if udl processing
   763 00000391 7407                        je  lf_noddl2           ; yes
   764 00000393 803E[0000]00                cmp byte [any_ddl],0           ; see if creating/using DLL (all libraries treated as object modules)
   765 00000398 751F                        jne lf_shared           ; yes
   766                                  
   767                                  lf_noddl2:
   768 0000039A BB0010                      mov bx,LIB_MAX_READ
   769 0000039D 011E[0000]                  add [lib_read_amt],bx     ; reread on same library module, bump amount read this time by LIB_MAX_READ bytes
   770 000003A1 7208                    	jc	lf_overflow2		; can't read that much
   771 000003A3 813E[0000]00FF          	cmp	word [lib_read_amt],0ff00h	; see if past max buffer
   772 000003A9 7604                    	jbe	lf_5b				; no
   773                                  
   774                                  lf_overflow2:
   775 000003AB 291E[0000]              	sub	[lib_read_amt],bx		; adjust back
   776                                  
   777                                  lf_5b:
   778 000003AF 8B1E[0000]                  mov bx,[lib_read_amt]     ; get maximum tail for library
   779 000003B3 39D8                        cmp ax,bx               ; see if new tail position is more than lib_read_amt from buffer start (at 0)
   780 000003B5 7602                        jbe lf_shared           ; no
   781 000003B7 89D8                        mov ax,bx               ; use lib_read_amt from buffer start (at 0) as new tail
   782                                  
   783                                  lf_shared:
   784 000003B9 A3[0000]                    mov [buffer_tail],ax      ; update buffer tail
   785 000003BC 89C5                        mov bp,ax               ; update buffer_tail bp register value
   786 000003BE 2B06[0000]                  sub ax,[buffer_head]      ; get difference between head and tail for bytes to load
   787 000003C2 803E[0000]00                cmp byte [is_inlib],0          ; see if processing library
   788 000003C7 7406                        je  lf_7                ; no
   789 000003C9 8B1E[0000]                  mov bx,[lib_handle]       ; use library file handle
   790 000003CD EB04                        jmp SHORT lf_8
   791                                  
   792                                  lf_7:
   793 000003CF 8B1E[8200]                  mov bx,[obj_handle]       ; use object module handle
   794                                  
   795                                  lf_8:
   796 000003D3 89C1                        mov cx,ax               ; get number of bytes to read
   797 000003D5 8B16[0000]                  mov dx,[buffer_head]
   798 000003D9 89D6                        mov si,dx               ; update si -> first read in char
   799 000003DB A1[0000]                    mov ax,[buffer_base]
   800 000003DE 1E                          push    ds
   801 000003DF 8ED8                        mov ds,ax               ; ds:dx -> buffer area to load into
   802                                  
   803 000003E1 E8(0000)                    call    read_to_ems     ; read file, transfer to EMS if necessary
   804                                  
   805 000003E4 1F                          pop ds
   806                                  
   807                                  lf_ret:
   808 000003E5 E8(0000)                    call    decrypt         ; decrypt if SmartMem library
   809 000003E8 39C1                        cmp cx,ax               ; see if all bytes were read
   810 000003EA 7405                        je  lf_ret2             ; yes
   811                                  
   812 000003EC C606[0000]01                mov byte [eof_flag],1          ; set end of file flag
   813                                  
   814                                  lf_ret2:
   815 000003F1 1F                          pop ds                  ; restore critical registers
   816 000003F2 5A                          pop dx
   817 000003F3 59                          pop cx
   818 000003F4 5B                          pop bx
   819 000003F5 58                          pop ax
   820 000003F6 C3                          ret
   821                                  load_file   ENDP
   822                                  
   823                                  ;*****************************
   824                                  ;* ERROR_BX_POS              *
   825                                  ;*****************************
   826                                  
   827                                  ; linker error, file position of error in bx
   828                                  ; terminates WarpLink, all non-error reporting registers are trashable
   829                                  ; ax holds error code upon entry
   830                                  ; cx holds associated error value, if any
   831                                  ; ds:dx -> file name
   832                                  
   833                                  error_bx_pos    PROC
   834 000003F7 39DE                        cmp si,bx               ; check if si is less than bx (buffer wrapped)
   835 000003F9 730D                        jae er_2                ; no
   836                                  
   837                                  ; back buffer_end bytes off of file_pos_adj, error occurred before buffer wrap
   838 000003FB 8B3E[0000]                  mov di,[buffer_end]
   839 000003FF 293E[0000]                  sub WORD PTR [file_pos_adj],di    ; update low word
   840 00000403 831E[0200]00                sbb WORD [file_pos_adj+2],0   ; borrow to high word
   841                                  
   842                                  er_2:
   843 00000408 89DE                        mov si,bx               ; get proper record offset
   844 0000040A E9(0000)                    jmp NEAR PTR link_error ; transfer control to error handler
   845                                  error_bx_pos    ENDP
   846                                  
   847                                  ;*****************************
   848                                  ;* ERROR_READ_BUFF_POS       *
   849                                  ;*****************************
   850                                  
   851                                  ; linker error, file position of error in read_buff_ptr
   852                                  ; terminates WarpLink, all non-error reporting registers are trashable
   853                                  ; ax holds error code upon entry
   854                                  ; cx holds associated error value, if any
   855                                  ; ds:dx -> file name
   856                                  
   857                                  error_read_buff_pos PROC
   858 0000040D 3B36[0000]                  cmp si,[read_buff_ptr]    ; check if si is less than read_buff_ptr (buffer wrapped)
   859 00000411 730D                        jae erb_2               ; no
   860                                  
   861                                  ; back buffer_end bytes off of file_pos_adj, error occurred before buffer wrap
   862 00000413 8B3E[0000]                  mov di,[buffer_end]
   863 00000417 293E[0000]                  sub WORD PTR [file_pos_adj],di    ; update low word
   864 0000041B 831E[0200]00                sbb WORD [file_pos_adj+2],0   ; borrow to high word
   865                                  
   866                                  erb_2:
   867 00000420 8B36[0000]                  mov si,[read_buff_ptr]    ; get proper record offset
   868 00000424 E9(0000)                    jmp NEAR PTR link_error ; transfer control to error handler
   869                                  error_read_buff_pos ENDP
   870                                  
   871                                  
   872                                  process_wllist:
   873                                  	lframe
   874                                  	lvar dword, seektemp
   875                                  	lvar dword, seektempinner
   876                                  	lvar fromwords(words(TEMPWLLIST_size)), buffer
   877                                  	lvar word, length
   878                                  	lvar word, nextfield
   879                                  	lequ ?nextfield, repeatseen
   880                                  	lvar word, lnameslength
   881                                  	lequ ?lnameslength, collectfunction
   882                                  	lvar word, currentindex
   883                                  	lequ ?currentindex, ledataremaining
   884                                  	lvar word, segmentlname
   885                                  	lequ ?segmentlname, ledatabase
   886                                  	lvar word, lnamemustexist
   887                                  	lequ ?lnamemustexist, ledatadone
   888                                  	lvar dword, seeklname
   889                                  	lvar word, behindpartialrecord
   890                                  	lvar word, ledata_next_offset
   891                                  	lvar word, ledata_end_offset
   892                                  	lvar word, ledata_skip_repeated
   893 00000427 5589E58D66D6            	lenter
   894 0000042D 1E                      	push ds
   895 0000042E 07                      	pop es			; => DGROUP
   896 0000042F 31C0                    	xor ax, ax
   897 00000431 A3[0000]                    mov word [buffer_head], ax       ; set buffer head equal to offset zero from buffer base
   898 00000434 A1[0000]                    mov ax,[buffer_end]       ; get physical end of buffer
   899 00000437 3D2A02                      cmp ax, TEMPSTRINGWLLIST_size + GRPDEFBUFFER_size + 32
   900 0000043A 7309                        jae @F
   901 0000043C B91A00                      mov cx,26                ; internal error value
   902                                  .internal:
   903 0000043F B80000                      mov ax,INTERNAL_ERR     ; put warplink error code in ax
   904 00000442 E9(0000)                    jmp NEAR PTR link_error ; transfer control to error handler
   905                                  
   906                                  @@:
   907                                      ; mov [buffer_tail],ax      ; set tail to physical end of buffer
   908                                  
   909 00000445 BA[5300]                	mov dx, data_theadr
   910 00000448 B90D00                  	mov cx, data_theadr.size
   911 0000044B E8410D                  	call .checksum_dsdx
   912 0000044E E8DA0D                  	call .writeobj_dsdx
   913                                  
   914                                   extern data_coment
   915                                   extern data_coment.size
   916 00000451 BA[0000]                	mov dx, data_coment
   917 00000454 B9[0000]                	mov cx, data_coment.size
   918 00000457 E8350D                  	call .checksum_dsdx
   919 0000045A E8CE0D                  	call .writeobj_dsdx
   920                                  
   921 0000045D E8A301                  	call .prepare_lname
   922 00000460 31C9                    	xor cx, cx
   923 00000462 E8C001                  	call .enter_lname
   924                                  
   925 00000465 31C9                    	xor cx, cx
   926 00000467 31D2                    	xor dx, dx		; cx:dx = 0
   927 00000469 B000                    	mov al, 0		; SOF
   928 0000046B E83A0D                  	call .seektemp
   929                                  
   930                                  .loop_get_lnames:
   931 0000046E 31C9                    	xor cx, cx
   932 00000470 31D2                    	xor dx, dx		; cx:dx = 0
   933 00000472 B001                    	mov al, 1		; current
   934 00000474 E8310D                  	call .seektemp
   935 00000477 8946FC                  	mov word [bp + ?seektemp], ax
   936 0000047A 8956FE                  	mov word [bp + ?seektemp + 2], dx
   937                                  
   938 0000047D B90A00                  	mov cx, TEMPWLLIST_size
   939 00000480 E85B0D                  	call .readtemp0_maybe_eof
   940 00000483 7411                    	je @F
   941 00000485 85C0                    	test ax, ax
   942 00000487 7503E93002              	jz .end_get_lnames
   943                                  .internal27:
   944 0000048C B91B00                      mov cx,27                ; internal error value
   945 0000048F EBAE                        jmp .internal
   946                                  
   947                                  .internal28:
   948 00000491 B91C00                      mov cx,28                ; internal error value
   949 00000494 EBA9                        jmp .internal
   950                                  
   951                                  @@:
   952 00000496 89CA                    	mov dx, cx
   953 00000498 8A0E0000                	mov cl, [twlLength]
   954 0000049C E3F3                    	jcxz .internal28
   955 0000049E E82E0D                  	call .readtemp
   956                                  
   957 000004A1 E8BA0C                  	call .skipprefix
   958 000004A4 3C47                    	cmp al, twlGroup
   959 000004A6 7406                    	je .loop_find_group_lname
   960 000004A8 3C4E                    	cmp al, twlNew
   961 000004AA 7456                    	je .loop_find_list_section_lname
   962 000004AC EBC0                    	jmp .loop_get_lnames
   963                                  
   964                                  .loop_find_group_lname:
   965 000004AE E8D80C                  	call .skipunder
   966 000004B1 3C47                    	cmp al, twlGroup
   967 000004B3 7405                    	je @F
   968 000004B5 B92100                  	mov cx, 33
   969 000004B8 EB85                    	jmp .internal
   970                                  @@:
   971 000004BA C646E200                	mov byte [bp + ?lnamemustexist], 0
   972 000004BE E89C00                  	call .findlname
   973                                  
   974 000004C1 8B56FC                  	mov dx, word [bp + ?seektemp]
   975 000004C4 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
   976 000004C7 B000                    	mov al, 0		; SOF
   977 000004C9 E8DC0C                  	call .seektemp
   978 000004CC 8D56EE                  	lea dx, [bp + ?buffer]
   979 000004CF B90A00                  	mov cx, TEMPWLLIST_size
   980 000004D2 E8040D                  	call .readtemp_ssdx
   981                                  
   982 000004D5 B9FFFF                  	mov cx, -1
   983 000004D8 BAF6FF                  	mov dx, - TEMPWLLIST_size
   984 000004DB B001                    	mov al, 1		; current
   985 000004DD E8C80C                  	call .seektemp
   986                                  
   987 000004E0 8B46E6                  	mov ax, word [bp + ?currentindex]
   988 000004E3 84E4                    	test ah, ah
   989 000004E5 7403E9B000              	jnz .internal32
   990 000004EA 8846F1                  	mov byte [bp + ?buffer + twlGroupIndex], al
   991 000004ED 8D56EE                  	lea dx, [bp + ?buffer]
   992 000004F0 B90A00                  	mov cx, TEMPWLLIST_size
   993 000004F3 E8190D                  	call .writetemp_ssdx
   994                                  
   995 000004F6 8A4EEE                  	mov cl, byte [bp + ?buffer + twlLength]
   996 000004F9 BA0A00                  	mov dx, TEMPWLLIST_size
   997 000004FC E8D00C                  	call .readtemp
   998                                  
   999 000004FF E96CFF                  	jmp .loop_get_lnames
  1000                                  
  1001                                  
  1002                                  .loop_find_list_section_lname:
  1003 00000502 E8840C                  	call .skipunder
  1004 00000505 3C53                    	cmp al, twlSegment
  1005 00000507 740D                    	je .getsegment
  1006 00000509 3C4C                    	cmp al, twlList
  1007 0000050B 7503E98301              	je .check_found_lnames
  1008 00000510 B91F00                  	mov cx, 31
  1009 00000513 E929FF                  	jmp .internal
  1010                                  
  1011                                  .getsegment:
  1012 00000516 C646E200                	mov byte [bp + ?lnamemustexist], 0
  1013 0000051A E84000                  	call .findlname
  1014                                  
  1015 0000051D 8B56FC                  	mov dx, word [bp + ?seektemp]
  1016 00000520 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1017 00000523 B000                    	mov al, 0		; SOF
  1018 00000525 E8800C                  	call .seektemp
  1019 00000528 8D56EE                  	lea dx, [bp + ?buffer]
  1020 0000052B B90A00                  	mov cx, TEMPWLLIST_size
  1021 0000052E E8A80C                  	call .readtemp_ssdx
  1022                                  
  1023 00000531 B9FFFF                  	mov cx, -1
  1024 00000534 BAF6FF                  	mov dx, - TEMPWLLIST_size
  1025 00000537 B001                    	mov al, 1		; current
  1026 00000539 E86C0C                  	call .seektemp
  1027                                  
  1028 0000053C 8B46E6                  	mov ax, word [bp + ?currentindex]
  1029 0000053F 84E4                    	test ah, ah
  1030 00000541 7557                    	jnz .internal32
  1031 00000543 8846F0                  	mov byte [bp + ?buffer + twlSegmentIndex], al
  1032 00000546 8D56EE                  	lea dx, [bp + ?buffer]
  1033 00000549 B90A00                  	mov cx, TEMPWLLIST_size
  1034 0000054C E8C00C                  	call .writetemp_ssdx
  1035                                  
  1036 0000054F 8A4EEE                  	mov cl, byte [bp + ?buffer + twlLength]
  1037 00000552 BA0A00                  	mov dx, TEMPWLLIST_size
  1038 00000555 E8770C                  	call .readtemp
  1039                                  
  1040 00000558 8B76EA                  	mov si, word [bp + ?nextfield]
  1041 0000055B EBA5                    	jmp .loop_find_list_section_lname
  1042                                  
  1043                                  .findlname:
  1044 0000055D E8290C                  	call .skipunder
  1045 00000560 4E                      	dec si
  1046                                   extern name_field
  1047 00000561 BF[0000]                	mov di, name_field
  1048 00000564 31C9                    	xor cx, cx
  1049 00000566 A9                      	db __TEST_IMM16		; skip stosb and inc
  1050                                  @@:
  1051 00000567 AA                      	stosb
  1052 00000568 41                      	inc cx
  1053 00000569 AC                      	lodsb
  1054 0000056A 3C5F                    	cmp al, '_'
  1055 0000056C 7408                    	je @F
  1056 0000056E 3C00                    	cmp al, 0
  1057 00000570 7404                    	je @F
  1058 00000572 3C3F                    	cmp al, '?'
  1059 00000574 75F1                    	jne @B
  1060                                  @@:
  1061 00000576 31C0                    	xor ax, ax
  1062 00000578 AA                      	stosb
  1063 00000579 4E                      	dec si
  1064 0000057A 8976EA                  	mov word [bp + ?nextfield], si
  1065 0000057D 894EEC                  	mov word [bp + ?length], cx
  1066                                  
  1067 00000580 31C9                    	xor cx, cx
  1068 00000582 31D2                    	xor dx, dx		; cx:dx = 0
  1069 00000584 B000                    	mov al, 0		; SOF
  1070 00000586 E82E0C                  	call .seekobj
  1071 00000589 C746E60100              	mov word [bp + ?currentindex], 1
  1072                                  
  1073                                  .find_existing_lname:
  1074 0000058E B90300                  	mov cx, 3
  1075 00000591 E8CE0C                  	call .readobj0_maybe_eof
  1076 00000594 740A                    	je @F
  1077 00000596 85C0                    	test ax, ax
  1078 00000598 7457                    	jz .new_lname
  1079                                  .internal32:
  1080 0000059A B92000                  	mov cx, 32
  1081 0000059D E99FFE                  	jmp .internal
  1082                                  
  1083                                  @@:
  1084 000005A0 8B160100                	mov dx, word [1]
  1085 000005A4 803E000096              	cmp byte [0], LNAMES
  1086 000005A9 7409                    	je @F
  1087 000005AB 31C9                    	xor cx, cx		; cx:dx = length of record
  1088 000005AD B001                    	mov al, 1		; current
  1089 000005AF E8050C                  	call .seekobj
  1090 000005B2 EBDA                    	jmp .find_existing_lname
  1091                                  
  1092                                  @@:
  1093 000005B4 8956E8                  	mov word [bp + ?lnameslength], dx
  1094                                  .check_existing_lname:
  1095 000005B7 837EE801                	cmp word [bp + ?lnameslength], 1
  1096 000005BB 7628                    	jbe .next_existing_lname
  1097 000005BD B90100                  	mov cx, 1
  1098 000005C0 E88A0C                  	call .readobj0
  1099 000005C3 42                      	inc dx
  1100 000005C4 8A0E0000                	mov cl, [0]
  1101 000005C8 F9                      	stc
  1102 000005C9 194EE8                  	sbb word [bp + ?lnameslength], cx
  1103 000005CC 72CC                    	jc .internal32
  1104 000005CE E8820C                  	call .readobj
  1105                                  
  1106 000005D1 3B4EEC                  	cmp cx, word [bp + ?length]
  1107 000005D4 750A                    	jne @F
  1108 000005D6 BF[0000]                	mov di, name_field
  1109 000005D9 BE0100                  	mov si, 1
  1110 000005DC F3A6                    	repe cmpsb
  1111 000005DE 740F                    	je .found_existing_lname
  1112                                  @@:
  1113 000005E0 FF46E6                  	inc word [bp + ?currentindex]
  1114 000005E3 EBD2                    	jmp .check_existing_lname
  1115                                  
  1116                                  .next_existing_lname:
  1117 000005E5 75A7                    	jne .find_existing_lname
  1118 000005E7 B90100                  	mov cx, 1
  1119 000005EA E8600C                  	call .readobj0
  1120 000005ED EB9F                    	jmp .find_existing_lname
  1121                                  
  1122                                  .found_existing_lname:
  1123 000005EF F8                      	clc
  1124                                  @@:
  1125 000005F0 C3                      	retn
  1126                                  
  1127                                  .new_lname:
  1128 000005F1 D046E2                  	rol byte [bp + ?lnamemustexist], 1
  1129 000005F4 72FA                    	jc @B
  1130                                  
  1131 000005F6 06                      	push es
  1132 000005F7 1F                      	pop ds
  1133 000005F8 BA[0000]                	mov dx, name_field
  1134 000005FB 8B4EEC                  	mov cx, word [bp + ?length]
  1135 000005FE E82400                  	call .enter_lname
  1136                                  
  1137 00000601 EBEC                    	jmp .found_existing_lname
  1138                                  
  1139                                  .prepare_lname:
  1140 00000603 31C9                    	xor cx, cx
  1141 00000605 31D2                    	xor dx, dx
  1142 00000607 B001                    	mov al, 1
  1143 00000609 E8AB0B                  	call .seekobj
  1144 0000060C 8946DE                  	mov word [bp + ?seeklname], ax
  1145 0000060F 8956E0                  	mov word [bp + ?seeklname + 2], dx
  1146                                  
  1147 00000612 268E1E[0000]            	mov ds, [es:buffer_base]
  1148 00000617 BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  1149 0000061A B096                    	mov al, LNAMES
  1150 0000061C 8805                    	mov byte [di], al
  1151 0000061E 83C703                  	add di, 3
  1152 00000621 897EDC                  	mov word [bp + ?behindpartialrecord], di
  1153 00000624 C3                      	retn
  1154                                  
  1155                                  .enter_lname:
  1156 00000625 8B7EDC                  	mov di, word [bp + ?behindpartialrecord]
  1157 00000628 89F8                    	mov ax, di
  1158 0000062A 01C8                    	add ax, cx
  1159 0000062C 7211                    	jc .enter_new_lname
  1160 0000062E 83C002                  	add ax, 2
  1161 00000631 720C                    	jc .enter_new_lname
  1162 00000633 3D0A05                  	cmp ax, TEMPSTRINGWLLIST_size + 1024
  1163 00000636 7707                    	ja .enter_new_lname
  1164 00000638 263B06[0000]            	cmp ax, word [es:buffer_end]
  1165 0000063D 760C                    	jbe .append_lname
  1166                                  .enter_new_lname:
  1167 0000063F 51                      	push cx
  1168 00000640 1E                      	push ds
  1169 00000641 52                      	push dx
  1170 00000642 E81700                  	call .dump_lname
  1171                                  
  1172 00000645 E8BBFF                  	call .prepare_lname
  1173 00000648 5A                      	pop dx
  1174 00000649 1F                      	pop ds
  1175 0000064A 59                      	pop cx
  1176                                  
  1177                                  .append_lname:
  1178 0000064B 06                      	push es
  1179 0000064C 268E06[0000]            	mov es, [es:buffer_base]
  1180 00000651 89D6                    	mov si, dx
  1181 00000653 88C8                    	mov al, cl
  1182 00000655 AA                      	stosb
  1183 00000656 F3A4                    	rep movsb
  1184 00000658 07                      	pop es
  1185 00000659 897EDC                  	mov word [bp + ?behindpartialrecord], di
  1186                                  
  1187                                  .dump_lname:
  1188 0000065C 8B56DE                  	mov dx, word [bp + ?seeklname]
  1189 0000065F 8B4EE0                  	mov cx, word [bp + ?seeklname + 2]
  1190 00000662 B000                    	mov al, 0
  1191 00000664 E8500B                  	call .seekobj
  1192                                  
  1193 00000667 268E1E[0000]            	mov ds, [es:buffer_base]
  1194 0000066C 8B4EDC                  	mov cx, word [bp + ?behindpartialrecord]
  1195 0000066F 81F90D01                	cmp cx, TEMPSTRINGWLLIST_size + 3
  1196 00000673 7614                    	jbe @F
  1197 00000675 41                      	inc cx
  1198 00000676 BA0A01                  	mov dx, TEMPSTRINGWLLIST_size
  1199 00000679 29D1                    	sub cx, dx
  1200 0000067B 89C8                    	mov ax, cx
  1201 0000067D 83E803                  	sub ax, 3
  1202 00000680 A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  1203 00000683 E8090B                  	call .checksum_dsdx
  1204 00000686 E8A20B                  	call .writeobj_dsdx
  1205                                  @@:
  1206 00000689 31C9                    	xor cx, cx
  1207 0000068B 31D2                    	xor dx, dx
  1208 0000068D B002                    	mov al, 2
  1209 0000068F E8250B                  	call .seekobj
  1210                                  
  1211 00000692 C3                      	retn
  1212                                  
  1213                                  
  1214                                  .check_found_lnames:
  1215 00000693 8B56FC                  	mov dx, word [bp + ?seektemp]
  1216 00000696 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1217 00000699 B000                    	mov al, 0		; SOF
  1218 0000069B E80A0B                  	call .seektemp
  1219 0000069E 8D56EE                  	lea dx, [bp + ?buffer]
  1220 000006A1 B90A00                  	mov cx, TEMPWLLIST_size
  1221 000006A4 E8320B                  	call .readtemp_ssdx
  1222                                  
  1223 000006A7 8A4EEE                  	mov cl, byte [bp + ?buffer + twlLength]
  1224 000006AA BA0A00                  	mov dx, TEMPWLLIST_size
  1225 000006AD E81F0B                  	call .readtemp
  1226                                  
  1227 000006B0 807EF000                	cmp byte [bp + ?buffer + twlSegmentIndex], 0
  1228 000006B4 7503E9480A              	je .no_section_error
  1229                                  
  1230 000006B9 E9B2FD                  	jmp .loop_get_lnames
  1231                                  
  1232                                  
  1233                                  .end_get_lnames:
  1234 000006BC E89DFF                  	call .dump_lname
  1235                                  
  1236 000006BF C746E60100              	mov word [bp + ?currentindex], 1
  1237 000006C4 31C9                    	xor cx, cx
  1238 000006C6 31D2                    	xor dx, dx		; cx:dx = 0
  1239 000006C8 B000                    	mov al, 0		; SOF
  1240 000006CA E8DB0A                  	call .seektemp
  1241                                  
  1242                                  .loop_outer_get_segdef:
  1243 000006CD 8946FC                  	mov word [bp + ?seektemp], ax
  1244 000006D0 8956FE                  	mov word [bp + ?seektemp + 2], dx
  1245                                  
  1246 000006D3 B90A00                  	mov cx, TEMPWLLIST_size
  1247 000006D6 E8050B                  	call .readtemp0_maybe_eof
  1248 000006D9 740A                    	je @F
  1249 000006DB 85C0                    	test ax, ax
  1250 000006DD 7503E90F01              	jz .end_get_segdef
  1251 000006E2 E9A7FD                  	jmp .internal27
  1252                                  
  1253                                  @@:
  1254 000006E5 8A160000                	mov dl, byte [twlLength]
  1255 000006E9 31C9                    	xor cx, cx		; cx:dx = length
  1256 000006EB B001                    	mov al, 1		; current
  1257 000006ED E8B80A                  	call .seektemp
  1258                                  
  1259 000006F0 803E020000              	cmp byte [twlSegmentIndex], 0
  1260 000006F5 74D6                    	je .loop_outer_get_segdef
  1261                                  
  1262 000006F7 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  1263 000006FC 75CF                    	jne .loop_outer_get_segdef
  1264                                  
  1265 000006FE 8B46E6                  	mov ax, word [bp + ?currentindex]
  1266 00000701 84E4                    	test ah, ah
  1267 00000703 7403E992FE              	jnz .internal32
  1268                                  
  1269 00000708 86060200                	xchg byte [twlSegmentIndex], al
  1270 0000070C C606010001              	mov byte [twlListUsed], twlUsedNewSeg
  1271 00000711 8846E4                  	mov byte [bp + ?segmentlname], al
  1272                                  
  1273 00000714 8B56FC                  	mov dx, word [bp + ?seektemp]
  1274 00000717 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1275 0000071A B000                    	mov al, 0
  1276 0000071C E8890A                  	call .seektemp
  1277                                  
  1278 0000071F 31C9                    	xor cx, cx
  1279 00000721 31D2                    	xor dx, dx		; cx:dx = 0
  1280 00000723 B002                    	mov al, 2		; EOF
  1281 00000725 E88F0A                  	call .seekobj
  1282                                  
  1283 00000728 83C004                  	add ax, data_segdef_be_127.segmentlength - data_segdef_be_127
  1284 0000072B 83D200                  	adc dx, 0
  1285 0000072E A30400                  	mov word [twlSegdefSizeOffset], ax
  1286 00000731 89160600                	mov word [twlSegdefSizeOffset + 2], dx
  1287 00000735 52                      	push dx
  1288 00000736 50                      	push ax
  1289                                  
  1290 00000737 06                      	push es
  1291 00000738 1F                      	pop ds
  1292 00000739 8A46E4                  	mov al, byte [bp + ?segmentlname]
  1293 0000073C A2[4400]                	mov byte [data_segdef_be_127.segmentlname], al
  1294 0000073F A2[4F00]                	mov byte [data_segdef_ae_128.segmentlname], al
  1295 00000742 BA[3E00]                	mov dx, data_segdef_be_127
  1296 00000745 B90A00                  	mov cx, data_segdef_be_127.size
  1297 00000748 84C0                    	test al, al
  1298 0000074A 7906                    	jns @F
  1299 0000074C BA[4800]                	mov dx, data_segdef_ae_128
  1300 0000074F B90B00                  	mov cx, data_segdef_ae_128.size
  1301                                  @@:
  1302 00000752 E83A0A                  	call .checksum_dsdx
  1303 00000755 E8D30A                  	call .writeobj_dsdx
  1304                                  
  1305 00000758 B90A00                  	mov cx, TEMPWLLIST_size
  1306 0000075B E8A90A                  	call .writetemp0
  1307                                  
  1308 0000075E 8A160000                	mov dl, byte [twlLength]
  1309 00000762 31C9                    	xor cx, cx		; cx:dx = length
  1310 00000764 B001                    	mov al, 1		; current
  1311 00000766 E83F0A                  	call .seektemp
  1312                                  
  1313                                  .loop_inner_get_segdef:
  1314 00000769 8946F8                  	mov word [bp + ?seektempinner], ax
  1315 0000076C 8956FA                  	mov word [bp + ?seektempinner + 2], dx
  1316                                  
  1317 0000076F B90A00                  	mov cx, TEMPWLLIST_size
  1318 00000772 E8690A                  	call .readtemp0_maybe_eof
  1319 00000775 7407                    	je @F
  1320 00000777 85C0                    	test ax, ax
  1321 00000779 7452                    	jz .end_inner_get_segdef
  1322 0000077B E90EFD                  	jmp .internal27
  1323                                  
  1324                                  @@:
  1325 0000077E 8A160000                	mov dl, byte [twlLength]
  1326 00000782 31C9                    	xor cx, cx		; cx:dx = length
  1327 00000784 B001                    	mov al, 1		; current
  1328 00000786 E81F0A                  	call .seektemp
  1329                                  
  1330 00000789 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  1331 0000078E 75D9                    	jne .loop_inner_get_segdef
  1332                                  
  1333 00000790 8A4EE4                  	mov cl, byte [bp + ?segmentlname]
  1334 00000793 380E0200                	cmp byte [twlSegmentIndex], cl
  1335 00000797 75D0                    	jne .loop_inner_get_segdef
  1336                                  
  1337 00000799 8B46E6                  	mov ax, word [bp + ?currentindex]
  1338 0000079C A20200                  	mov byte [twlSegmentIndex], al
  1339 0000079F C606010001              	mov byte [twlListUsed], twlUsedNewSeg
  1340                                  
  1341 000007A4 8B56F8                  	mov dx, word [bp + ?seektempinner]
  1342 000007A7 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  1343 000007AA B000                    	mov al, 0
  1344 000007AC E8F909                  	call .seektemp
  1345                                  
  1346 000007AF 58                      	pop ax
  1347 000007B0 5A                      	pop dx
  1348 000007B1 A30400                  	mov word [twlSegdefSizeOffset], ax
  1349 000007B4 89160600                	mov word [twlSegdefSizeOffset + 2], dx
  1350 000007B8 52                      	push dx
  1351 000007B9 50                      	push ax
  1352                                  
  1353 000007BA B90A00                  	mov cx, TEMPWLLIST_size
  1354 000007BD E8470A                  	call .writetemp0
  1355                                  
  1356 000007C0 8A160000                	mov dl, byte [twlLength]
  1357 000007C4 31C9                    	xor cx, cx		; cx:dx = length
  1358 000007C6 B001                    	mov al, 1		; current
  1359 000007C8 E8DD09                  	call .seektemp
  1360                                  
  1361 000007CB EB9C                    	jmp .loop_inner_get_segdef
  1362                                  
  1363                                  .end_inner_get_segdef:
  1364 000007CD 58                      	pop ax
  1365 000007CE 5A                      	pop dx			; discard
  1366                                  
  1367 000007CF FF46E6                  	inc word [bp + ?currentindex]
  1368                                  				; done with this segdef
  1369                                  
  1370 000007D2 8B56FC                  	mov dx, word [bp + ?seektemp]
  1371 000007D5 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1372 000007D8 B000                    	mov al, 0
  1373 000007DA E8CB09                  	call .seektemp
  1374                                  
  1375 000007DD B90A00                  	mov cx, TEMPWLLIST_size
  1376 000007E0 E8E609                  	call .readtemp0
  1377 000007E3 8A160000                	mov dl, byte [twlLength]
  1378 000007E7 31C9                    	xor cx, cx		; cx:dx = length
  1379 000007E9 B001                    	mov al, 1		; current
  1380 000007EB E8BA09                  	call .seektemp
  1381                                  
  1382 000007EE E9DCFE                  	jmp .loop_outer_get_segdef
  1383                                  
  1384                                  
  1385                                  .end_get_segdef:
  1386                                  
  1387 000007F1 C746E60100              	mov word [bp + ?currentindex], 1
  1388 000007F6 31C9                    	xor cx, cx
  1389 000007F8 31D2                    	xor dx, dx		; cx:dx = 0
  1390 000007FA B000                    	mov al, 0		; SOF
  1391 000007FC E8A909                  	call .seektemp
  1392                                  
  1393                                  .loop_outer_get_grpdef:
  1394 000007FF 8946FC                  	mov word [bp + ?seektemp], ax
  1395 00000802 8956FE                  	mov word [bp + ?seektemp + 2], dx
  1396                                  
  1397 00000805 B90A00                  	mov cx, TEMPWLLIST_size
  1398 00000808 E8D309                  	call .readtemp0_maybe_eof
  1399 0000080B 740A                    	je @F
  1400 0000080D 85C0                    	test ax, ax
  1401 0000080F 7503E9CA01              	jz .end_get_grpdef
  1402 00000814 E975FC                  	jmp .internal27
  1403                                  
  1404                                  @@:
  1405 00000817 8A160000                	mov dl, byte [twlLength]
  1406 0000081B 31C9                    	xor cx, cx		; cx:dx = length
  1407 0000081D B001                    	mov al, 1		; current
  1408 0000081F E88609                  	call .seektemp
  1409                                  
  1410 00000822 803E030000              	cmp byte [twlGroupIndex], 0
  1411 00000827 74D6                    	je .loop_outer_get_grpdef
  1412                                  
  1413 00000829 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  1414 0000082E 75CF                    	jne .loop_outer_get_grpdef
  1415                                  
  1416 00000830 8B46E6                  	mov ax, word [bp + ?currentindex]
  1417 00000833 84E4                    	test ah, ah
  1418 00000835 7403E960FD              	jnz .internal32
  1419                                  
  1420 0000083A 86060300                	xchg byte [twlGroupIndex], al
  1421 0000083E C606010002              	mov byte [twlListUsed], twlUsedNewGroup
  1422 00000843 8846E4                  	mov byte [bp + ?segmentlname], al
  1423                                  
  1424 00000846 8B56FC                  	mov dx, word [bp + ?seektemp]
  1425 00000849 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1426 0000084C B000                    	mov al, 0
  1427 0000084E E85709                  	call .seektemp
  1428                                  
  1429 00000851 B90A00                  	mov cx, TEMPWLLIST_size
  1430 00000854 E8B009                  	call .writetemp0
  1431                                  
  1432 00000857 89CA                    	mov dx, cx
  1433 00000859 8A0E0000                	mov cl, byte [twlLength]
  1434 0000085D E86F09                  	call .readtemp
  1435                                  
  1436 00000860 1E                      	push ds
  1437 00000861 06                      	push es
  1438 00000862 1F                      	pop ds
  1439 00000863 07                      	pop es			; swap
  1440 00000864 BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  1441                                  				; es:di -> buffer for grpdef record
  1442 00000867 B09A                    	mov al, GRPDEF
  1443 00000869 AA                      	stosb
  1444 0000086A AF                      	scasw			; skip length
  1445 0000086B 8A46E4                  	mov al, byte [bp + ?segmentlname]
  1446 0000086E 84C0                    	test al, al
  1447 00000870 7905                    	jns @F
  1448 00000872 26C60580                	mov byte [es:di], 80h
  1449 00000876 47                      	inc di
  1450                                  @@:
  1451 00000877 AA                      	stosb
  1452 00000878 1E                      	push ds
  1453 00000879 06                      	push es
  1454 0000087A 1F                      	pop ds
  1455 0000087B 07                      	pop es			; swap back
  1456 0000087C 57                      	push di			; stack -> next grpdef entry
  1457                                  
  1458 0000087D E8DE08                  	call .skipprefix
  1459 00000880 3C47                    	cmp al, twlGroup
  1460 00000882 751B                    	jne .internal34
  1461 00000884 E80209                  	call .skipunder
  1462 00000887 3C47                    	cmp al, twlGroup
  1463 00000889 7514                    	jne .internal34
  1464 0000088B E8FB08                  	call .skipunder
  1465 0000088E 4E                      	dec si
  1466                                  @@:
  1467 0000088F AC                      	lodsb
  1468 00000890 3C5F                    	cmp al, '_'
  1469 00000892 7408                    	je @F
  1470 00000894 3C00                    	cmp al, 0
  1471 00000896 7404                    	je @F
  1472 00000898 3C3F                    	cmp al, '?'
  1473 0000089A 75F3                    	jne @B
  1474                                  @@:
  1475 0000089C 4E                      	dec si
  1476 0000089D EB13                    	jmp @F
  1477                                  
  1478                                  .internal34:
  1479 0000089F B92200                  	mov cx, 34
  1480                                  .internal_j1:
  1481 000008A2 E99AFB                  	jmp .internal
  1482                                  
  1483                                  .internal35:
  1484 000008A5 B92300                  	mov cx, 35
  1485 000008A8 EBF8                    	jmp .internal_j1
  1486                                  
  1487                                  .internal37:
  1488 000008AA B92500                  	mov cx, 37
  1489 000008AD EBF3                    	jmp .internal_j1
  1490                                  
  1491                                  .grpdef_loop:
  1492 000008AF 8B76EA                  	mov si, word [bp + ?nextfield]
  1493                                  @@:
  1494 000008B2 E8D408                  	call .skipunder
  1495 000008B5 3C00                    	cmp al, 0
  1496 000008B7 7503E9DB00              	je .grpdef_done
  1497 000008BC 3C3F                    	cmp al, '?'
  1498 000008BE 7503E9D400              	je .grpdef_done
  1499 000008C3 3C53                    	cmp al, twlSegment
  1500 000008C5 75DE                    	jne .internal35
  1501                                  
  1502 000008C7 FF76E6                  	push word [bp + ?currentindex]
  1503 000008CA C646E2FF                	mov byte [bp + ?lnamemustexist], -1
  1504 000008CE E88CFC                  	call .findlname
  1505 000008D1 7303E93008              	jc .group_unknown_section_error
  1506 000008D6 8B46E6                  	mov ax, [bp + ?currentindex]
  1507 000008D9 84E4                    	test ah, ah
  1508 000008DB 7403E9BAFC              	jnz .internal32
  1509 000008E0 8946E4                  	mov word [bp + ?segmentlname], ax
  1510 000008E3 E88B07                  	call .findsegdef
  1511 000008E6 8B46E6                  	mov ax, [bp + ?currentindex]
  1512 000008E9 84E4                    	test ah, ah
  1513 000008EB 7403E9AAFC              	jnz .internal32
  1514 000008F0 8F46E6                  	pop word [bp + ?currentindex]
  1515                                  
  1516 000008F3 1E                      	push ds
  1517 000008F4 06                      	push es
  1518 000008F5 1F                      	pop ds
  1519 000008F6 07                      	pop es			; swap
  1520                                  
  1521 000008F7 5F                      	pop di			; es:di -> next grpdef entry
  1522 000008F8 8D5504                  	lea dx, [di + 4]
  1523 000008FB 3B16[0000]              	cmp dx, [buffer_end]
  1524 000008FF 77A9                    	ja .internal37
  1525 00000901 26C705FF80              	mov word [es:di], 80FFh	; low byte = 0FFh, then high byte = 80h
  1526 00000906 47                      	inc di
  1527 00000907 84C0                    	test al, al
  1528 00000909 7901                    	jns @F
  1529                                  	; mov byte [es:di], 80h
  1530 0000090B 47                      	inc di
  1531                                  @@:
  1532 0000090C AA                      	stosb
  1533 0000090D 57                      	push di			; stack -> next grpdef entry
  1534                                  
  1535 0000090E 1E                      	push ds
  1536 0000090F 06                      	push es
  1537 00000910 1F                      	pop ds
  1538 00000911 07                      	pop es			; swap back
  1539                                  
  1540 00000912 50                      	push ax
  1541                                  
  1542 00000913 31C9                    	xor cx, cx
  1543 00000915 31D2                    	xor dx, dx		; cx:dx = 0
  1544 00000917 B000                    	mov al, 0		; SOF
  1545 00000919 E88C08                  	call .seektemp
  1546                                  
  1547                                  .loop_inner_get_grpdef:
  1548 0000091C 8946F8                  	mov word [bp + ?seektempinner], ax
  1549 0000091F 8956FA                  	mov word [bp + ?seektempinner + 2], dx
  1550                                  
  1551 00000922 B90A00                  	mov cx, TEMPWLLIST_size
  1552 00000925 E8B608                  	call .readtemp0_maybe_eof
  1553 00000928 7407                    	je @F
  1554 0000092A 85C0                    	test ax, ax
  1555 0000092C 744B                    	jz .end_inner_get_grpdef
  1556 0000092E E95BFB                  	jmp .internal27
  1557                                  
  1558                                  @@:
  1559 00000931 8A160000                	mov dl, byte [twlLength]
  1560 00000935 31C9                    	xor cx, cx		; cx:dx = length
  1561 00000937 B001                    	mov al, 1		; current
  1562 00000939 E86C08                  	call .seektemp
  1563                                  
  1564 0000093C 803E010001              	cmp byte [twlListUsed], twlUsedNewSeg
  1565 00000941 75D9                    	jne .loop_inner_get_grpdef
  1566                                  
  1567 00000943 59                      	pop cx
  1568 00000944 380E0200                	cmp byte [twlSegmentIndex], cl
  1569 00000948 51                      	push cx
  1570 00000949 75D1                    	jne .loop_inner_get_grpdef
  1571                                  
  1572 0000094B 803E030000              	cmp byte [twlGroupIndex], 0
  1573 00000950 7403E9C007              	jne .group_multiple_error
  1574                                  
  1575 00000955 8B46E6                  	mov ax, word [bp + ?currentindex]
  1576 00000958 A20300                  	mov byte [twlGroupIndex], al
  1577                                  
  1578 0000095B 8B56F8                  	mov dx, word [bp + ?seektempinner]
  1579 0000095E 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  1580 00000961 B000                    	mov al, 0
  1581 00000963 E84208                  	call .seektemp
  1582                                  
  1583 00000966 B90A00                  	mov cx, TEMPWLLIST_size
  1584 00000969 E89B08                  	call .writetemp0
  1585                                  
  1586 0000096C 8A160000                	mov dl, byte [twlLength]
  1587 00000970 31C9                    	xor cx, cx		; cx:dx = length
  1588 00000972 B001                    	mov al, 1		; current
  1589 00000974 E83108                  	call .seektemp
  1590                                  
  1591 00000977 EBA3                    	jmp .loop_inner_get_grpdef
  1592                                  
  1593                                  .end_inner_get_grpdef:
  1594 00000979 58                      	pop ax			; discard
  1595                                  
  1596 0000097A 8B56FC                  	mov dx, word [bp + ?seektemp]
  1597 0000097D 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1598 00000980 B000                    	mov al, 0
  1599 00000982 E82308                  	call .seektemp
  1600                                  
  1601 00000985 B90A00                  	mov cx, TEMPWLLIST_size
  1602 00000988 E83E08                  	call .readtemp0
  1603                                  
  1604 0000098B 89CA                    	mov dx, cx
  1605 0000098D 8A0E0000                	mov cl, byte [twlLength]
  1606 00000991 E83B08                  	call .readtemp
  1607                                  
  1608 00000994 E918FF                  	jmp .grpdef_loop
  1609                                  
  1610                                  .grpdef_done:
  1611                                  
  1612 00000997 31C9                    	xor cx, cx
  1613 00000999 31D2                    	xor dx, dx		; cx:dx = 0
  1614 0000099B B002                    	mov al, 2		; EOF
  1615 0000099D E81708                  	call .seekobj
  1616                                  
  1617 000009A0 5F                      	pop di
  1618 000009A1 268E1E[0000]                mov ds,[es:buffer_base]      ; DS => buffer area
  1619 000009A6 47                      	inc di			; -> past checksum byte
  1620 000009A7 89F9                    	mov cx, di		; -> past checksum byte
  1621 000009A9 BA0A01                  	mov dx, TEMPSTRINGWLLIST_size
  1622                                  				; -> prepared grpdef record
  1623 000009AC 29D1                    	sub cx, dx		; = length of record
  1624 000009AE 89C8                    	mov ax, cx
  1625 000009B0 83E803                  	sub ax, 3		; = length field
  1626 000009B3 A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  1627 000009B6 E8D607                  	call .checksum_dsdx
  1628 000009B9 E86F08                  	call .writeobj_dsdx
  1629                                  
  1630 000009BC FF46E6                  	inc word [bp + ?currentindex]
  1631                                  				; done with this grpdef
  1632                                  
  1633 000009BF 8B56FC                  	mov dx, word [bp + ?seektemp]
  1634 000009C2 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1635 000009C5 B000                    	mov al, 0
  1636 000009C7 E8DE07                  	call .seektemp
  1637                                  
  1638 000009CA B90A00                  	mov cx, TEMPWLLIST_size
  1639 000009CD E8F907                  	call .readtemp0
  1640 000009D0 8A160000                	mov dl, byte [twlLength]
  1641 000009D4 31C9                    	xor cx, cx		; cx:dx = length
  1642 000009D6 B001                    	mov al, 1		; current
  1643 000009D8 E8CD07                  	call .seektemp
  1644                                  
  1645 000009DB E921FE                  	jmp .loop_outer_get_grpdef
  1646                                  
  1647                                  
  1648                                  .end_get_grpdef:
  1649                                  
  1650 000009DE E8BD00                  	call .prepare_extdef
  1651 000009E1 C746E60100              	mov word [bp + ?currentindex], 1
  1652 000009E6 31C9                    	xor cx, cx
  1653 000009E8 31D2                    	xor dx, dx		; cx:dx = 0
  1654 000009EA B000                    	mov al, 0		; SOF
  1655 000009EC E8B907                  	call .seektemp
  1656                                  
  1657                                  .loop_extdef:
  1658 000009EF 8946FC                  	mov word [bp + ?seektemp], ax
  1659 000009F2 8956FE                  	mov word [bp + ?seektemp + 2], dx
  1660                                  
  1661 000009F5 B90A00                  	mov cx, TEMPWLLIST_size
  1662 000009F8 E8E307                  	call .readtemp0_maybe_eof
  1663 000009FB 740A                    	je @F
  1664 000009FD 85C0                    	test ax, ax
  1665 000009FF 7503E9D900              	jz .end_extdef
  1666 00000A04 E985FA                  	jmp .internal27
  1667                                  
  1668                                  @@:
  1669 00000A07 8A160000                	mov dl, byte [twlLength]
  1670 00000A0B 31C9                    	xor cx, cx		; cx:dx = length
  1671 00000A0D B001                    	mov al, 1		; current
  1672 00000A0F E89607                  	call .seektemp
  1673                                  
  1674 00000A12 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  1675 00000A17 75D6                    	jne .loop_extdef
  1676                                  
  1677 00000A19 8B56FC                  	mov dx, word [bp + ?seektemp]
  1678 00000A1C 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1679 00000A1F 83C20A                  	add dx, TEMPWLLIST_size
  1680 00000A22 83D100                  	adc cx, 0
  1681 00000A25 B000                    	mov al, 0
  1682 00000A27 E87E07                  	call .seektemp
  1683                                  
  1684 00000A2A 31C9                    	xor cx, cx
  1685 00000A2C 8A0E0000                	mov cl, [twlLength]
  1686 00000A30 BA0A00                  	mov dx, TEMPWLLIST_size
  1687 00000A33 E89907                  	call .readtemp
  1688                                  
  1689 00000A36 89D6                    	mov si, dx
  1690 00000A38 B9FFFF                  	mov cx, -1
  1691                                  @@:
  1692 00000A3B 41                      	inc cx
  1693 00000A3C AC                      	lodsb
  1694 00000A3D 84C0                    	test al, al
  1695 00000A3F 75FA                    	jnz @B
  1696                                  
  1697 00000A41 8B7EDC                  	mov di, word [bp + ?behindpartialrecord]
  1698 00000A44 89F8                    	mov ax, di
  1699 00000A46 01C8                    	add ax, cx
  1700 00000A48 7211                    	jc .new_extdef
  1701 00000A4A 83C003                  	add ax, 3
  1702 00000A4D 720C                    	jc .new_extdef
  1703 00000A4F 3D0A05                  	cmp ax, TEMPSTRINGWLLIST_size + 1024
  1704 00000A52 7707                    	ja .new_extdef
  1705 00000A54 263B06[0000]            	cmp ax, word [es:buffer_end]
  1706 00000A59 760A                    	jbe .append_extdef
  1707                                  .new_extdef:
  1708 00000A5B 51                      	push cx
  1709 00000A5C 52                      	push dx
  1710 00000A5D E85100                  	call .dump_extdef
  1711                                  
  1712 00000A60 E83B00                  	call .prepare_extdef
  1713 00000A63 5A                      	pop dx
  1714 00000A64 59                      	pop cx
  1715                                  
  1716                                  .append_extdef:
  1717 00000A65 06                      	push es
  1718 00000A66 1E                      	 push ds
  1719 00000A67 07                      	 pop es
  1720 00000A68 89D6                    	mov si, dx
  1721 00000A6A 88C8                    	mov al, cl
  1722 00000A6C AA                      	stosb
  1723 00000A6D F3A4                    	rep movsb
  1724 00000A6F B000                    	mov al, 0
  1725 00000A71 AA                      	stosb
  1726 00000A72 07                      	pop es
  1727 00000A73 897EDC                  	mov word [bp + ?behindpartialrecord], di
  1728                                  
  1729 00000A76 8B46E6                  	mov ax, word [bp + ?currentindex]
  1730 00000A79 A30400                  	mov word [twlExtdefIndex], ax
  1731                                  
  1732 00000A7C 8B56FC                  	mov dx, word [bp + ?seektemp]
  1733 00000A7F 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1734 00000A82 B000                    	mov al, 0
  1735 00000A84 E82107                  	call .seektemp
  1736                                  
  1737 00000A87 B90A00                  	mov cx, TEMPWLLIST_size
  1738 00000A8A E87A07                  	call .writetemp0
  1739                                  
  1740 00000A8D 8A160000                	mov dl, byte [twlLength]
  1741 00000A91 31C9                    	xor cx, cx
  1742 00000A93 B001                    	mov al, 1
  1743 00000A95 E81007                  	call .seektemp
  1744                                  
  1745 00000A98 FF46E6                  	inc word [bp + ?currentindex]
  1746 00000A9B E951FF                  	jmp .loop_extdef
  1747                                  
  1748                                  .prepare_extdef:
  1749 00000A9E 268E1E[0000]            	mov ds, [es:buffer_base]
  1750 00000AA3 BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  1751 00000AA6 B08C                    	mov al, EXTDEF
  1752 00000AA8 8805                    	mov byte [di], al
  1753 00000AAA 83C703                  	add di, 3
  1754 00000AAD 897EDC                  	mov word [bp + ?behindpartialrecord], di
  1755 00000AB0 C3                      	retn
  1756                                  
  1757                                  .dump_extdef:
  1758 00000AB1 31C9                    	xor cx, cx
  1759 00000AB3 31D2                    	xor dx, dx
  1760 00000AB5 B002                    	mov al, 2
  1761 00000AB7 E8FD06                  	call .seekobj
  1762                                  
  1763 00000ABA 268E1E[0000]            	mov ds, [es:buffer_base]
  1764 00000ABF 8B4EDC                  	mov cx, word [bp + ?behindpartialrecord]
  1765 00000AC2 81F90D01                	cmp cx, TEMPSTRINGWLLIST_size + 3
  1766 00000AC6 7614                    	jbe @F
  1767 00000AC8 41                      	inc cx
  1768 00000AC9 BA0A01                  	mov dx, TEMPSTRINGWLLIST_size
  1769 00000ACC 29D1                    	sub cx, dx
  1770 00000ACE 89C8                    	mov ax, cx
  1771 00000AD0 83E803                  	sub ax, 3
  1772 00000AD3 A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  1773 00000AD6 E8B606                  	call .checksum_dsdx
  1774 00000AD9 E84F07                  	call .writeobj_dsdx
  1775                                  @@:
  1776 00000ADC C3                      	retn
  1777                                  
  1778                                  .end_extdef:
  1779 00000ADD E8D1FF                  	call .dump_extdef
  1780                                  
  1781 00000AE0 C746E60100              	mov word [bp + ?currentindex], 1
  1782 00000AE5 31C9                    	xor cx, cx
  1783 00000AE7 31D2                    	xor dx, dx		; cx:dx = 0
  1784 00000AE9 B000                    	mov al, 0		; SOF
  1785 00000AEB E8BA06                  	call .seektemp
  1786                                  
  1787                                  .loop_outer_collect_items:
  1788 00000AEE 8946FC                  	mov word [bp + ?seektemp], ax
  1789 00000AF1 8956FE                  	mov word [bp + ?seektemp + 2], dx
  1790                                  
  1791 00000AF4 8D56EE                  	lea dx, [bp + ?buffer]
  1792 00000AF7 B90A00                  	mov cx, TEMPWLLIST_size
  1793 00000AFA E8E906                  	call .readtemp_ssdx_maybe_eof
  1794 00000AFD 740A                    	je @F
  1795 00000AFF 85C0                    	test ax, ax
  1796 00000B01 7503E9AE04              	jz .end_collect_items
  1797 00000B06 E983F9                  	jmp .internal27
  1798                                  
  1799                                  @@:
  1800 00000B09 31D2                    	xor dx, dx
  1801 00000B0B 8A56EE                  	mov dl, byte [bp + ?buffer + twlLength]
  1802 00000B0E 31C9                    	xor cx, cx		; cx:dx = length
  1803 00000B10 B001                    	mov al, 1		; current
  1804 00000B12 E89306                  	call .seektemp
  1805                                  
  1806 00000B15 807EEF01                	cmp byte [bp + ?buffer + twlListUsed], twlUsedNewSeg
  1807 00000B19 75D3                    	jne .loop_outer_collect_items
  1808                                  
  1809 00000B1B 8B56FC                  	mov dx, word [bp + ?seektemp]
  1810 00000B1E 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1811 00000B21 83C20A                  	add dx, TEMPWLLIST_size
  1812 00000B24 83D100                  	adc cx, 0
  1813 00000B27 B000                    	mov al, 0
  1814 00000B29 E87C06                  	call .seektemp
  1815                                  
  1816 00000B2C 31C9                    	xor cx, cx
  1817 00000B2E 8A4EEE                  	mov cl, [bp + ?buffer + twlLength]
  1818 00000B31 BA0A00                  	mov dx, TEMPWLLIST_size
  1819 00000B34 E89806                  	call .readtemp
  1820                                  
  1821 00000B37 E82406                  	call .skipprefix
  1822 00000B3A 3C4E                    	cmp al, twlNew
  1823 00000B3C 7403E9CF05              	jne .invalid_new_segment_error
  1824 00000B41 E84506                  	call .skipunder
  1825 00000B44 3C53                    	cmp al, twlSegment
  1826 00000B46 7515                    	jne .check_list		; not used because of .check_found_lnames
  1827 00000B48 E83E06                  	call .skipunder
  1828 00000B4B 4E                      	dec si
  1829                                  @@:
  1830 00000B4C AC                      	lodsb
  1831 00000B4D 3C5F                    	cmp al, '_'
  1832 00000B4F 7408                    	je @F
  1833 00000B51 3C00                    	cmp al, 0
  1834 00000B53 7404                    	je @F
  1835 00000B55 3C3F                    	cmp al, '?'
  1836 00000B57 75F3                    	jne @B
  1837                                  @@:
  1838 00000B59 4E                      	dec si
  1839 00000B5A E82C06                  	call .skipunder
  1840                                  
  1841                                  .check_list:
  1842 00000B5D 3C4C                    	cmp al, twlList
  1843 00000B5F 7403E9AC05              	jne .invalid_new_segment_error
  1844 00000B64 E82206                  	call .skipunder
  1845 00000B67 4E                      	dec si
  1846                                   extern name_field
  1847 00000B68 BF[0000]                	mov di, name_field
  1848 00000B6B 31C9                    	xor cx, cx
  1849 00000B6D A9                      	db __TEST_IMM16		; skip stosb and inc
  1850                                  @@:
  1851 00000B6E AA                      	stosb
  1852 00000B6F 41                      	inc cx
  1853 00000B70 AC                      	lodsb
  1854                                  		; do not check for underscore as a terminator !
  1855 00000B71 3C00                    	cmp al, 0
  1856 00000B73 7404                    	je @F
  1857 00000B75 3C3F                    	cmp al, '?'
  1858 00000B77 75F5                    	jne @B
  1859                                  @@:
  1860 00000B79 31C0                    	xor ax, ax
  1861 00000B7B AA                      	stosb
  1862 00000B7C 894EEC                  	mov word [bp + ?length], cx
  1863                                  
  1864 00000B7F E8DE00                  	call .get_size
  1865 00000B82 8946E4                  	mov word [bp + ?ledatabase], ax
  1866                                  
  1867 00000B85 E8EE00                  	call .prepare_one_pubdef
  1868 00000B88 E80501                  	call .index_one_pubdef
  1869 00000B8B 8B4EEC                  	mov cx, [bp + ?length]
  1870 00000B8E 88C8                    	mov al, cl
  1871 00000B90 AA                      	stosb			; string length
  1872 00000B91 BE[0000]                	mov si, name_field
  1873 00000B94 F3A4                    	rep movsb		; string
  1874 00000B96 8B46E4                  	mov ax, word [bp + ?ledatabase]
  1875 00000B99 AB                      	stosw			; offset
  1876 00000B9A E80E01                  	call .finish_one_pubdef
  1877                                  
  1878 00000B9D 8366EA00                	and word [bp + ?repeatseen], 0
  1879 00000BA1 C746E8[130D]            	mov word [bp + ?collectfunction], .collect_size
  1880 00000BA6 E85003                  	call .inner_collect
  1881                                  
  1882 00000BA9 E8B400                  	call .get_size
  1883 00000BAC 2B46E4                  	sub ax, [bp + ?ledatabase]
  1884 00000BAF 7303E9A600              	jc .internal38
  1885 00000BB4 50                      	push ax
  1886 00000BB5 7507                    	jnz @F
  1887 00000BB7 D046EA                  	rol byte [bp + ?repeatseen], 1
  1888 00000BBA 7202                    	jc @F
  1889 00000BBC EB35                    	jmp .no_ledata
  1890                                  
  1891                                  @@:
  1892 00000BBE 8946E6                  	mov word [bp + ?ledataremaining], ax
  1893                                  
  1894 00000BC1 8366F800                	and word [bp + ?seektempinner], 0
  1895 00000BC5 8366FA00                	and word [bp + ?seektempinner + 2], 0
  1896 00000BC9 8366D600                	and word [bp + ?ledata_skip_repeated], 0
  1897                                  				; initially, no partial repeated tempwllist
  1898                                  
  1899 00000BCD E82D02                  	call .emit_ledata
  1900 00000BD0 7307                    	jnc @F
  1901 00000BD2 D046EA                  	rol byte [bp + ?repeatseen], 1
  1902 00000BD5 7202                    	jc @F
  1903 00000BD7 EB7C                    	jmp .internal40
  1904                                  
  1905                                  @@:
  1906 00000BD9 E8DE02                  	call .prepare_fixupp
  1907                                  
  1908 00000BDC C746E8[3B0D]            	mov word [bp ?collectfunction], .collect_list
  1909 00000BE1 E81503                  	call .inner_collect
  1910                                  
  1911 00000BE4 E8E602                  	call .dump_fixupp
  1912                                  
  1913 00000BE7 837EE600                	cmp word [bp + ?ledataremaining], 0
  1914 00000BEB 7406                    	je @F
  1915                                  .internal43:
  1916 00000BED B92B00                  	mov cx, 43
  1917 00000BF0 E94CF8                  	jmp .internal
  1918                                  
  1919                                  @@:
  1920                                  .no_ledata:
  1921                                  
  1922 00000BF3 E88000                  	call .prepare_one_pubdef
  1923 00000BF6 E89700                  	call .index_one_pubdef
  1924 00000BF9 8B4EEC                  	mov cx, [bp + ?length]
  1925 00000BFC 88C8                    	mov al, cl
  1926 00000BFE 0404                    	add al, string_.end.size
  1927 00000C00 AA                      	stosb			; string length
  1928 00000C01 BE[0000]                	mov si, name_field
  1929 00000C04 F3A4                    	rep movsb		; string
  1930 00000C06 BE[1800]                	mov si, string_.end
  1931 00000C09 B104                    	mov cl, string_.end.size
  1932 00000C0B F3A4                    	rep movsb
  1933 00000C0D 8B46E4                  	mov ax, word [bp + ?ledatabase]
  1934 00000C10 AB                      	stosw			; offset
  1935 00000C11 E89700                  	call .finish_one_pubdef
  1936                                  
  1937 00000C14 E85F00                  	call .prepare_one_pubdef
  1938                                  
  1939 00000C17 31C0                    	xor ax, ax
  1940 00000C19 AB                      	stosw			; group, segment
  1941 00000C1A AB                      	stosw			; frame
  1942                                  
  1943 00000C1B 8B4EEC                  	mov cx, [bp + ?length]
  1944 00000C1E 88C8                    	mov al, cl
  1945 00000C20 0407                    	add al, string_.amount.size
  1946 00000C22 AA                      	stosb			; string length
  1947 00000C23 BE[0000]                	mov si, name_field
  1948 00000C26 F3A4                    	rep movsb		; string
  1949 00000C28 BE[1C00]                	mov si, string_.amount
  1950 00000C2B B107                    	mov cl, string_.amount.size
  1951 00000C2D F3A4                    	rep movsb
  1952 00000C2F 58                      	pop ax
  1953 00000C30 D1E8                    	shr ax, 1		; = count of entries
  1954 00000C32 AB                      	stosw			; offset
  1955 00000C33 E87500                  	call .finish_one_pubdef
  1956                                  
  1957 00000C36 8B56FC                  	mov dx, word [bp + ?seektemp]
  1958 00000C39 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  1959 00000C3C B000                    	mov al, 0
  1960 00000C3E E86705                  	call .seektemp
  1961                                  
  1962 00000C41 B90A00                  	mov cx, TEMPWLLIST_size
  1963 00000C44 E88205                  	call .readtemp0
  1964 00000C47 8A160000                	mov dl, [twlLength]
  1965 00000C4B 31C9                    	xor cx, cx		; cx:dx = length
  1966 00000C4D B001                    	mov al, 1		; current
  1967 00000C4F E85605                  	call .seektemp
  1968                                  
  1969 00000C52 E999FE                  	jmp .loop_outer_collect_items
  1970                                  
  1971                                  .internal40:
  1972 00000C55 B92800                  	mov cx, 40
  1973 00000C58 EB03                    	jmp .internal_j2
  1974                                  
  1975                                  .internal38:
  1976 00000C5A B92600                  	mov cx, 38
  1977                                  .internal_j2:
  1978 00000C5D E9DFF7                  	jmp .internal
  1979                                  
  1980                                  .get_size:
  1981 00000C60 8B56F2                  	mov dx, word [bp + ?buffer + twlSegdefSizeOffset]
  1982 00000C63 8B4EF4                  	mov cx, word [bp + ?buffer + twlSegdefSizeOffset + 2]
  1983 00000C66 B000                    	mov al, 0
  1984 00000C68 E84C05                  	call .seekobj
  1985                                  
  1986 00000C6B 50                      	push ax
  1987 00000C6C 89E2                    	mov dx, sp
  1988 00000C6E B90200                  	mov cx, 2
  1989 00000C71 E8E905                  	call .readobj_ssdx
  1990 00000C74 58                      	pop ax
  1991 00000C75 C3                      	retn
  1992                                  
  1993                                  .prepare_one_pubdef:
  1994 00000C76 31C9                    	xor cx, cx
  1995 00000C78 31D2                    	xor dx, dx
  1996 00000C7A B002                    	mov al, 2
  1997 00000C7C E83805                  	call .seekobj
  1998                                  
  1999 00000C7F 06                      	push es
  2000 00000C80 268E06[0000]            	mov es, [es:buffer_base]
  2001 00000C85 BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  2002 00000C88 89FA                    	mov dx, di
  2003 00000C8A B090                    	mov al, PUBDEF
  2004 00000C8C AA                      	stosb
  2005 00000C8D AF                      	scasw
  2006 00000C8E 1F                      	pop ds			; => DGROUP
  2007 00000C8F C3                      	retn
  2008                                  
  2009                                  .index_one_pubdef:
  2010 00000C90 8A46F1                  	mov al, [bp + ?buffer + twlGroupIndex]
  2011 00000C93 84C0                    	test al, al
  2012 00000C95 7905                    	jns @F
  2013 00000C97 26C60580                	mov byte [es:di], 80h
  2014 00000C9B 47                      	inc di
  2015                                  @@:
  2016 00000C9C AA                      	stosb			; group
  2017 00000C9D 8A46F0                  	mov al, [bp + ?buffer + twlSegmentIndex]
  2018 00000CA0 84C0                    	test al, al
  2019 00000CA2 7905                    	jns @F
  2020 00000CA4 26C60580                	mov byte [es:di], 80h
  2021 00000CA8 47                      	inc di
  2022                                  @@:
  2023 00000CA9 AA                      	stosb			; segment
  2024 00000CAA C3                      	retn
  2025                                  
  2026                                  .finish_one_pubdef:
  2027 00000CAB 31C0                    	xor ax, ax
  2028 00000CAD AA                      	stosb			; type
  2029 00000CAE 47                      	inc di			; checksum
  2030 00000CAF 1E                      	push ds
  2031 00000CB0 07                      	pop es			; => DGROUP
  2032 00000CB1 268E1E[0000]            	mov ds, [es:buffer_base]
  2033 00000CB6 89F9                    	mov cx, di
  2034 00000CB8 29D1                    	sub cx, dx
  2035 00000CBA 89C8                    	mov ax, cx
  2036 00000CBC 83E803                  	sub ax, 3
  2037 00000CBF A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  2038 00000CC2 E8CA04                  	call .checksum_dsdx
  2039 00000CC5 E86305                  	call .writeobj_dsdx
  2040 00000CC8 C3                      	retn
  2041                                  
  2042                                  .collect_repeated_ledata:
  2043 00000CC9 8B4ED6                  	mov cx, [bp + ?ledata_skip_repeated]
  2044 00000CCC 51                      	push cx
  2045 00000CCD 31C0                    	xor ax, ax		; first item = 0
  2046 00000CCF 29CB                    	sub bx, cx		; bx = how many remain
  2047 00000CD1 723A                    	jb .internal45
  2048 00000CD3 E304                    	jcxz @FF		; not a partial repeated tempwllist -->
  2049                                  @@:
  2050 00000CD5 01D0                    	add ax, dx		; increase adjust for next item
  2051 00000CD7 E2FC                    	loop @B			; ax += cx * dx
  2052                                  @@:
  2053 00000CD9 89D9                    	mov cx, bx		; number of items to do (at most)
  2054 00000CDB 5B                      	pop bx			; = how many to skip next
  2055 00000CDC 8B7EDA                  	mov di, word [bp + ?ledata_next_offset]
  2056 00000CDF 06                      	push es
  2057 00000CE0 268E06[0000]            	mov es, word [es:buffer_base]
  2058                                  				; es:di -> ledata image next word
  2059 00000CE5 E310                    	jcxz @FF
  2060                                  @@:
  2061 00000CE7 AB                      	stosw			; store item adjust
  2062 00000CE8 01D0                    	add ax, dx		; increase adjust
  2063 00000CEA 43                      	inc bx			; processed 1 more, count how many to skip next
  2064 00000CEB 897EDA                  	mov word [bp + ?ledata_next_offset], di
  2065                                  				; store -> next
  2066 00000CEE 3B7ED8                  	cmp di, word [bp + ?ledata_end_offset]
  2067                                  				; are we done ?
  2068 00000CF1 7714                    	ja .internal44		; error -->
  2069 00000CF3 7407                    	je .collect_repeated_ledata_return_to_loop_caller
  2070 00000CF5 E2F0                    	loop @B			; loop for number of items
  2071                                  @@:
  2072 00000CF7 894ED6                  	mov word [bp + ?ledata_skip_repeated], cx
  2073                                  				; = 0, next call shouldn't skip partial rep
  2074 00000CFA 07                      	pop es
  2075 00000CFB C3                      	retn			; return to .inner_collect loop
  2076                                  
  2077                                  .collect_repeated_ledata_return_to_loop_caller:
  2078 00000CFC 895ED6                  	mov word [bp + ?ledata_skip_repeated], bx
  2079                                  				; store how many to skip next time (if partial)
  2080 00000CFF E203                    	loop @F			; branch if cx != 1
  2081 00000D01 894ED6                  	mov word [bp + ?ledata_skip_repeated], cx
  2082                                  				; store a zero instead (no more partial rep)
  2083                                  @@:
  2084 00000D04 07                      	pop es
  2085 00000D05 58                      	pop ax			; discard a near return address so that
  2086                                  				;  we return to .inner_collect_partial caller
  2087 00000D06 C3                      	retn
  2088                                  
  2089                                  .internal44:
  2090 00000D07 B92C00                  	mov cx, 44
  2091 00000D0A E932F7                  	jmp .internal
  2092                                  
  2093                                  .internal45:
  2094 00000D0D B92D00                  	mov cx, 45
  2095 00000D10 E92CF7                  	jmp .internal
  2096                                  
  2097                                  .collect_size:
  2098 00000D13 83FB01                  	cmp bx, 1
  2099 00000D16 7404                    	je @F
  2100 00000D18 C646EAFF                	mov byte [bp + ?repeatseen], -1
  2101                                  @@:
  2102 00000D1C 53                      	push bx
  2103 00000D1D E840FF                  	call .get_size
  2104 00000D20 5B                      	pop bx
  2105 00000D21 01DB                    	add bx, bx
  2106 00000D23 01D8                    	add ax, bx		; count relocs (1 word per reloc)
  2107 00000D25 50                      	push ax
  2108 00000D26 BAFEFF                  	mov dx, -2
  2109 00000D29 B9FFFF                  	mov cx, -1
  2110 00000D2C B001                    	mov al, 1
  2111 00000D2E E88604                  	call .seekobj
  2112 00000D31 89E2                    	mov dx, sp
  2113 00000D33 B90200                  	mov cx, 2
  2114 00000D36 E8F304                  	call .writeobj_ssdx
  2115 00000D39 58                      	pop ax
  2116 00000D3A C3                      	retn
  2117                                  
  2118                                  .collect_list:
  2119 00000D3B 53                      	push bx
  2120 00000D3C 1E                      	push ds
  2121                                  
  2122 00000D3D 06                      	 push es
  2123 00000D3E 1F                      	 pop ds
  2124 00000D3F 803E[0000]01            	cmp byte [_wllist_debug_flag], 1
  2125 00000D44 720E                    	jb @F
  2126 00000D46 BE[2300]                	mov si, msg_used_prefix
  2127                                   extern cmsg
  2128 00000D49 E8(0000)                	call cmsg
  2129 00000D4C 1F                      	pop ds
  2130 00000D4D BE0A00                  	mov si, TEMPWLLIST_size
  2131                                   extern zmsg
  2132 00000D50 E8(0000)                	call zmsg
  2133 00000D53 A8                      	db __TEST_IMM8		; skip pop
  2134                                  
  2135                                  @@:
  2136 00000D54 1F                      	pop ds
  2137 00000D55 5B                      	pop bx
  2138                                  
  2139 00000D56 85DB                    	test bx, bx
  2140 00000D58 747B                    	jz .collect_list_empty
  2141                                  .collect_list_loop:
  2142 00000D5A 53                      	push bx
  2143                                  		; first check if next LEDATA chunk needed
  2144 00000D5B 817EE28000              	cmp word [bp + ?ledatadone], LEDATA_LIMIT
  2145 00000D60 7221                    	jb @F
  2146                                  .new_ledata:
  2147 00000D62 E86801                  	call .dump_fixupp
  2148 00000D65 E89500                  	call .emit_ledata
  2149 00000D68 7213                    	jc .internal41
  2150                                  
  2151                                  		; read back the tempwllist entry being processed
  2152                                  		;  as it could be overwritten by .emit_ledata
  2153 00000D6A 8B56F8                  	mov dx, word [bp + ?seektempinner]
  2154 00000D6D 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  2155 00000D70 B000                    	mov al, 0
  2156 00000D72 E83304                  	call .seektemp
  2157                                  
  2158 00000D75 B90A00                  	mov cx, TEMPWLLIST_size
  2159 00000D78 E84E04                  	call .readtemp0
  2160                                  
  2161 00000D7B EB1F                    	jmp .new_ledata_prepare_fixupp
  2162                                  
  2163                                  .internal41:
  2164 00000D7D B92900                  	mov cx, 41
  2165 00000D80 E9BCF6                  	jmp .internal
  2166                                  
  2167                                  @@:
  2168                                  		; now get a pointer to prepared FIXUPP
  2169                                  		;  and find whether next part fits into this record
  2170 00000D83 8B7EDC                  	mov di, word [bp + ?behindpartialrecord]
  2171 00000D86 89F8                    	mov ax, di
  2172 00000D88 83C006                  	add ax, 5 + 1		; EXTDEF >= 128 needs 5 bytes per fixup
  2173 00000D8B 720C                    	jc .new_fixupp
  2174 00000D8D 3D0A05                  	cmp ax, TEMPSTRINGWLLIST_size + 1024
  2175 00000D90 7707                    	ja .new_fixupp
  2176 00000D92 263B06[0000]            	cmp ax, word [es:buffer_end]
  2177 00000D97 7606                    	jbe .append_fixupp
  2178                                  .new_fixupp:
  2179 00000D99 E83101                  	call .dump_fixupp
  2180                                  
  2181                                  .new_ledata_prepare_fixupp:
  2182 00000D9C E81B01                  	call .prepare_fixupp
  2183                                  
  2184                                  .append_fixupp:
  2185 00000D9F 06                      	push es
  2186 00000DA0 1E                      	 push ds
  2187 00000DA1 07                      	 pop es
  2188                                  %if 0
  2189                                  
  2190                                  example: C4 38 56 01
  2191                                  
  2192                                  9c FIXUPP16      5 bytes, checksum 0C (valid)
  2193                                  ;   FIXUP  segment-relative, type 1 (16-bit offset)
  2194                                            record offset 0038
  2195                                            frame method F5 (TARGET index)
  2196                                            target method T6 (EXTDEF) index 0001 'extlabel'
  2197                                     0000: c4 38 56 01                                      :  .8V.
  2198                                  
  2199                                  C4: 1100_0100 FIXUP, M=1 segment-relative, Location=1 (16-bit offset)
  2200                                  38		(steals bottom two bits of C4 as top bits, ie 038)
  2201                                  56: 0101_0110 F=0 Frame=5 T=0 P=1 Targt=2 (P+Targt=6)
  2202                                  01
  2203                                  
  2204                                  %endif
  2205                                  
  2206 00000DA2 8B46E2                  	mov ax, word [bp + ?ledatadone]	; -> offset in last LEDATA
  2207 00000DA5 8346E202                	add word [bp + ?ledatadone], 2	; increase for next user
  2208                                  
  2209 00000DA9 86C4                    	xchg al, ah			; get data record offset in order
  2210 00000DAB A8FC                    	test al, 1111_1100b		; mustn't be > 10 bits
  2211 00000DAD 7406                    	jz @F
  2212                                  .internal39:
  2213 00000DAF B92700                  	mov cx, 39
  2214 00000DB2 E98AF6                  	jmp .internal
  2215                                  @@:
  2216 00000DB5 0CC4                    	or al, 0C4h			; FIXUP, M=1, Location=1
  2217 00000DB7 AB                      	stosw				; store the data record offset + bits
  2218                                  
  2219 00000DB8 B056                    	mov al, 56h
  2220 00000DBA AA                      	stosb
  2221                                  
  2222 00000DBB A10400                  	mov ax, word [twlExtdefIndex]
  2223 00000DBE A980FF                  	test ax, 0FF80h
  2224 00000DC1 7409                    	jz @F
  2225 00000DC3 80F480                  	xor ah, 80h
  2226 00000DC6 792F                    	jns .internal42
  2227 00000DC8 268825                  	mov byte [es:di], ah
  2228 00000DCB 47                      	inc di
  2229                                  @@:
  2230 00000DCC AA                      	stosb
  2231                                  
  2232 00000DCD 07                      	pop es
  2233 00000DCE 897EDC                  	mov word [bp + ?behindpartialrecord], di
  2234                                  
  2235 00000DD1 5B                      	pop bx
  2236 00000DD2 4B                      	dec bx
  2237 00000DD3 7585                    	jnz .collect_list_loop
  2238                                  .collect_list_empty:
  2239                                  
  2240                                  		; modify the tempwllist entry to mark it used
  2241 00000DD5 C606010003              	mov byte [twlListUsed], twlUsedListItem
  2242                                  
  2243                                  		; write the tempwllist entry to update it
  2244 00000DDA 8B56F8                  	mov dx, word [bp + ?seektempinner]
  2245 00000DDD 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  2246 00000DE0 B000                    	mov al, 0
  2247 00000DE2 E8C303                  	call .seektemp
  2248                                  
  2249 00000DE5 B90A00                  	mov cx, TEMPWLLIST_size
  2250 00000DE8 E81C04                  	call .writetemp0
  2251                                  
  2252                                  		; seek past the label name
  2253 00000DEB 8A160000                	mov dl, byte [twlLength]
  2254 00000DEF 31C9                    	xor cx, cx
  2255 00000DF1 B001                    	mov al, 1
  2256 00000DF3 E8B203                  	call .seektemp
  2257                                  
  2258 00000DF6 C3                      	retn
  2259                                  
  2260                                  .internal42:
  2261 00000DF7 B92A00                  	mov cx, 42
  2262 00000DFA E942F6                  	jmp .internal
  2263                                  
  2264                                  .emit_ledata:
  2265 00000DFD 8366E200                	and word [bp + ?ledatadone], 0
  2266                                  
  2267 00000E01 816EE68000              	sub word [bp + ?ledataremaining], LEDATA_LIMIT
  2268 00000E06 7205                    	jb .last_ledata
  2269                                  .full_ledata:
  2270 00000E08 BE8000                  	mov si, LEDATA_LIMIT
  2271 00000E0B EB10                    	jmp .write_ledata
  2272                                  
  2273                                  .last_ledata:
  2274 00000E0D 8B76E6                  	mov si, word [bp + ?ledataremaining]
  2275 00000E10 8366E600                	and word [bp + ?ledataremaining], 0
  2276 00000E14 81C68000                	add si, LEDATA_LIMIT
  2277 00000E18 7503E99B00              	jz .done_ledata
  2278                                  
  2279                                  .write_ledata:
  2280 00000E1D 31D2                    	xor dx, dx
  2281 00000E1F 31C9                    	xor cx, cx
  2282 00000E21 B002                    	mov al, 2
  2283 00000E23 E89103                  	call .seekobj
  2284                                  
  2285 00000E26 268E1E[0000]                mov ds,[es:buffer_base]      ; DS:DX -> segment:offset of buffer area
  2286 00000E2B 06                          push es
  2287 00000E2C 1E                          push ds
  2288 00000E2D 07                          pop es
  2289 00000E2E 1F                          pop ds			; swap
  2290 00000E2F BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  2291 00000E32 B0A0                    	mov al, LEDATA
  2292 00000E34 AA                      	stosb
  2293 00000E35 AF                      	scasw			; size
  2294 00000E36 8A46F0                  	mov al, byte [bp + ?buffer + twlSegmentIndex]
  2295 00000E39 84C0                    	test al, al
  2296 00000E3B 7905                    	jns @F
  2297 00000E3D 26C60580                	mov byte [es:di], 80h
  2298 00000E41 47                      	inc di
  2299                                  @@:
  2300 00000E42 AA                      	stosb
  2301 00000E43 8B46E4                  	mov ax, [bp + ?ledatabase]
  2302 00000E46 0176E4                  	add word [bp + ?ledatabase], si
  2303 00000E49 AB                      	stosw
  2304                                  @@:
  2305 00000E4A 31C0                    	xor ax, ax
  2306 00000E4C 89F1                    	mov cx, si
  2307                                  
  2308 00000E4E D046EA                  	rol byte [bp + ?repeatseen], 1
  2309 00000E51 7347                    	jnc .ledata_no_repeat
  2310                                  
  2311 00000E53 57                      	push di
  2312 00000E54 F3AA                    	rep stosb
  2313 00000E56 897ED8                  	mov word [bp + ?ledata_end_offset], di
  2314 00000E59 5F                      	pop di
  2315 00000E5A 897EDA                  	mov word [bp + ?ledata_next_offset], di
  2316                                  
  2317 00000E5D 06                          push es
  2318 00000E5E 1E                          push ds
  2319 00000E5F 07                          pop es
  2320 00000E60 1F                          pop ds			; swap back
  2321                                  
  2322 00000E61 31C9                    	xor cx, cx
  2323 00000E63 31D2                    	xor dx, dx
  2324 00000E65 B001                    	mov al, 1
  2325 00000E67 E83E03                  	call .seektemp
  2326 00000E6A 52                      	push dx
  2327 00000E6B 50                      	push ax			; stack current seek
  2328 00000E6C 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  2329 00000E6F 8B56F8                  	mov dx, word [bp + ?seektempinner]
  2330 00000E72 51                      	push cx
  2331 00000E73 52                      	push dx			; stack currently saved seek
  2332 00000E74 B000                    	mov al, 0
  2333 00000E76 E82F03                  	call .seektemp		; seek to it too, and dx:ax = seek
  2334 00000E79 FF76E8                  	push word [bp + ?collectfunction]
  2335 00000E7C C746E8[C90C]            	mov word [bp + ?collectfunction], .collect_repeated_ledata
  2336 00000E81 E87E00                  	call .inner_collect_partial
  2337 00000E84 8F46E8                  	pop word [bp + ?collectfunction]
  2338 00000E87 8F46F8                  	pop word [bp + ?seektempinner]
  2339 00000E8A 8F46FA                  	pop word [bp + ?seektempinner + 2]
  2340                                  				; reset saved seek
  2341 00000E8D 5A                      	pop dx
  2342 00000E8E 59                      	pop cx
  2343 00000E8F B000                    	mov al, 0
  2344 00000E91 E81403                  	call .seektemp		; and reset current seek
  2345                                  
  2346 00000E94 8B7EDA                  	mov di, word [bp + ?ledata_next_offset]
  2347 00000E97 47                      	inc di
  2348 00000E98 EB07                    	jmp @F
  2349                                  
  2350                                  .ledata_no_repeat:
  2351 00000E9A F3AA                    	rep stosb
  2352 00000E9C 47                      	inc di			; -> past checksum byte
  2353                                  
  2354 00000E9D 06                          push es
  2355 00000E9E 1E                          push ds
  2356 00000E9F 07                          pop es
  2357 00000EA0 1F                          pop ds			; swap back
  2358                                  
  2359                                  @@:
  2360 00000EA1 89F9                    	mov cx, di
  2361 00000EA3 BA0A01                  	mov dx, TEMPSTRINGWLLIST_size
  2362 00000EA6 29D1                    	sub cx, dx
  2363 00000EA8 89C8                    	mov ax, cx
  2364 00000EAA 83E803                  	sub ax, 3
  2365 00000EAD A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  2366 00000EB0 E8DC02                  	call .checksum_dsdx
  2367 00000EB3 E87503                  	call .writeobj_dsdx
  2368 00000EB6 F8                      	clc
  2369 00000EB7 C3                      	retn
  2370                                  
  2371                                  .done_ledata:
  2372 00000EB8 F9                      	stc
  2373 00000EB9 C3                      	retn
  2374                                  
  2375                                  
  2376                                  .prepare_fixupp:
  2377 00000EBA 268E1E[0000]            	mov ds, [es:buffer_base]
  2378 00000EBF BF0A01                  	mov di, TEMPSTRINGWLLIST_size
  2379 00000EC2 B09C                    	mov al, FIXUPP
  2380 00000EC4 8805                    	mov byte [di], al
  2381 00000EC6 83C703                  	add di, 3
  2382 00000EC9 897EDC                  	mov word [bp + ?behindpartialrecord], di
  2383 00000ECC C3                      	retn
  2384                                  
  2385                                  .dump_fixupp:
  2386 00000ECD 31C9                    	xor cx, cx
  2387 00000ECF 31D2                    	xor dx, dx
  2388 00000ED1 B002                    	mov al, 2
  2389 00000ED3 E8E102                  	call .seekobj
  2390                                  
  2391 00000ED6 268E1E[0000]            	mov ds, [es:buffer_base]
  2392 00000EDB 8B4EDC                  	mov cx, word [bp + ?behindpartialrecord]
  2393 00000EDE 81F90D01                	cmp cx, TEMPSTRINGWLLIST_size + 3
  2394 00000EE2 7614                    	jbe @F
  2395 00000EE4 41                      	inc cx
  2396 00000EE5 BA0A01                  	mov dx, TEMPSTRINGWLLIST_size
  2397 00000EE8 29D1                    	sub cx, dx
  2398 00000EEA 89C8                    	mov ax, cx
  2399 00000EEC 83E803                  	sub ax, 3
  2400 00000EEF A30B01                  	mov word [TEMPSTRINGWLLIST_size + 1], ax
  2401 00000EF2 E89A02                  	call .checksum_dsdx
  2402 00000EF5 E83303                  	call .writeobj_dsdx
  2403                                  @@:
  2404 00000EF8 C3                      	retn
  2405                                  
  2406                                  
  2407                                  .inner_collect:
  2408 00000EF9 31C9                    	xor cx, cx
  2409 00000EFB 31D2                    	xor dx, dx		; cx:dx = 0
  2410 00000EFD B000                    	mov al, 0		; SOF
  2411 00000EFF E8A602                  	call .seektemp
  2412                                  
  2413                                  .loop_inner_collect_items:
  2414                                  .inner_collect_partial:
  2415 00000F02 8946F8                  	mov word [bp + ?seektempinner], ax
  2416 00000F05 8956FA                  	mov word [bp + ?seektempinner + 2], dx
  2417                                  
  2418 00000F08 B90A00                  	mov cx, TEMPWLLIST_size
  2419 00000F0B E8D002                  	call .readtemp0_maybe_eof
  2420 00000F0E 740A                    	je @F
  2421 00000F10 85C0                    	test ax, ax
  2422 00000F12 7503E99C00              	jz .end_inner_collect_items
  2423 00000F17 E972F5                  	jmp .internal27
  2424                                  
  2425                                  @@:
  2426 00000F1A 8A160000                	mov dl, byte [twlLength]
  2427 00000F1E 31C9                    	xor cx, cx		; cx:dx = length
  2428 00000F20 B001                    	mov al, 1		; current
  2429 00000F22 E88302                  	call .seektemp
  2430                                  
  2431 00000F25 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  2432 00000F2A 75D6                    	jne .loop_inner_collect_items
  2433                                  
  2434 00000F2C 8B56F8                  	mov dx, word [bp + ?seektempinner]
  2435 00000F2F 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  2436 00000F32 83C20A                  	add dx, TEMPWLLIST_size
  2437 00000F35 83D100                  	adc cx, 0
  2438 00000F38 B000                    	mov al, 0
  2439 00000F3A E86B02                  	call .seektemp
  2440                                  
  2441 00000F3D 31C9                    	xor cx, cx
  2442 00000F3F 8A0E0000                	mov cl, [twlLength]
  2443 00000F43 BA0A00                  	mov dx, TEMPWLLIST_size
  2444 00000F46 E88602                  	call .readtemp
  2445                                  
  2446 00000F49 BB0100                  	mov bx, 1
  2447 00000F4C E80F02                  	call .skipprefix
  2448 00000F4F 89DA                    	mov dx, bx
  2449 00000F51 3C52                    	cmp al, twlRepeat
  2450 00000F53 7515                    	jne @F
  2451 00000F55 52                      	push dx
  2452                                   extern _wlcalc_parse_number
  2453 00000F56 E8(0000)                	call _wlcalc_parse_number
  2454 00000F59 7303E99301              	jc .repeat_number_invalid_error
  2455 00000F5E 85D2                    	test dx, dx
  2456 00000F60 7403E99101              	jnz .repeat_number_overflow_error
  2457 00000F65 5A                      	pop dx
  2458 00000F66 93                      	xchg bx, ax
  2459 00000F67 E81F02                  	call .skipunder
  2460                                  @@:
  2461 00000F6A 3C57                    	cmp al, twlWidth
  2462 00000F6C 7515                    	jne @F
  2463 00000F6E 53                      	push bx
  2464                                   extern _wlcalc_parse_number
  2465 00000F6F E8(0000)                	call _wlcalc_parse_number
  2466 00000F72 5B                      	pop bx
  2467 00000F73 7303E96F01              	jc .width_number_invalid_error
  2468 00000F78 85D2                    	test dx, dx
  2469 00000F7A 7403E96D01              	jnz .width_number_overflow_error
  2470 00000F7F 92                      	xchg dx, ax
  2471 00000F80 E80602                  	call .skipunder
  2472                                  @@:
  2473 00000F83 3C4C                    	cmp al, twlList
  2474 00000F85 7403E95801              	jne .invalid_list_item_error
  2475 00000F8A E8FC01                  	call .skipunder
  2476 00000F8D 4E                      	dec si
  2477 00000F8E BF[0000]                	mov di, name_field
  2478 00000F91 8B4EEC                  	mov cx, word [bp + ?length]
  2479 00000F94 85FF                    	test di, di
  2480 00000F96 F3A6                    	repe cmpsb
  2481                                  @@:
  2482 00000F98 750D                    	jne .next_inner_collect_items
  2483 00000F9A 803C3F                  	cmp byte [si], '?'
  2484 00000F9D 7405                    	je @F
  2485 00000F9F 803C00                  	cmp byte [si], 0
  2486 00000FA2 75F4                    	jne @B
  2487                                  @@:
  2488                                  
  2489 00000FA4 FF56E8                  	call near [bp + ?collectfunction]
  2490                                  .next_inner_collect_items:
  2491 00000FA7 31D2                    	xor dx, dx
  2492 00000FA9 31C9                    	xor cx, cx
  2493 00000FAB B001                    	mov al, 1
  2494 00000FAD E8F801                  	call .seektemp
  2495 00000FB0 E94FFF                  	jmp .loop_inner_collect_items
  2496                                  
  2497                                  .end_inner_collect_items:
  2498 00000FB3 C3                      	retn
  2499                                  
  2500                                  
  2501                                  .end_collect_items:
  2502                                  
  2503 00000FB4 C746E60100              	mov word [bp + ?currentindex], 1
  2504 00000FB9 31C9                    	xor cx, cx
  2505 00000FBB 31D2                    	xor dx, dx		; cx:dx = 0
  2506 00000FBD B000                    	mov al, 0		; SOF
  2507 00000FBF E8E601                  	call .seektemp
  2508                                  
  2509                                  .loop_check_remaining:
  2510 00000FC2 8946FC                  	mov word [bp + ?seektemp], ax
  2511 00000FC5 8956FE                  	mov word [bp + ?seektemp + 2], dx
  2512                                  
  2513 00000FC8 B90A00                  	mov cx, TEMPWLLIST_size
  2514 00000FCB E81002                  	call .readtemp0_maybe_eof
  2515 00000FCE 7407                    	je @F
  2516 00000FD0 85C0                    	test ax, ax
  2517 00000FD2 7418                    	jz .end_check_remaining
  2518 00000FD4 E9B5F4                  	jmp .internal27
  2519                                  
  2520                                  @@:
  2521 00000FD7 8A160000                	mov dl, byte [twlLength]
  2522 00000FDB 31C9                    	xor cx, cx		; cx:dx = length
  2523 00000FDD B001                    	mov al, 1		; current
  2524 00000FDF E8C601                  	call .seektemp
  2525                                  
  2526 00000FE2 803E010000              	cmp byte [twlListUsed], twlUsedInitial
  2527 00000FE7 75D9                    	jne .loop_check_remaining
  2528 00000FE9 E91F01                  	jmp .unknown_list_error
  2529                                  
  2530                                  .end_check_remaining:
  2531                                  
  2532 00000FEC 31C9                    	xor cx, cx
  2533 00000FEE 31D2                    	xor dx, dx
  2534 00000FF0 B000                    	mov al, 0
  2535 00000FF2 E8C201                  	call .seekobj		; SOF
  2536                                  
  2537                                  .loop_fix_segdef:
  2538 00000FF5 52                      	push dx
  2539 00000FF6 50                      	push ax			; preserve seek
  2540 00000FF7 B90300                  	mov cx, 3
  2541 00000FFA E86502                  	call .readobj0_maybe_eof; read OMF record
  2542 00000FFD 7407                    	je @F
  2543 00000FFF 85C0                    	test ax, ax		; EOF ?
  2544 00001001 744D                    	jz .end_fix_segdef	; yes -->
  2545 00001003 E986F4                  	jmp .internal27
  2546                                  
  2547                                  @@:
  2548 00001006 803E000098              	cmp byte [0], SEGDEF	; a segdef record ?
  2549 0000100B 740F                    	je .do_fix_segdef	; yes -->
  2550                                  
  2551 0000100D 5A                      	pop dx
  2552 0000100E 5A                      	pop dx			; discard seek on stack
  2553 0000100F 8B160100                	mov dx, word [1]	; length of record (not including header)
  2554 00001013 31C9                    	xor cx, cx		; cx:dx = length
  2555 00001015 B001                    	mov al, 1
  2556 00001017 E89D01                  	call .seekobj		; seek past record
  2557 0000101A EBD9                    	jmp .loop_fix_segdef
  2558                                  
  2559                                  .do_fix_segdef:
  2560 0000101C 8B0E0100                	mov cx, word [1]	; get record length
  2561 00001020 81F9FA00                	cmp cx, 250		; validate
  2562 00001024 7606                    	jbe @F
  2563 00001026 B93700                  	mov cx, 55		; internal error value
  2564 00001029 E913F4                  	jmp .internal
  2565                                  
  2566                                  @@:
  2567 0000102C B203                    	mov dl, 3		; read so entire record is at buffer:0
  2568 0000102E E82202                  	call .readobj
  2569                                  
  2570 00001031 5A                      	pop dx
  2571 00001032 58                      	pop ax			; ! ax:dx = seek
  2572 00001033 91                      	xchg cx, ax		; cx:dx = seek
  2573 00001034 0403                    	add al, 3		; ax = length of record including header
  2574 00001036 50                      	push ax
  2575 00001037 B000                    	mov al, 0
  2576 00001039 E87B01                  	call .seekobj		; seek back to start of record
  2577 0000103C 59                      	pop cx			; = length including header
  2578                                  
  2579 0000103D 31D2                    	xor dx, dx
  2580 0000103F E84D01                  	call .checksum_dsdx	; do the checksum
  2581 00001042 E8E601                  	call .writeobj_dsdx	; rewrite record
  2582                                  
  2583 00001045 31C9                    	xor cx, cx
  2584 00001047 31D2                    	xor dx, dx
  2585 00001049 B001                    	mov al, 1
  2586 0000104B E86901                  	call .seekobj		; get current seek
  2587 0000104E EBA5                    	jmp .loop_fix_segdef
  2588                                  
  2589                                  .end_fix_segdef:		; seek on stack left, lleave cleans it
  2590                                  
  2591                                  .end_after_warning:
  2592 00001050 31C9                    	xor cx, cx
  2593 00001052 31D2                    	xor dx, dx		; cx:dx = 0
  2594 00001054 B002                    	mov al, 2		; EOF
  2595 00001056 E85E01                  	call .seekobj
  2596                                  
  2597 00001059 06                      	push es
  2598 0000105A 1F                      	pop ds
  2599 0000105B BA[3900]                	mov dx, data_modend
  2600 0000105E B90500                  	mov cx, data_modend.size
  2601 00001061 E8C701                  	call .writeobj_dsdx
  2602                                  
  2603 00001064 B43E                    	mov ah, 3Eh
  2604 00001066 CD21                    	int 21h			; close obj
  2605 00001068 830E[0000]FF            	or word [_wllist_obj_handle], -1
  2606 0000106D 89EC5D                  	lleave code
  2607 00001070 C3                      	retn
  2608                                  
  2609                                  
  2610                                  .findsegdef:
  2611 00001071 31C9                    	xor cx, cx
  2612 00001073 31D2                    	xor dx, dx		; cx:dx = 0
  2613 00001075 B000                    	mov al, 0		; SOF
  2614 00001077 E83D01                  	call .seekobj
  2615 0000107A C746E60100              	mov word [bp + ?currentindex], 1
  2616                                  
  2617                                  .find_existing_segdef:
  2618 0000107F B90300                  	mov cx, 3
  2619 00001082 E8DD01                  	call .readobj0_maybe_eof
  2620 00001085 7407                    	je @F
  2621 00001087 85C0                    	test ax, ax
  2622 00001089 747B                    	jz .group_unknown_section_error
  2623 0000108B E90CF5                  	jmp .internal32
  2624                                  
  2625                                  @@:
  2626 0000108E 8B160100                	mov dx, word [1]
  2627 00001092 803E000098              	cmp byte [0], SEGDEF
  2628 00001097 740F                    	je @F
  2629 00001099 31C9                    	xor cx, cx		; cx:dx = length of record
  2630 0000109B B001                    	mov al, 1		; current
  2631 0000109D E81701                  	call .seekobj
  2632 000010A0 EBDD                    	jmp .find_existing_segdef
  2633                                  
  2634                                  .internal36:
  2635 000010A2 B92400                  	mov cx, 36
  2636 000010A5 E997F3                  	jmp .internal
  2637                                  
  2638                                  @@:
  2639 000010A8 83FA07                  	cmp dx, 7
  2640 000010AB 72F5                    	jb .internal36
  2641 000010AD 83FA08                  	cmp dx, 8
  2642 000010B0 77F0                    	ja .internal36
  2643                                  
  2644 000010B2 89D1                    	mov cx, dx
  2645 000010B4 E89601                  	call .readobj0
  2646 000010B7 803E000048              	cmp byte [0], 48h
  2647 000010BC 75E4                    	jne .internal36
  2648 000010BE 8B46E4                  	mov ax, word [bp + ?segmentlname]
  2649 000010C1 84E4                    	test ah, ah
  2650 000010C3 7403E9D2F4              	jnz .internal32
  2651 000010C8 84C0                    	test al, al
  2652 000010CA 7806                    	js @F
  2653 000010CC 38060300                	cmp byte [3], al
  2654 000010D0 EB08                    	jmp @FF
  2655                                  
  2656                                  @@:
  2657 000010D2 88C4                    	mov ah, al
  2658 000010D4 B080                    	mov al, 80h
  2659 000010D6 39060300                	cmp word [3], ax
  2660                                  @@:
  2661 000010DA 7405                    	je .found_existing_segdef
  2662 000010DC FF46E6                  	inc word [bp + ?currentindex]
  2663 000010DF EB9E                    	jmp .find_existing_segdef
  2664                                  
  2665                                  .found_existing_segdef:
  2666 000010E1 C3                      	retn
  2667                                  
  2668                                  
  2669                                  .invalid_list_item_error:
  2670 000010E2 B84E00                  	mov ax, _WLLIST_INVALID_LIST_ITEM_ERR
  2671 000010E5 EB12                    	jmp .inner_error
  2672                                  
  2673                                  .width_number_invalid_error:
  2674 000010E7 B84F00                  	mov ax, _WLLIST_WIDTH_NUMBER_INVALID_ERR
  2675 000010EA EB0D                    	jmp .inner_error
  2676                                  
  2677                                  .width_number_overflow_error:
  2678 000010EC B85000                  	mov ax, _WLLIST_WIDTH_NUMBER_OVERFLOW_ERR
  2679 000010EF EB08                    	jmp .inner_error
  2680                                  
  2681                                  .repeat_number_invalid_error:
  2682 000010F1 B85100                  	mov ax, _WLLIST_REPEAT_NUMBER_INVALID_ERR
  2683 000010F4 EB03                    	jmp .inner_error
  2684                                  
  2685                                  .repeat_number_overflow_error:
  2686 000010F6 B85200                  	mov ax, _WLLIST_REPEAT_NUMBER_OVERFLOW_ERR
  2687                                  	; jmp .inner_error
  2688                                  
  2689                                  		; INP:	ax = error code
  2690                                  .inner_error:
  2691 000010F9 8B56F8                  	mov dx, word [bp + ?seektempinner]
  2692 000010FC 8B4EFA                  	mov cx, word [bp + ?seektempinner + 2]
  2693 000010FF EB1D                    	jmp .tempwllist_error
  2694                                  
  2695                                  .no_section_error:
  2696 00001101 B85300                  	mov ax, _WLLIST_NO_SECTION_ERR
  2697 00001104 EB12                    	jmp .outer_error
  2698                                  
  2699                                  .group_unknown_section_error:
  2700 00001106 B85400                  	mov ax, _WLLIST_GROUP_UNKNOWN_SECTION_ERR
  2701 00001109 EB0D                    	jmp .outer_error
  2702                                  
  2703                                  .unknown_list_error:
  2704 0000110B B85500                  	mov ax, _WLLIST_UNKNOWN_LIST_ERR
  2705 0000110E EB08                    	jmp .outer_error
  2706                                  
  2707                                  .invalid_new_segment_error:
  2708 00001110 B85600                  	mov ax, _WLLIST_INVALID_NEW_SEGMENT_ERR
  2709 00001113 EB03                    	jmp .outer_error
  2710                                  
  2711                                  .group_multiple_error:
  2712 00001115 B85700                  	mov ax, _WLLIST_GROUP_MULTIPLE_ERR
  2713                                  	; jmp .outer_error
  2714                                  
  2715                                  		; INP:	ax = error code
  2716                                  .outer_error:
  2717 00001118 8B56FC                  	mov dx, word [bp + ?seektemp]
  2718 0000111B 8B4EFE                  	mov cx, word [bp + ?seektemp + 2]
  2719                                  
  2720                                  .tempwllist_error:
  2721                                  		; INP:	ax = error code
  2722                                  		;	cx:dx = seek in tempwllist file of erroneous entry
  2723                                  		;	es => DGROUP
  2724                                  		;	ds don't care
  2725 0000111E 50                      	push ax
  2726 0000111F B000                    	mov al, 0
  2727 00001121 E88400                  	call .seektemp			; -> G label
  2728 00001124 B90A00                  	mov cx, TEMPWLLIST_size
  2729 00001127 E89F00                  	call .readtemp0			; read header
  2730                                  
  2731 0000112A A10800                  	mov ax, word [twlObjIndex]
  2732 0000112D 26A3[0000]              	mov word [es:_wlcalc_obj_index], ax
  2733                                  
  2734 00001131 89CA                    	mov dx, cx
  2735 00001133 8A0E0000                	mov cl, byte [twlLength]
  2736 00001137 E89500                  	call .readtemp			; read label (ASCIZ)
  2737                                  
  2738 0000113A BF[0000]                	mov di, name_field		; es:di -> name field
  2739 0000113D 89D6                    	mov si, dx			; ds:si -> label
  2740 0000113F B98000                  	mov cx, words(256)
  2741 00001142 F3A5                    	rep movsw			; copy over
  2742                                   extern handle_wlcalc.get_object_filename
  2743                                   extern _wlcalc_obj_index
  2744 00001144 E8(0000)                	call handle_wlcalc.get_object_filename
  2745 00001147 58                      	pop ax
  2746                                  
  2747 00001148 26D006[0000]            	rol byte [es:is_wllist_error_as_warning], 1
  2748 0000114D 7309                    	jnc @F
  2749                                   extern link_warning
  2750                                  		; warning only
  2751 0000114F BF[0000]                	mov di, name_field
  2752 00001152 E8(0000)                	call link_warning	; give warning feedback
  2753 00001155 E9F8FE                  	jmp .end_after_warning
  2754                                  @@:
  2755                                  		; error on first unknown
  2756 00001158 B9[0000]                    mov cx,OFFSET name_field wrt DGROUP ; cx -> symbol name for this error
  2757 0000115B E9(0000)                    jmp NEAR PTR link_error	; transfer control to error handler
  2758                                  
  2759                                  	lleave ctx
  2760                                  
  2761                                  
  2762                                  .skipprefix:
  2763 0000115E 89D6                    	mov si, dx
  2764 00001160 813C2E2E                	cmp word [si], ".."
  2765 00001164 7509                    	jne @F
  2766 00001166 807C0240                	cmp byte [si + 2], '@'
  2767 0000116A 7503                    	jne @F
  2768 0000116C 83C603                  	add si, 3
  2769                                  @@:
  2770                                   extern string_wllist
  2771 0000116F BF[0000]                	mov di, string_wllist
  2772                                  @@:
  2773 00001172 A6                      	cmpsb
  2774 00001173 750C                    	jne .check
  2775 00001175 807CFF00                	cmp byte [si - 1], 0
  2776 00001179 75F7                    	jne @B
  2777                                  .internal29:
  2778 0000117B B91D00                      mov cx,29                ; internal error value
  2779 0000117E E9BEF2                  	jmp .internal
  2780                                  .check:
  2781 00001181 26807DFF00              	cmp byte [es:di - 1], 0
  2782 00001186 75F3                    	jne .internal29
  2783                                  .match:
  2784 00001188 4E                      	dec si
  2785                                  .skipunder:
  2786                                  @@:
  2787 00001189 AC                      	lodsb
  2788 0000118A 3C5F                    	cmp al, '_'
  2789 0000118C 74FB                    	je @B
  2790 0000118E C3                      	retn
  2791                                  
  2792                                  
  2793                                  .checksum_dsdx:
  2794 0000118F 51                      	push cx
  2795 00001190 56                      	push si
  2796 00001191 89D6                    	mov si, dx
  2797 00001193 31C0                    	xor ax, ax
  2798 00001195 49                      	dec cx
  2799 00001196 E80700                  	call .checksum_partial
  2800 00001199 F6DC                    	neg ah
  2801 0000119B 8824                    	mov byte [si], ah
  2802 0000119D 5E                      	pop si
  2803 0000119E 59                      	pop cx
  2804 0000119F C3                      	retn
  2805                                  
  2806                                  .checksum_partial:
  2807 000011A0 E305                    	jcxz @FF
  2808                                  @@:
  2809 000011A2 AC                      	lodsb
  2810 000011A3 00C4                    	add ah, al
  2811 000011A5 E2FB                    	loop @B
  2812                                  @@:
  2813 000011A7 C3                      	retn
  2814                                  
  2815                                  .seektemp:
  2816 000011A8 268B1E[0000]            	mov bx, word [es:_wllist_temp_handle]
  2817 000011AD B442                    	mov ah, 42h
  2818 000011AF CD21                    	int 21h
  2819 000011B1 E8(0000)                    call    restore_ems_map
  2820 000011B4 724B                    	jc .doserrortemp
  2821 000011B6 C3                      	retn
  2822                                  
  2823                                  .seekobj:
  2824 000011B7 268B1E[0000]            	mov bx, word [es:_wllist_obj_handle]
  2825 000011BC B442                    	mov ah, 42h
  2826 000011BE CD21                    	int 21h
  2827 000011C0 E8(0000)                    call    restore_ems_map
  2828 000011C3 7303E98000              	jc .doserrorobj
  2829 000011C8 C3                      	retn
  2830                                  
  2831                                  .readtemp0:
  2832 000011C9 E81200                  	call .readtemp0_maybe_eof
  2833                                  .temp_check_not_shortread:
  2834 000011CC 752B                    	jne .shortreadtemp
  2835 000011CE C3                      	retn
  2836                                  .readtemp:
  2837 000011CF E80E00                  	call .readtemp_maybe_eof
  2838 000011D2 EBF8                    	jmp .temp_check_not_shortread
  2839                                  .readtemp_dsdx:
  2840 000011D4 E80E00                  	call .readtemp_dsdx_maybe_eof
  2841 000011D7 EBF3                    	jmp .temp_check_not_shortread
  2842                                  .readtemp_ssdx:
  2843 000011D9 E80A00                  	call .readtemp_ssdx_maybe_eof
  2844 000011DC EBEE                    	jmp .temp_check_not_shortread
  2845                                  
  2846                                  .readtemp0_maybe_eof:
  2847 000011DE 31D2                        xor dx,dx
  2848                                  .readtemp_maybe_eof:
  2849 000011E0 268E1E[0000]                mov ds,[es:buffer_base]      ; DS:DX -> segment:offset of buffer area
  2850                                  .readtemp_dsdx_maybe_eof:
  2851 000011E5 A9                      	db __TEST_IMM16		; skip push, pop
  2852                                  .readtemp_ssdx_maybe_eof:
  2853 000011E6 16                      	push ss
  2854 000011E7 1F                      	pop ds
  2855 000011E8 268B1E[0000]            	mov bx, word [es:_wllist_temp_handle]
  2856 000011ED B43F                    	mov ah, 3Fh
  2857 000011EF CD21                    	int 21h
  2858 000011F1 E8(0000)                    call    restore_ems_map
  2859 000011F4 720E                    	jc .doserror
  2860 000011F6 39C8                    	cmp ax, cx
  2861 000011F8 C3                      	retn
  2862                                  
  2863                                  .shortreadtemp:
  2864 000011F9 B8FEFF                  	mov ax, -2		; short read code
  2865 000011FC EB03                    	jmp .doserrortemp
  2866                                  .shortwritetemp:
  2867 000011FE B82700                  	mov ax, 27h
  2868                                  .doserrortemp:
  2869 00001201 BA[0000]                    mov dx,OFFSET _wllist_temp_file_name wrt DGROUP
  2870                                  .doserror:
  2871 00001204 E9(0000)                    jmp dos_error		; error reading file
  2872                                  
  2873                                  
  2874                                  .writetemp0:
  2875 00001207 31D2                        xor dx,dx
  2876                                  .writetemp:
  2877 00001209 268E1E[0000]                mov ds,[es:buffer_base]      ; DS:DX -> segment:offset of buffer area
  2878                                  .writetemp_dsdx:
  2879 0000120E A9                      	db __TEST_IMM16		; skip push, pop
  2880                                  .writetemp_ssdx:
  2881 0000120F 16                      	push ss
  2882 00001210 1F                      	pop ds
  2883 00001211 268B1E[0000]            	mov bx, word [es:_wllist_temp_handle]
  2884 00001216 B440                    	mov ah, 40h
  2885 00001218 CD21                    	int 21h
  2886 0000121A E8(0000)                    call    restore_ems_map
  2887 0000121D 72E2                    	jc .doserrortemp
  2888 0000121F 39C8                    	cmp ax, cx
  2889 00001221 75DB                    	jne .shortwritetemp
  2890                                  .retn:
  2891 00001223 C3                      	retn
  2892                                  
  2893                                  .writeobj0:
  2894 00001224 31D2                        xor dx,dx
  2895                                  .writeobj:
  2896 00001226 268E1E[0000]                mov ds,[es:buffer_base]      ; DS:DX -> segment:offset of buffer area
  2897                                  .writeobj_dsdx:
  2898 0000122B A9                      	db __TEST_IMM16		; skip push, pop
  2899                                  .writeobj_ssdx:
  2900 0000122C 16                      	push ss
  2901 0000122D 1F                      	pop ds
  2902 0000122E 268B1E[0000]            	mov bx, word [es:_wllist_obj_handle]
  2903 00001233 B440                    	mov ah, 40h
  2904 00001235 CD21                    	int 21h
  2905 00001237 E8(0000)                    call    restore_ems_map
  2906 0000123A 720C                    	jc .doserrorobj
  2907 0000123C 39C8                    	cmp ax, cx
  2908 0000123E 74E3                    	je .retn
  2909                                  .shortwriteobj:
  2910 00001240 B82700                  	mov ax, 27h
  2911 00001243 EB03                    	jmp .doserrorobj
  2912                                  .shortreadobj:
  2913 00001245 B8FEFF                  	mov ax, -2		; short read code
  2914                                  .doserrorobj:
  2915 00001248 BA[0000]                    mov dx,OFFSET _wllist_obj_file_name wrt DGROUP
  2916 0000124B EBB7                        jmp .doserror		; error writing file
  2917                                  
  2918                                  .readobj0:
  2919 0000124D E81200                  	call .readobj0_maybe_eof
  2920                                  .obj_check_not_shortread:
  2921 00001250 75F3                    	jne .shortreadobj
  2922 00001252 C3                      	retn
  2923                                  .readobj:
  2924 00001253 E80E00                  	call .readobj_maybe_eof
  2925 00001256 EBF8                    	jmp .obj_check_not_shortread
  2926                                  .readobj_dsdx:
  2927 00001258 E80E00                  	call .readobj_dsdx_maybe_eof
  2928 0000125B EBF3                    	jmp .obj_check_not_shortread
  2929                                  .readobj_ssdx:
  2930 0000125D E80A00                  	call .readobj_ssdx_maybe_eof
  2931 00001260 EBEE                    	jmp .obj_check_not_shortread
  2932                                  
  2933                                  .readobj0_maybe_eof:
  2934 00001262 31D2                        xor dx,dx
  2935                                  .readobj_maybe_eof:
  2936 00001264 268E1E[0000]                mov ds,[es:buffer_base]      ; DS:DX -> segment:offset of buffer area
  2937                                  .readobj_dsdx_maybe_eof:
  2938 00001269 A9                      	db __TEST_IMM16		; skip push, pop
  2939                                  .readobj_ssdx_maybe_eof:
  2940 0000126A 16                      	push ss
  2941 0000126B 1F                      	pop ds
  2942 0000126C 268B1E[0000]            	mov bx, word [es:_wllist_obj_handle]
  2943 00001271 B43F                    	mov ah, 3Fh
  2944 00001273 CD21                    	int 21h
  2945 00001275 E8(0000)                    call    restore_ems_map
  2946 00001278 72CE                    	jc .doserrorobj
  2947 0000127A 39C8                    	cmp ax, cx
  2948 0000127C C3                      	retn
  2949                                  
  2950                                  END
