Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!hpa From: hpa@casbah.acns.nwu.edu (Peter Anvin) Newsgroups: comp.os.msdos.programmer Subject: Re: Writing assembly procedures for higher level languages Message-ID: <2916@casbah.acns.nwu.edu> Date: 24 Jan 91 22:40:11 GMT References: <1991Jan24.133054.8715@wpi.WPI.EDU> <1991Jan24.221332.5802@bradley.bradley.edu> Organization: Northwestern University Lines: 29 >>However, does one need to save the ES register if it is mdified? How abo >>the flags register? You don't need to save ES in subroutines to Microsoft (or Borland) high-level languages. ES is a "scratch segment register", you can change it at your heart's desire. The ultra-transient flag register is never used but right after it is set, so the same thing applies here. NB: You *do* need to save ES if you are writing an interrupt handler ONLY. FLAGS is saved by the interrupt itself, and restored by IRET, so you don't need to save them here, either. #ifndef SKIP_FLAMES >To save the ES register, you can always: > MOV AX,ES > PUSH AX > POP AX > MOV ES,AX Oh... I must be very old-fashioned to still use 'em old 8088 PUSH ES POP ES (no offense intended) #endif -- H. Peter Anvin +++ A Strange Stranger +++ N9ITP/SM4TKN +++ INTERNET: hpa@casbah.acns.nwu.edu FIDONET: 1:115/989.4 BITNET: HPA@NUACC RBBSNET: 8:970/101.4