home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / SYSUTL / PROCTYPE.ARC / PROCTYPE.TXT < prev   
Encoding:
Text File  |  1988-10-30  |  2.2 KB  |  51 lines

  1.                                 30 Oct 88
  2.  
  3. Assembly language routine to detect and return processor type
  4. From Micro Cornucopia magazine #37, Sep-Oct 87
  5. Technical Tips column letter's text follows:
  6.  
  7. Identifying Intel Microprocessors
  8.    Rather than writing software using only 8086/8088 instructions,
  9. it is very useful to allow execution of 80186, 80286, or 80386 code
  10. on systems with these processors.  A general method for doing this
  11. tests for the type of processor and branches to processor-specific
  12. routines.  This allows a program to take full advantage of each
  13. processor's capabilities while retaining the ability to run on
  14. 8086/88 systems.
  15.    One method for deciding which processor is running is to examine
  16. the flag register.  While undefined on all processors, bit 15 of the
  17. flag register does take on different values.  A "one" identifies the
  18. 8086/88 or 80186/188 processor.  A zero means we're looking at either
  19. an 80286 or 80386.
  20.   Bits 12 - 14 are used only in Protected Mode.  An 80286 in Real Mode
  21. can't set any of these bits.  An 80386 can set all three although they
  22. have no effect.
  23.    The 8086/88 and 80186/188 flags behave identically.  We'll have to
  24. look at how the shift instruction works to differentiate these two
  25. processors.  The 8086/88 uses all eight bits of the CL register to
  26. hold the shift count.  The 80186/188 uses only the lower five bits.
  27. So the 80186/188 uses CL MOD 32 for the shift count.  This means a
  28. shift of 33 is the same as a shift of one for the 80186/188, while
  29. all those shifts on the 8086/88 guarantee a result of zero.
  30.    See Figure 1 [PROCTYPE.ASM] for code which returns the processor
  31. type in the AX register.
  32.    The preceding was a condensed version of an Intel "TechBits"
  33. paper sent in by:
  34.     Pat O'Leary
  35.     Ardrew, Athy
  36.     County Kildare, Ireland
  37.  
  38. Additional files:
  39. PROCTYPE.ASM    Assembly language procedure from Micro Cornucopia
  40. CHEKPROC.ASM    Demo program to test PROCTYPE.ASM    (Toad Hall)
  41. BATCHEK.BAT    Demo batch file to test CHEKPROC.COM    (Toad Hall)
  42.  
  43. Everything works on my 80286 XT clone, have no 8086/88/186/386
  44. to test other possible replies on.  Donno WHAT a V10/V20/V30 would do!
  45. How about someone playing with one and adjusting documentation and/or
  46. source accordingly?
  47.  
  48. David Kirschbaum
  49. Toad Hall
  50. kirsch@braggvax.ARPA
  51.