carrier@cogsci.ucsd.EDU (Mark Carrier) (05/05/89)
I've successfully used the Time Manager routines in LSP 1.11 to install a task that increments a counter every X milliseconds. In the procedure that is executed every X ms, the counter (a global variable) is incremented and the procedure reinstalls itself into the Time Manager's queue. I use SetCurrentA5 and SetA5 per TechNote #208 at the beginning and end of the task. Unfortunately, this code does not run in LSP 2.0. The machine bombs. Has anybody successfully used the Time Manager in LSP 2.0 code? Is there a new problem with A5 that is not overcome by using SetCurrentA5 and SetA5? (I'm using sys 6.0.2 on a Mac II) Thanks in advance. Mark Carrier
ksitze@nmsu.edu (Kevin Sitze) (05/05/89)
In <carrier@cogsci.ucsd.EDU's message of 5 May 89 08:04:11 GMT> Mark writes: >I've successfully used the Time Manager routines in LSP 1.11 to >install a task that increments a counter every X milliseconds. In the >procedure that is executed every X ms, the counter (a global variable) >is incremented and the procedure reinstalls itself into the Time >Manager's queue. I use SetCurrentA5 and SetA5 per TechNote #208 at the >beginning and end of the task. > >Unfortunately, this code does not run in LSP 2.0. The machine bombs. >Has anybody successfully used the Time Manager in LSP 2.0 code? Is >there a new problem with A5 that is not overcome by using SetCurrentA5 >and SetA5? (I'm using sys 6.0.2 on a Mac II) If you have the debug option on in the source file that holds the routines being accessed by the Time Manager, you have to surround the routine with the debug compiler option like so: {$d-} {Turn off debug on the following routine} procedure MyInterruptRoutine; begin . . {Code here} . end; {$d+} {Turn on debug for rest of program} The reason you have to do this is because LSP imbeds TRAP instructions directly into the compiled code. Something that LSP does to handle the TRAP's, causes the machine to blow up when executing code during interrupts. You can't use the nice debugging capabilities of LSP inside that procedure but it'll work. I haven't looked at the technical note you refered to (I'm not exactly sitting at my Mac right now thanks to a flakey LAN) but I suppose that you could use the $a (asyncronous) compiler directive as well and never do direct calls to SetCurrentA5 or SetA5. I think though it might work better if you explicitly do the calls yourself the way I described above. The $a control imbeds a SetupA5 and a RestoreA5 at the beginning and end of the procedure code and this may no longer be the correct way of doing things. (Again I'll have to look at TN #208) Maybe someone from Symantic Corp. can tell us why LSP 1.11 works with this program and LSP 2.0 doesn't. -Kelesi -- ------------------------------------+------------------------------- From the Macintosh of: Kevin Sitze | Disclamer: Who the heck needs | a disclamer? After all, Dan EMail: ksitze%NMSU.edu | Quayle doesn't. SMail: 601 S. Melendres +------------------------------- Las Cruces, NM 88005 | "We have the answers, the ------------------------------------+ trouble lies in finding the "The difference between intelligence| questions..." and stupidity is that intelligence | "The information is there, has a limit." - anonymous | finding it is another story." The dolt confuses you -- more -- | - Any consultant ------------------------------------+-------------------------------
siegel@endor.harvard.edu (Rich Siegel) (05/06/89)
In article <KSITZE.89May5095755@bonito.nmsu.edu> ksitze@nmsu.edu (Kevin Sitze) writes: >If you have the debug option on in the source file that holds the >routines being accessed by the Time Manager, you have to surround the >routine with the debug compiler option like so: Exactly. Interrupt-level Pascal routines can't be debugged using the source debugger; Macsbug or TMON will serve, but you need to $D- the code that is running at interrupt time. --Rich ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel "She told me to make myself comfortable, so I pulled down my pants and sat in the pudding." -Emo Phillips ~~~~~~~~~~~~~~~