home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI10.ARJ / ictari.10 / C / BOINKOUT / SVRO.C < prev   
Text File  |  1987-04-22  |  3KB  |  110 lines

  1. /********************************************************************
  2.     SVRO.C    :    COPYRIGHT 1990 Samuel Streeper
  3.  
  4.     The following call replaces the megamax C or laser C library
  5.     binding for the vro_cpyfm() blitter call. This binding takes the
  6.     structures normally passed to that call and uses that data to set
  7.     up the line-a variables, and then it does the blit using the
  8.     line-a function. There are 2 advantages:
  9.  
  10.         1)    Trap #2 is not used, so the AES (and the event manager)
  11.             is not invoked.
  12.         2)    AES just sets up the line-a variables anyway, and I do
  13.             it almost 3 times as fast.
  14.         3)    Ok, there are 3 advantages... a virtual workstation handle
  15.             is not required, so the blit works whether or not you have
  16.             a valid workstation handle.
  17.  
  18.     Operation of the faster binding is transparent; If you link with
  19.     this object module you get the fast binding, otherwise you get the
  20.     normal one. In any case, you don't have to modify your source code.
  21.  
  22.     This function does not work in low res right now (I don't think)
  23.     but it would be an easy fix.
  24. ********************************************************************/
  25.  
  26. static int blit(),s_form();
  27.  
  28. asm{
  29. blit:    dc.w 0,0,0,0,0
  30.         dc.l 0
  31.         dc.w 0,0
  32. s_form:    dc.l 0
  33.         dc.w 0,0
  34.         dc.w 2            ;always 2!
  35. s_xmin:    dc.w 0
  36. s_ymin:    dc.w 0
  37. d_form:    dc.l 0
  38.         dc.w 0,0
  39.         dc.w 2            ;always 2!
  40.         dc.l 0            ;pattern, always 0
  41.         dc.w 0,0,0
  42.         dc.w 0,0,0,0,0,0,0,0,0,0,0,0
  43.    }
  44.  
  45. vro_cpyfm(handle,mode,pxyarray,src,dest)
  46. int **pxyarray, **src, **dest;
  47. {    asm{
  48.         lea blit,A0
  49.         move mode(A6),D0
  50.         andi #0xF,D0
  51.         move D0,D1
  52.         lsl #8,D0
  53.         add D1,D0
  54.         move D0,D1
  55.         lsl.l #8,D0
  56.         lsl.l #8,D0
  57.         add D1,D0                ;d0 = mask for 2 bit planes
  58.         move.l D0,10(A0)
  59.  
  60.         movea.l pxyarray(A6),A1    ;A1 -> int[8]
  61.         move    4(A1),D0
  62.         sub    (A1),D0
  63.         addq    #1,D0            ;D0 = width
  64.         move    D0,(A0)
  65.         move    6(A1),D0
  66.         sub    2(A1),D0
  67.         addq    #1,D0
  68.         move    D0,2(A0)        ;height
  69.  
  70.         move    (A1),14(A0)        ;source x
  71.         move    2(A1),16(A0)    ;source y
  72.         move    8(A1),28(A0)    ;dest x
  73.         move    10(A1),30(A0)    ;dest y
  74.  
  75.         movea.l src(A6),A1        ;A1 -> src MFDB
  76.         move    12(A1),D0
  77.         move    D0,4(A0)        ;num planes
  78.         move    D0,D1            ;save # planes
  79.         subq    #1,D1
  80.         add    D0,D0
  81.         move    D0,22(A0)        ;bytes to next word in line
  82.         move    #1,6(A0)        ;foreground color (?)
  83.         clr    8(A0)                ;bckgnd color (?)
  84.         move    8(A1),D0        ;words to next line
  85.         add    D0,D0
  86.         tst    D1
  87.         beq    v1
  88.         add    D0,D0
  89.     v1:    move    D0,24(A0)        ;bytes to next line
  90.         move.l    (A1),18(A0)        ;src &
  91.  
  92.         movea.l dest(A6),A1        ;A1 -> src MFDB
  93.         move.l    (A1),32(A0)        ;src &
  94.         move    12(A1),D0
  95.         add    D0,D0
  96.         move    D0,36(A0)        ;bytes to next word in line
  97.         move    8(A1),D0        ;words to next line
  98.         add    D0,D0
  99.         tst    D1
  100.         beq    v2
  101.         add    D0,D0
  102.     v2:    move    D0,38(A0)        ;bytes to next line
  103.  
  104.         move.l    A6,-(A7)
  105.         lea    blit,A6
  106.         dc.w    0xA007
  107.         move.l    (A7)+,A6
  108.        }
  109. }
  110.