Article View: comp.os.msdos.programmer
Article #3646Re: 386 Assembler Question - Easy one...
From: Mike Levis
Date: Fri, 13 Nov 1992 10:09
Date: Fri, 13 Nov 1992 10:09
32 lines
1488 bytes
1488 bytes
In article <1992Nov12.145342.17642@merlin.dev.cdx.mot.com> keithp@merlin.dev.cdx.mot.com (Keith L. Petry) writes:
>
>How about :
>
> mov bl, VALUE
> mov al, bl
> mov ah, bl
> shl eax, ax
^^ (I think you mean 16)
> mov al, bl
> mov ah, bl
Your code is very efficient. It squeezes the time to execute. Let me
squeeze it some more. It destroys a 16-bit reg instead of an 8-bit, though.
How's this:
; 386 486 clock cycles
mov al, VALUE ; 4 1
mov ah, al ; 2 1
mov dx, ax ; 2 1
shl eax, 16 ; 3 2
mov ax, dx ; 2 1
; 13 6 total clock cycles
It only saves 2 clock cycles (and a few bytes) but optimizing
assembler can be fun sometimes. :)
--
====== Mike Levis mlevis@ringer.cs.utsa.edu ======
"I believed what I was told, I thought it was a good .--.
life, I thought I was happy. Then I found something (OS/2)
that changed it all..." -- Anonymous, 2112 [Rush] ~--~
Technical Details
Message-ID:
<1992Nov13.100906.9819@ringer.cs.utsa.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!ringer!mlevisReferences:
<1992Nov9.162931.1@camins.camosun.bc.ca> <1992Nov11.114831.6643@ufhx1.ufh.ac.za> <1992Nov12.145342.17642@merlin.dev.cdx.mot.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!swrinde!ringer!mlevis From: mlevis@ringer.cs.utsa.edu (Mike Levis) (OS/2) Subject: Re: 386 Assembler Question - Easy one... Message-ID: <1992Nov13.100906.9819@ringer.cs.utsa.edu> Organization: University of Texas at San Antonio References: <1992Nov9.162931.1@camins.camosun.bc.ca> <1992Nov11.114831.6643@ufhx1.ufh.ac.za> <1992Nov12.145342.17642@merlin.dev.cdx.mot.com> Date: Fri, 13 Nov 1992 10:09:06 GMT Lines: 32