summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-29 11:13:53 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-29 11:13:53 -0700
commit4d53abdcc9ac77b51f3856886d0e585f9f0b3225 (patch)
tree3b7158df4aed00ddc4d6866a4301e684bfd088c9
parentff315b229c216788e4220a8a90134b3a391d9c78 (diff)
downloadsamples-4d53abdcc9ac77b51f3856886d0e585f9f0b3225.tar.gz
samples-4d53abdcc9ac77b51f3856886d0e585f9f0b3225.tar.xz
samples-4d53abdcc9ac77b51f3856886d0e585f9f0b3225.zip
rel32.asm: make smaller by using MUL
-rw-r--r--elf2exe/rel32.asm15
1 files changed, 3 insertions, 12 deletions
diff --git a/elf2exe/rel32.asm b/elf2exe/rel32.asm
index d4e3d0a..984823e 100644
--- a/elf2exe/rel32.asm
+++ b/elf2exe/rel32.asm
@@ -26,20 +26,11 @@ _start:
mov ds,ax
mov si,reloc_tbl
+ mov ax,10h
mov bx,es ; = PSP segment
- add bx,10h ; = load base segment
+ add bx,ax ; = load base segment
add [si+(entry.cs - reloc_tbl)],bx
- ; Convert to an absolute address in DX:AX
- mov ax,bx
- xor dx,dx
- add ax,ax
- adc dx,dx
- add ax,ax
- adc dx,dx
- add ax,ax
- adc dx,dx
- add ax,ax
- adc dx,dx
+ mul bx ; Convert to a linear addr in DX:AX
mov cx,[si+(nrelocs - reloc_tbl)]