rfl@oddjob.UChicago.EDU (Bob Loewenstein) (07/04/87)
Here is some code I wrote in Neon that posts a procedure to the vbl queue. I think it's self explanatory even if you don't know Neon. :code vinstall move.l (a7)+,a0 call vinstall ext.l d0 move.l d0,-(a7) ;code :code vremove move.l (a7)+,a0 call vremove ext.l d0 move.l d0,-(a7) ;code :CLASS vbl <super object var qlink int qtype var procPtr int vblCount int vblPhase ( 1/60ths of second -- ) :M SetDelay: put: vblCount ;M ( cfaProc -- errcode) :M install: +base put: procptr abs: self vinstall abort" install error" ;M ( -- errcode) :M remove: abs: self vremove abort" remove error" ;M :M classinit: 1 put: qtype ;M ;class vbl myTask \ Now to use this, create a :proc definition which is the background task \ you want to perform. You can set the delay (in 1/60ths \ of a second) for periodic execution using the setDelay: method. The \ task itself must reset this delay everytime it executes. The task \ should ultimately be written in assembly, since all other events \ are on hold while your word is being executed. \ example below \ :Proc beeper 1 beep 120 setdelay: myTask ;proc \ 120 setdelay: myTask \ 'c beeper install: myTask \ to remove, say remove: myTask