Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!nntp-server.caltech.edu!tybalt.caltech.edu!toddpw From: toddpw@tybalt.caltech.edu (Todd P. Whitesel) Newsgroups: comp.sys.apple2 Subject: Re: Deferred and Immediate mode Message-ID: <1990Jul31.184844.10094@laguna.ccsf.caltech.edu> Date: 31 Jul 90 18:48:44 GMT References: <3529.apple.net2@pro-grouch> Sender: news@laguna.ccsf.caltech.edu Organization: California Institute of Technology Lines: 36 rond@pro-grouch.cts.com (Ron Dippold) writes: [ a somewhat involved routine to test the e flag and branch on it ] A simpler way to test for emulation mode is clc xce ;force native mode temporarily php ;save the old e bit which is now in c xce ;restore old e bit, carry is cleared plp ;and get it back into the carry bcc is_native bcs is_emulation Unless I grossly misunderstand the stack effects of mode-switching, this routine should work under ANY conditions. However, there could be side effects if we are in emulation mode and the stack pointer is $100 -- namely, the interrupt info clobbers the top of zero page. A more robust way would be: php rep $20 ;should have no effect in emulation mode clc bit #$3800 ;sets carry flag to m bit which equals the e bit bcc is_native bcs is_emulation note that both is_native and is_emulation should begin with PLP's. You can also use CLC, BIT #$3800 at any time to branch on the accumulator size, or CLC, LDX #$3800 to branch on the index register size. All of this is irrelevant to the original question, of course, which has already been answered. Todd Whitesel toddpw @ tybalt.caltech.edu