Skip to content

Commit

Permalink
Merge pull request #1 from leecher1337/vxd
Browse files Browse the repository at this point in the history
Add VXD support to loader
  • Loading branch information
yetmorecode authored Oct 13, 2022
2 parents faff1b5 + bf28a94 commit 16c6f00
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions src/dos32a/loader.asm
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,27 @@ apply_fixups:
@@0: push ecx edi
mov _err_code,4005h ; "unrecognized fixup data"
mov cx,gs:[esi+0] ; get SRC/FLAGS
test cl,20h
jnz srclist
movsx edx,word ptr gs:[esi+2] ; get SRCOFF
movzx eax,word ptr gs:[esi+4] ; get OBJNUM
add esi,6
add edi,edx ; calculate dest addr to be fixed
test cx,0F20h ; SrcLists/Imports not supported
jmp srclst_cnt
srclist:
shl ecx, 8
mov cl,byte ptr gs:[esi+2] ; get number of list entries
movzx eax,word ptr gs:[esi+3] ; get OBJNUM
add esi,5
ror ecx, 8
srclst_cnt:
test cx,0F00h ; Imports not supported
jnz file_errorm ; jump if one of these
test cx,4000h ; test if 16bit object number
jnz @@1 ; if yes, jump
mov ah,0
dec esi
@@1: add esi,6
dec eax ; Object Number - 1
@@1: dec eax ; Object Number - 1
shl eax,4
mov edx,_app_tmp_addr1
sub edx,eax
Expand All @@ -323,11 +333,28 @@ apply_fixups:
movzx eax,ax
sub esi,2
@@2: add esi,4
@@3: cmp cl,07h

test cl,20h ; On source list:
jz @@3
@@7: pop edi ; Restore edi for next entry
push edi
movsx edx,word ptr gs:[esi] ; get SRCOFF
add esi, 2
add edi,edx ; calculate dest addr to be fixed

@@3: cmp cl,07h ; 32bit offset fixup
jnz @@4
add eax,edx
mov gs:[edi+0],eax
@@5: pop edi ecx
@@5: test cl,20h ; On source list:
jz @@6
ror ecx, 16 ; Check if number of entries has been eached
inc cl
cmp cl, ch
ja @@6
rol ecx, 16
jmp @@7
@@6: pop edi ecx
cmp esi,ecx
jb @@0
ret
Expand Down

0 comments on commit 16c6f00

Please sign in to comment.