home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PCTV3N3.ZIP / PUSHPOP.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-01-10  |  996 b   |  44 lines

  1. ; This code requires Turbo Assembler Version 1.0 or greater. 
  2. ; Assembly syntax:
  3. ;       TASM /ml /dMDL=<model> PUSHPOP
  4. ; where <model> is any one of TINY, SMALL, MEDIUM, COMPACT, LARGE, 
  5. ; or HUGE (defaults to small model).
  6.  
  7. IFNDEF  MDL
  8.         .MODEL  SMALL
  9. ELSE
  10.         .MODEL  MDL
  11. ENDIF
  12.  
  13.         NOSMART
  14.         .CODE
  15.         PUBLIC  VA_PUSH, VA_POP
  16.  
  17. VA_PUSH         PROC
  18.         ret                     ; Return leaving argument on stack.
  19. VA_PUSH         ENDP
  20.  
  21. flush_cache     PROC FAR
  22.         retf
  23. flush_cache     ENDP
  24.  
  25. VA_POP          PROC
  26. ARG     stksize : WORD
  27.  
  28.         push    bp
  29.         mov     bp, sp
  30.  
  31.         mov     ax, stksize     ; Copy pop size to ret instruction.         
  32.         mov     word ptr cs:[retnum], ax
  33.  
  34.         pop     bp
  35.  
  36.         call    flush_cache     ; Flush the instruction cache.
  37.  
  38.         ret     0FFFFh          ; Pop size is dynamically changed.         
  39.         retnum  = $ - 2
  40.  
  41. VA_POP          ENDP
  42.  
  43.         END
  44.