home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / ASMGLOBA.H < prev    next >
Text File  |  1994-04-17  |  1KB  |  63 lines

  1. ; global include file for all .s files to specify model and define macros
  2.     ; if you use an old version of TASM, remove USE16 in the line below !
  3.         .MODEL USE16 LARGE,C
  4.         %MACS
  5.         .LALL
  6.   
  7.         if  @DataSize NE 0
  8.             LARGEDATA   EQU 1
  9.             endif
  10.   
  11.             ; Pop CPU flags. On the 286 this uses an alternate sequence to avoid
  12. ; a bug on early versions of the 286
  13. POPFLAGS    macro
  14. if  @Cpu AND 8
  15.     popf        ; popf okay on the 386/486
  16.   
  17. elseif  @Cpu AND 4  ; use alternate sequence on the 286
  18. JMP $+3 ;Jump over IRET
  19. IRET        ;Pops CS, IP, FLAGS
  20. PUSH    CS  ;Removed by IRET
  21. CALL    $-2 ;Pushes IP, removed by IRET
  22. else
  23.     popf        ; popf okay on the 8086/88/186
  24. endif
  25. endm
  26.   
  27.   
  28. ; Push all general purpose registers. If 386/486, push 32-bit regs
  29.     ; to support C code compiled with the -3 option
  30. PUSHALL macro
  31. if  @Cpu AND 8  ; PUSHAD available to protect 32-bit regs
  32. pushad
  33. elseif  @Cpu AND 4  ; PUSHA available
  34. pusha
  35. else
  36.     push    ax      ; save user regs on interrupt stack
  37. push    bx
  38. push    cx
  39. push    dx
  40. push    bp
  41. push    si
  42. push    di
  43. endif
  44. endm
  45.   
  46. ; Pop all general purpose registers
  47. POPALL  macro
  48. if  @Cpu AND 8  ; PUSHAD available to protect 32-bit regs
  49. popad
  50. nop     ; Avoid bug on some early 386's
  51. elseif  @Cpu AND 4  ; PUSHA available
  52. popa
  53. else
  54.     pop di
  55.     pop si
  56.     pop bp
  57.     pop dx
  58.     pop cx
  59.     pop bx
  60.     pop ax
  61.     endif
  62.     endm
  63.