home *** CD-ROM | disk | FTP | other *** search
/ Sound Sensations! / sound_sensations.iso / midifile / cmtcmu / atxt.asm < prev    next >
Assembly Source File  |  1990-06-28  |  920b  |  41 lines

  1.     title    ATXT - distinguish which processor is whom 
  2.     include dos.mac 
  3.  
  4.     PSEG 
  5.  
  6. ;; This is callable from C and returns a boolean value.     The codes are 
  7. ;;    0 - an 8088 
  8. ;;    1 - a 286 
  9. ;; other codes may be added 
  10.     public    _ATXT 
  11.     if    LPROG 
  12. _ATXT    proc    far 
  13.     else 
  14. _ATXT    proc    near 
  15.     endif 
  16.  
  17. ; push the SP.    If we are an 8086/8088, we will have the new SP;  
  18. ; if we are an 80286 we will have the old sp 
  19.  
  20.     push    bx 
  21.  
  22.     mov    bx,sp    ; save current sp 
  23.  
  24.     push    sp    ; push it (this is the test!) 
  25.  
  26. ; if sp = tos we are an 8088 
  27.  
  28.     pop    ax    ; get the value we just pushed 
  29.     cmp    ax,bx    ; is it same as sp before push? 
  30.     je    L286    ; yes, we pushed current SP and we are an 80286 
  31.     ; it is different, it was incremented before pushing, we are 
  32.     ; an 8088 
  33.     xor    ax,ax    ; set ax to 0 
  34.     jmp    return 
  35. L286:    mov    ax,1    ; set ax to 1, meaning '286 
  36. return: pop    bx    ; restore bx 
  37.     ret 
  38. _ATXT    ENDP 
  39.     ENDPS 
  40.     end 
  41.