Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <intuition/screens.h>
- #include <graphics/copper.h>
- #include <hardware/intbits.h>
- #include <hardware/dmabits.h>
- #include <graphics/gfxmacros.h>
- #include <hardware/custom.h>
- #include <exec/interrupts.h>
- #include <exec/memory.h>
- #include <graphics/gfxbase.h>
- #include <clib/exec_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/intuition_protos.h>
- __far extern struct Custom custom;
- extern void initCopperlist(); /* Inicjuje Copperlistę */
- extern void myCopperInt(); /* Obsługa przerwania Coppera */
- extern struct GfxBase *GfxBase;
- int main()
- {
- struct Screen *s;
- struct UCopList *ucl;
- struct Interrupt irq;
- struct myData
- {
- struct Task *thisTask;
- ULONG sigmask;
- } mydata;
- ULONG signal;
- struct View *oldview;
- /* Inicjujemy Copperlistę (ustawiamy wskaźniki do bitplanów) */
- initCopperlist();
- /* Otwieramy ekran */
- if (s = OpenScreenTags(NULL,
- SA_Left, 0,
- SA_Top, 0,
- SA_Width, 320,
- SA_Height, 256,
- SA_Depth, 1,
- SA_Quiet, TRUE,
- SA_Exclusive, TRUE,
- TAG_DONE))
- {
- /* Szukamy zadania */
- mydata.thisTask = FindTask(NULL);
- /* Rezerwujemy sygnał */
- if ((signal = AllocSignal(-1)) != -1)
- {
- mydata.sigmask = 1L << signal;
- /* Inicjujemy strukturę przerwania */
- irq.is_Node.ln_Pri = 0;
- irq.is_Code = myCopperInt;
- irq.is_Data = &mydata;
- /* Dodajemy obsługę przerwania Coppera */
- AddIntServer(INTB_COPER, &irq);
- /* Tworzymy Copperlistę użytkownika */
- if (ucl = AllocMem(sizeof(struct UCopList), MEMF_PUBLIC|MEMF_CLEAR))
- {
- CINIT(ucl, 2);
- CWAIT(ucl, 0, 0);
- /* Wywołujemy przerwanie w linii 0, gdy nasz ekran (Copperlista) staje się aktywny */
- CMOVE(ucl, custom.intreq, INTF_SETCLR|INTF_COPER);
- CEND(ucl);
- /* Ustawiamy Copperlistę użytkownika */
- Forbid();
- s->ViewPort.UCopIns = ucl;
- Permit();
- RethinkDisplay();
- oldview = GfxBase->ActiView;
- WORD i;
- for (i = 0; i < 5; i++)
- {
- /* Czekamy na sygnał */
- SetSignal(0L, mydata.sigmask);
- Wait(mydata.sigmask);
- /* Załadowujemy copperlistę */
- if (i < 4)
- loadCopperlist();
- }
- /* Odtwarzamy oryginalna copperlistę */
- WaitTOF();
- WaitTOF();
- LoadView(oldview);
- custom.cop1lc = (ULONG)GfxBase->copinit;
- }
- /* Usuwamy obsługę przerwania */
- RemIntServer(INTB_COPER, &irq);
- /* Zwalniamy sygnał */
- FreeSignal(signal);
- }
- /* Zamykamy ekran */
- CloseScreen(s);
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement