; ; macros.inc -- various useful general-purpose macros ; ; Bret Victor, Sept 12, 1998 ; _entercritcal and _leavecritical are used for disabling ; interrupts within a section. Why not just use sei and cli? ; Well, if interrupts are already disabled (say, you call the ; function within an interrupt proc), the cli will enable them, ; and you really don't want that to happen. These macros ; provide a safe way of disabling interrupts. I just wish there ; were psp and plp (push P, pull P) instructions like in 65C816... mac _entercritical tpa ; put p in a psha ; save it sei ; set interrupt disable endm mac _leavecritical pula ; get p tap ; put it back endm