TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: BARRY BLOCK
from: DAVID KIRSCHBAUM
date: 1997-05-23 11:03:00
subject: Bosskey.Asm - sysreq.

 > Hello David, and/or Mervyn,
DK>> .CODE
DK>> SaveSS  dw  0
DK>> SaveSP  dw  0
DK>> SaveBP  dw  0
DK>> SafeInt2Eh:
DK>>    MOV     CS:[SaveSS], SS
DK>>    MOV     CS:[SaveSP], SP
DK>>    MOV     CS:[SaveBP], BP
DK>>    INT     2Eh
DK>>    CLI     ; make sure the restoration of the registers is uninterrupted
DK>>    MOV     SP, CS:[SaveSP]
DK>>    MOV     SS, CS:[SaveSS]
DK>>    MOV     BP, CS:[SaveBP]
DK>>    STI     ; registers restored, so interrupts OK
DK>>    RET
 >  Why is it not just as important to CLI and STI when saving the registers?
 > Kind regards, Barry
Because _saving_ them does not _change_ them.
But when it comes time to actually _change_ where your stack pointer is 
aiming at .. well, you have to be a little more careful.  You wouldn't want 
some other process to come in and try to use the stack just at the instant 
when you'd changed the SP but not the SS, would you?  Murphy depends on 
assumptions like that :-)
---
---------------
* Origin: Toad Hall (1:3634/2.4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.