[comp.sys.amiga] Need help: Interrupt servers & Graphics calls

mercurio@crash.CTS.COM (Phil Mercurio) (05/06/87)

[-]

I need help with a function being called by another function attached
to the vertical blanking interval interrupt.  The purpose of the
function is to scroll text onto the screen; it calls ScrollRaster()
and BltBitMap().  

The function works perfectly when not called from within the interrupt
server; it also works when called from within the server with the
ScrollRaster() and BltBitMap() calls removed.  With the graphics calls
in place, it still works if I have the text scroll on infrequently. 
However, if I try to scroll on a couple of lines of text in close
succession, I get a really neat fireworks display and a guru of
0000000B.<very low address, around 2C00>.  Pretty, but not what the
program is supposed to do.  

Is there some trick to calling graphics library routines from within
an interrupt server?  I've tried adding WaitBlit() calls (no effect),
OwnBlitter() and DisownBlitter() calls (hangs the system, requiring 
the old three-finger salute (Ctrl-Amiga-Amiga)), and Disable() -
Enable() pairs (again, no effect).  Any help or suggestions of new
things to try would be greatly appreciated.

Thanks in advance,

Phil Mercurio

Usenet:         ...!sdcsvax!crash!pnet!mercurio
PeopleLink:     mercurio
Genie:          mercurio

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/06/87)

>I need help with a function being called by another function attached
>to the vertical blanking interval interrupt.  The purpose of the
>function is to scroll text onto the screen; it calls ScrollRaster()
>and BltBitMap().  

	Most library calls expect to be called from a task or process, NOT
from an actual interrupt routine.  The reason is simple.... the library
call may have to 'sleep' waiting for access to the layers, blitter, or any
number of things.

	Needless to say, Interrupt service routines are NOT normal tasks,
do NOT get preempted by normal tasks, and consequently you CANNOT sleep
from within them. 

	I believe that you can send a signal to some task/process from the
Interrupt Service Routine, and then have that task/process do the actual
Graphics library calls.

				-Matt

phillip@cbmvax.UUCP (05/06/87)

in article <1089@crash.CTS.COM>, mercurio@crash.CTS.COM (Phil Mercurio) says:
> 
> [-]
> 
> I need help with a function being called by another function attached
> to the vertical blanking interval interrupt.  The purpose of the
> function is to scroll text onto the screen; it calls ScrollRaster()
> and BltBitMap().  
> However, if I try to scroll on a couple of lines of text in close
> succession, I get a really neat fireworks display and a guru of
> 0000000B.<very low address, around 2C00>.  Pretty, but not what the
> program is supposed to do.
It's not nice to push too many cycles in a interrupt!  
Since ScrollRaster() calls LockLayer() which in turn calls ObtainSemaphore
which calls Wait() you cannot safely use scrollraster() in a interrupt. I
have not checked BltBitMap(), but I would probably come to the same conclusion.
-phil 		BTW, important info follows signature...
==============================================================================
Phillip (Flip)Lindsay - Commodore Business Machines - Amiga Technical Support
  UUCP: {ihnp4|seismo|caip}!cbmvax!phillip      - Phone: (215) 431-9180
  No warranty is implied or otherwise given in the form of suggestion or 
  example. Any opinions found here are of my making.
------------------
Here is something Andy Finkel Posted a while back:

  These Exec functions should never be used from interrupt code:

    SuperState, UserState, SetIntVector, AddIntServer, RemIntServer
    Allocate, Deallocate, AllocMem, AllocAbs, FreeMem, AvailMem
    AllocEntry, FreeEntry, AddTask, RemTask, FindTask(0)
    SetSignal, SetExcept, Wait, AllocSignal, FreeSignal, AllocTrap
    FreeTrap, AddPort, RemPort, WaitPort, FindPort, AddLibrary,
    RemLibrary, OpenLibrary, CloseLibrary, SetFunction, SumLibrary
    AddDevice, RemDevice, OpenDevice, CloseDevice, DoIO, SendIO,
    CheckIO, WaitIO, AbortIO, AddResource, RemResource, OpenResource
 
  Using these in interrupt code may result in a NOP, or in some
  cases, total obliteration.  Don't take any chances; check your
  code. 

-------------