home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / progjour / 1991 / 06 / alib / savemost.asm < prev    next >
Assembly Source File  |  1991-06-25  |  927b  |  43 lines

  1.     include    asm.inc
  2.  
  3.     public    save_most
  4.  
  5.     .code
  6.  
  7. ;;    restore most
  8. ;
  9. ;    note    never call this routine
  10. ;
  11. restore_most proc
  12.     popm    bp,es,ds,si,di,dx,cx,bx
  13.     ret
  14. restore_most endp
  15.  
  16.     even
  17. ;;    save most
  18. ;
  19. ;    note    saves all registers except AX and BP.  however, the current
  20. ;        version also saves BP because the code works out that way.
  21. ;        the registers are automatically restored.  this routine is
  22. ;        called with a return address as the top of stack.
  23. ;
  24. save_most proc                ; +16 inner ret adr, +18 outer ret adr
  25.     push    cx            ; +14
  26.     push    dx            ; +12
  27.     push    di            ; +10
  28.     push    si            ; +8
  29.     push    ds            ; +6
  30.     push    es            ; +4
  31.     push    bp            ; +2
  32.     lea    bp,restore_most        ;     after execution of inner
  33.     push    bp            ; +0  routine, return to restore_most
  34.     mov    bp,sp
  35.     xchg    bx,[bp+16]        ;    bx above cx
  36.     push    bx            ; -2    setup return to inner routine
  37.     mov    bx,[bp+16]        ;    restore original BX and BP
  38.     mov    bp,[bp+2]
  39.     ret
  40. save_most endp
  41.  
  42.     end
  43.