home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11642 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  897 b 

  1. Path: sparky!uunet!pilchuck!fnx!nazgul!bright
  2. From: bright@nazgul.UUCP (Walter Bright)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: CS and IP problem
  5. Message-ID: <1544@nazgul.UUCP>
  6. Date: 27 Dec 92 00:16:05 GMT
  7. References: <1g7623INNli3@mercury.kingston.ac.uk>
  8. Reply-To: bright@nazgul.UUCP (Walter Bright)
  9. Organization: Zortech, Seattle
  10. Lines: 15
  11.  
  12. In article <1g7623INNli3@mercury.kingston.ac.uk> cs_e404@ceres (Sean Batten) writes:
  13. /Now, I can see now you save the AX,BX,CX,DX,DS,ES,SS and Flags, you
  14. /simply store them straight away when you switch tasks, but _HOW_ do you
  15. /save the CS and IP registers since their values will have changed when
  16. /the tasks switched?????
  17.  
  18. When a CALL or INT or external interrupt occurs, the CS and IP are saved
  19. on the stack. In fact, a CALL is equivalent to:
  20.  
  21.     PUSH    CS
  22.     PUSH    offset L1
  23.     JMP    subroutine
  24. L1:    ...
  25.  
  26. So, you save CS and IP by looking at the stack.
  27.