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

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!panther!mothost!merlin.dev.cdx.mot.com!keithp
  3. From: keithp@merlin.dev.cdx.mot.com (Keith L. Petry)
  4. Subject: Re: 386 Assembler Question - Easy one...
  5. Message-ID: <1992Nov12.145342.17642@merlin.dev.cdx.mot.com>
  6. Originator: keithp@melkur.dev.cdx.mot.com
  7. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  8. Nntp-Posting-Host: melkur.dev.cdx.mot.com
  9. Organization: Motorola Codex, Canton, MA
  10. References: <1992Nov9.162931.1@camins.camosun.bc.ca> <1992Nov11.114831.6643@ufhx1.ufh.ac.za>
  11. Date: Thu, 12 Nov 1992 14:53:42 GMT
  12. Lines: 42
  13.  
  14.  
  15. In article <1992Nov11.114831.6643@ufhx1.ufh.ac.za>, cssjs2@ufhx1.ufh.ac.za (Mr I Scheepers) writes:
  16. |> In <1992Nov9.162931.1@camins.camosun.bc.ca> morley@camins.camosun.bc.ca writes:
  17. |> >In 386 assembler I need to fill an extended register with 4 copies
  18. |> >of the same byte.  Right now I'm using the following:
  19. |> 
  20. |> >   mov  al,VALUE
  21. |> >   mov  ah,VALUE
  22. |> >   shl  eax,16
  23. |> >   mov  al,VALUE
  24. |> >   mov  ah,VALUE
  25. |> 
  26. |> >I'm curious... is there a better/faster way to stuff the register?
  27. |> 
  28. |> How about:
  29. |>     mov al,VALUE
  30. |>     mov ah,al
  31. |>     mov eax,ax
  32.          ^
  33.          ----------- This last statement does nothing eax and ax 
  34.                       are the same register.
  35.  
  36. How about :
  37.  
  38.     mov bl, VALUE
  39.     mov al, bl
  40.     mov ah, bl
  41.     shl eax, ax
  42.     mov al, bl
  43.     mov ah, bl
  44.  
  45. This will be faster because you have your data in the bl register.
  46. Instead of doing a memory fetch 4 times, you only memory fetch once.
  47. And all the actions occur internal to the x86 chip. 
  48.  
  49. Let me just say one other thing though. If you have a 486 then the first
  50. answer is as good as mine, because the 486 has an internal cache and this
  51. is as good as using a internal register. If you are running on a 386 my
  52. answer is faster.
  53.  
  54. Keith
  55.  
  56.