home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / bit_blt / amiga / doblit.c < prev    next >
C/C++ Source or Header  |  1987-04-24  |  2KB  |  71 lines

  1. /*
  2.  *   This is the routine which actually does the hard blits.  We just get
  3.  *   the blitter, stuff the values, wait for it to finish, disown the
  4.  *   blitter, and get out of there.
  5.  */
  6. #include "structures.h"
  7. /*
  8.  *   External values we use.
  9.  */
  10. extern struct blitregs blitregs ;
  11. /*
  12.  *   This include file includes the defines for all the blitter functions.
  13.  *   It only allows use of the `blit' operations; for area fills or line
  14.  *   drawing, it will need to be extended.
  15.  *
  16.  *   Information gleaned from the Hardware Reference Manual.
  17.  */
  18. #define BLTADD (0xdff040L)
  19. /*
  20.  *   This structure contains everything we need to know.
  21.  *   Do not do a structure copy into this!  Instead, assign
  22.  *   each field.  The last field assigned must be bltsize; that
  23.  *   starts up the blitter.  Also note that all of these are
  24.  *   write only, and you can't read them.
  25.  */
  26. struct bltstruct {
  27.    short con0 ;
  28.    short con1 ;
  29.    short afwm ;
  30.    short alwm ;
  31.    short cpth, cptl, bpth, bptl, apth, aptl, dpth, dptl ;
  32.    short bltsize ;
  33.    short dmy1, dmy2, dmy3 ;
  34.    short cmod, bmod, amod, dmod ;
  35.    short dmy4, dmy5, dmy6, dmy7 ;
  36.    short cdat, bdat, adat ;
  37. } *blitter = BLTADD ;
  38. /*
  39.  *   The actual routine.  After we own the blitter, we need to wait for
  40.  *   it to finish.
  41.  */
  42. doblit() {
  43.    OwnBlitter() ;
  44.    WaitBlit() ;
  45.    blitter->con0 = blitregs.con0 ;
  46.    blitter->con1 = blitregs.con1 ;
  47.    blitter->afwm = blitregs.afwm ;
  48.    blitter->alwm = blitregs.alwm ;
  49.    blitter->apth = blitregs.pth[0] ;
  50.    blitter->bpth = blitregs.pth[1] ;
  51.    blitter->cpth = blitregs.pth[2] ;
  52.    blitter->dpth = blitregs.pth[3] ;
  53.    blitter->aptl = blitregs.ptl[0] ;
  54.    blitter->bptl = blitregs.ptl[1] ;
  55.    blitter->cptl = blitregs.ptl[2] ;
  56.    blitter->dptl = blitregs.ptl[3] ;
  57.    blitter->amod = blitregs.mod[0] ;
  58.    blitter->bmod = blitregs.mod[1] ;
  59.    blitter->cmod = blitregs.mod[2] ;
  60.    blitter->dmod = blitregs.mod[3] ;
  61.    blitter->adat = blitregs.dat[0] ;
  62.    blitter->bdat = blitregs.dat[1] ;
  63.    blitter->cdat = blitregs.dat[2] ;
  64. /*
  65.  *   Wham!  It is the following assignment that starts the blitter.
  66.  */
  67.    blitter->bltsize = blitregs.size ;
  68.    WaitBlit() ;
  69.    DisownBlitter() ;
  70. }
  71.