Path: utzoo!attcan!uunet!lll-winken!ames!ig!bionet!agate!ucbvax!WPI.BITNET!GREYELF From: GREYELF@WPI.BITNET Newsgroups: comp.sys.apple Subject: interrupt processing Message-ID: <8904020431.AA09720@wpi> Date: 2 Apr 89 04:31:06 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 75 >>Yes, Prodos 8 sets up its own interrupt vector to its interrupt handling >>routines on booting. As for special precautions, first allocate an >>interrupt routine, activate the hardware, then CLI to enable CPU >>recognition of the interrupts. >> >>Interrupts are only enabled after setting the hardware to generate them, >>and issuing a CLI instruction to enable CPU recognition of interrupts. >ACK! ACK! ACKI >We officially frown on people who do that. CLI, that is. If someone needs >interrupts *disabled*, that's just fine. That's reasonable. But most folks >(*especially* low-level routines) should not be directly clearing the flag >with a CLI instruction? >Why? Because the person who called you might need interrupts disabled, and >it's not reasonable to expect everyone calling a low-level routine to have >to re-set the interrupt flag after any call to an external routine. >What we recommend is that those who need to *disable* interrupts do so with >the sequence PHP/SEI. When you no longer need interrupts disabled, use PLP. >This disables interrupts when necessary, and returns the processor *to the >previous interrupt state* when done. >GS/OS and ProDOS 8 both keep interrupts enabled at system start time, and >don't leave them disabled (since they generally use PHP/SEI/PLP) when >unnecessary. So unless using DOS 3.3 (which is old enough not to deal with >this problem), try not to specifically turn on interrupts, but rather just >restore what was there before you disabled them. If you haven't disabled >interrupts, assume they are enabled. >----------------------------------------------------------------------------- >Matt Deatherage, Apple Computer, Inc. | "The opinions expressed in this tome >Send PERSONAL mail ONLY (please) to: | should not be construed to imply that >AppleLink PE: Matt DTS GEnie: AIIDTS | Apple Computer, Inc., or any of its >CompuServe: 76703,3030 | subsidiaries, in whole or in part, >Usenet: mattd@apple.com | have any opinion on any subject." >UUCP: (other stuff)!ames!apple!mattd | "So there." >----------------------------------------------------------------------------- Yes, Matt, you do have a valid point in that a routine that calls another routine might not expect it to activate interrupts, but if as you say Prodos 8 doesn't deactivate interrupts, Basic.system must, because by the time you make it to BASIC, the interrupts ARE disabled. This is easily tested from the monitor by issuing: C0C7:0 and pressing the ctrl-g key, it should sound normal. Then: 2000: 58 60 N 2000G and pressing ctrl-g again, it should sound broken up if I'm right. I already tried it on my Laser 128, and that's exactly what happened. The CLI instruction MUST be used to enable the CPU to recognize interrupt requests being generated (well actually you could create your own processor mask, PHA and then PLP :^). In addition the use of the RESET key disables maskable interrupts, and I would imagine the use of a BRK instruction would as well. In these cases IT IS NECESSARY to re-enable cpu recognition of the interrupts being generated. Your message noted the proper way to temporarily DISABLE interrupts for a task requiring timing, but it is NOT the way to enable CPU recognition of interrupts to begin with, which is what was asked for. -- Michael J Pender Jr Box 1942 c/o W.P.I. I wrote SHELL and Daemon, greyelf@wpi.bitnet 100 Institute Rd. send bug reports, suggestions, greyelf@wpi.wpi.com Worcester, Ma 01609 checks to me. People keep asking me if Shell or Daemon are compatible with the IIc, IIe. YES, I wrote them on my Laser 128. I mean, what would be the challenge to multitasking on a IIgs? I'll start writing dedicated gs programs when somebody sends me one in the mail.