Path: utzoo!attcan!uunet!samsung!usc!jarthur!nntp-server.caltech.edu!tybalt.caltech.edu!toddpw From: toddpw@tybalt.caltech.edu (Todd P. Whitesel) Newsgroups: comp.sys.apple2 Subject: Re: checking native/emulation mode Message-ID: <1990Aug1.225059.7606@laguna.ccsf.caltech.edu> Date: 1 Aug 90 22:50:59 GMT References: <3529.apple.net2@pro-grouch> <1990Jul31.184844.10094@laguna.ccsf.caltech.edu> <43491@apple.Apple.COM> Sender: news@laguna.ccsf.caltech.edu Organization: California Institute of Technology Lines: 23 dlyons@Apple.COM (David A. Lyons) writes: [ about some code I posted ] >What? Yeah, if your stack pointer is $100 that's Not Good. Actually, what I meant to point out was that in emulation mode the stack is supposed to wrap around (if that ever happens; I know the O/S tries to prevent it but it still can happen) and since the CPU just switched into native mode an interrupt would clobber the very top of zero page. >If you just meant the stack = $1xx, that's no problem, because switching to >NATIVE mode doesn't fiddle with the stack pointer. (If you were switching >to emulation from native & the stack was not already in $01xx, *then* there >would be problems.) This is all true; however my real point was that one should ALWAYS program for an interruptible environment. This means being careful about the stack & the P register flags -- and the second piece of code I posted neatly avoids all that because it doesn't do anything potentially dangerous. Todd Whitesel toddpw @ tybalt.caltech.edu