Skip to content

Commit 16c6f00

Browse files
authored
Merge pull request #1 from leecher1337/vxd
Add VXD support to loader
2 parents faff1b5 + bf28a94 commit 16c6f00

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

src/dos32a/loader.asm

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,27 @@ apply_fixups:
294294
@@0: push ecx edi
295295
mov _err_code,4005h ; "unrecognized fixup data"
296296
mov cx,gs:[esi+0] ; get SRC/FLAGS
297+
test cl,20h
298+
jnz srclist
297299
movsx edx,word ptr gs:[esi+2] ; get SRCOFF
298300
movzx eax,word ptr gs:[esi+4] ; get OBJNUM
301+
add esi,6
299302
add edi,edx ; calculate dest addr to be fixed
300-
test cx,0F20h ; SrcLists/Imports not supported
303+
jmp srclst_cnt
304+
srclist:
305+
shl ecx, 8
306+
mov cl,byte ptr gs:[esi+2] ; get number of list entries
307+
movzx eax,word ptr gs:[esi+3] ; get OBJNUM
308+
add esi,5
309+
ror ecx, 8
310+
srclst_cnt:
311+
test cx,0F00h ; Imports not supported
301312
jnz file_errorm ; jump if one of these
302313
test cx,4000h ; test if 16bit object number
303314
jnz @@1 ; if yes, jump
304315
mov ah,0
305316
dec esi
306-
@@1: add esi,6
307-
dec eax ; Object Number - 1
317+
@@1: dec eax ; Object Number - 1
308318
shl eax,4
309319
mov edx,_app_tmp_addr1
310320
sub edx,eax
@@ -323,11 +333,28 @@ apply_fixups:
323333
movzx eax,ax
324334
sub esi,2
325335
@@2: add esi,4
326-
@@3: cmp cl,07h
336+
337+
test cl,20h ; On source list:
338+
jz @@3
339+
@@7: pop edi ; Restore edi for next entry
340+
push edi
341+
movsx edx,word ptr gs:[esi] ; get SRCOFF
342+
add esi, 2
343+
add edi,edx ; calculate dest addr to be fixed
344+
345+
@@3: cmp cl,07h ; 32bit offset fixup
327346
jnz @@4
328347
add eax,edx
329348
mov gs:[edi+0],eax
330-
@@5: pop edi ecx
349+
@@5: test cl,20h ; On source list:
350+
jz @@6
351+
ror ecx, 16 ; Check if number of entries has been eached
352+
inc cl
353+
cmp cl, ch
354+
ja @@6
355+
rol ecx, 16
356+
jmp @@7
357+
@@6: pop edi ecx
331358
cmp esi,ecx
332359
jb @@0
333360
ret

0 commit comments

Comments
 (0)