home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / msdos / programm / 10585 < prev    next >
Encoding:
Text File  |  1992-11-13  |  1.4 KB  |  43 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!cs.utexas.edu!swrinde!ringer!mlevis
  3. From: mlevis@ringer.cs.utsa.edu (Mike Levis) (OS/2)
  4. Subject: Re: 386 Assembler Question - Easy one...
  5. Message-ID: <1992Nov13.100906.9819@ringer.cs.utsa.edu>
  6. Organization: University of Texas at San Antonio
  7. References: <1992Nov9.162931.1@camins.camosun.bc.ca> <1992Nov11.114831.6643@ufhx1.ufh.ac.za> <1992Nov12.145342.17642@merlin.dev.cdx.mot.com>
  8. Date: Fri, 13 Nov 1992 10:09:06 GMT
  9. Lines: 32
  10.  
  11. In article <1992Nov12.145342.17642@merlin.dev.cdx.mot.com> keithp@merlin.dev.cdx.mot.com (Keith L. Petry) writes:
  12. >
  13. >How about :
  14. >
  15. >    mov bl, VALUE
  16. >    mov al, bl
  17. >    mov ah, bl
  18. >    shl eax, ax
  19.               ^^ (I think you mean 16)
  20. >    mov al, bl
  21. >    mov ah, bl
  22.  
  23. Your code is very efficient.  It squeezes the time to execute.  Let me
  24. squeeze it some more.  It destroys a 16-bit reg instead of an 8-bit, though.
  25.  
  26. How's this:
  27.             ; 386 486 clock cycles
  28.     mov  al,  VALUE    ;  4   1
  29.     mov  ah,  al    ;  2   1
  30.     mov  dx,  ax    ;  2   1
  31.     shl  eax, 16    ;  3   2
  32.     mov  ax,  dx    ;  2   1
  33.             ; 13   6 total clock cycles
  34.  
  35. It only saves 2 clock cycles (and a few bytes) but optimizing
  36. assembler can be fun sometimes.  :)
  37.  
  38. -- 
  39. ====== Mike Levis   mlevis@ringer.cs.utsa.edu ======
  40. "I believed what I was told, I thought it was a good   .--.
  41. life, I thought I was happy.  Then I found something  (OS/2)
  42. that changed it all..."  --  Anonymous, 2112  [Rush]   ~--~
  43.