home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / intel / 2150 next >
Encoding:
Internet Message Format  |  1992-11-04  |  2.0 KB

  1. Path: sparky!uunet!auspex-gw!guy
  2. From: guy@Auspex.COM (Guy Harris)
  3. Newsgroups: comp.sys.intel
  4. Subject: Re: Undocumented instructions in x86 CPUs
  5. Message-ID: <15341@auspex-gw.auspex.com>
  6. Date: 5 Nov 92 05:47:04 GMT
  7. References: <mostert.51@cs.sun.ac.za> <FH==sq#@engin.umich.edu>
  8. Sender: news@auspex-gw.auspex.com
  9. Organization: Auspex Systems, Santa Clara
  10. Lines: 41
  11. Nntp-Posting-Host: auspex.auspex.com
  12.  
  13. >Sure, AAM (ASCII adjust after multiplication) is a well known instruction.
  14.  
  15. Yup.
  16.  
  17. In fact, unless you're referring to some *other* AAM instruction, AAM is
  18. so well-known it's even on page 17-20 of the 1986 edition of the "80386
  19. Programmer's Reference Manual"....
  20.  
  21. However, it *doesn't* mention what happens in AAM if the second byte of
  22. the instruction *isn't* 0A.  The "One-Byte Opcode Map" on page A-4
  23. shows AAM in the D4 location, which seems to indicate that D4 is the AAM
  24. opcode, so maybe, in fact, the second byte is a secret operand that's
  25. the base of the number system for which it's doing the adjustment.
  26.  
  27. In addition, AAM is claimed to take 17 cycles in the table on page E-5,
  28. and an unsigned divide is claimed to take - surprise, surprise - 14 to
  29. 17 cycles with a one-byte operand.
  30.  
  31. Sounds as if AAM was - at least in the implementations on which you
  32. tried it - really the "divide AL by a one-byte immediate operand,
  33. stuffing the quotient into AH and remainder in AL" instruction....
  34.  
  35. 10 hex is 16 decimal, and if D4 10 does a base-16 AAM, then it would be
  36.  
  37.     AH = AL >> 4
  38.     AL = AL & 0xF
  39.  
  40. Try it with hex 11, and see if it does
  41.  
  42.     AH = AL / 17
  43.     AL = AL MOD 17
  44.  
  45. Note, though, that they may have cut corners in future implementations,
  46. such as the 586^H^H^HPentium, so that hex A is the only operand that
  47. works correctly.
  48.  
  49. The same, of course, may well apply to *other* undocumented
  50. instructions; programmer, beware!  (What's Latin for "programmer"? :-))
  51. I've heard a claim that the bit-field instructions didn't completely
  52. work, even on the 386; I've no idea whether there's any truth to that
  53. claim or not.
  54.