home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d849 / rrt.lha / RRT / RRTasm.asm < prev    next >
Assembly Source File  |  1993-03-31  |  6KB  |  224 lines

  1.   CODE, PUBLIC
  2. *****    VOID __regargs UnPackByteRun(UBYTE *from, UBYTE *to)
  3. *****        calling from assembly:          a0   ,       a1
  4.          XDEF @UnPackByteRun
  5. @UnPackByteRun:
  6.           move.l    d2,-(SP)
  7.           moveq.l   #$7F,d2
  8.           bra.s     upb_startit
  9. upb_copyit
  10.           and.w     d2,d0
  11. upb_copy_loop
  12.           move.b    (a0)+,(a1)+
  13.           dbf       d0,upb_copy_loop
  14. upb_startit
  15.           move.b    (a0)+,d0
  16.           bmi.s     upb_copyit
  17.           beq.s     upb_out
  18.           and.w     d2,d0
  19.           move.b    (a0)+,d1
  20. upb_repeatit
  21.           move.b    d1,(a1)+
  22.           dbf       d0,upb_repeatit
  23.           bra.s     upb_startit
  24. upb_out
  25.           move.l    (SP)+,d2
  26.           rts
  27.  
  28.   CODE,PUBLIC
  29.      xref _LVOLoadRGB4
  30.      xref _GfxBase
  31.      xref _vport
  32. *****  VOID __regargs ComputeInterColor(UWORD *from (a0), UWORD *to (a1), UWORD step (d0));
  33. @ComputeInterColor::
  34.      movem.l   a2/a6/d2-d7,-(SP)
  35.      moveq.l   #15,d2
  36.      lea       cic_intercolor(PC),a2
  37.  
  38.      moveq.l   #31,d1
  39. cic_loop1:
  40.      move.w    (a0)+,d3  ;color
  41.      move.w    (a1)+,d4
  42.      moveq.l   #0,d7
  43.      move.w    d3,d5     ;red
  44.      move.w    d4,d6
  45.      lsr.w     #8,d5
  46.      lsr.w     #8,d6
  47.      sub.w     d5,d6
  48.      muls      d0,d6
  49.      asr.w     #4,d6
  50.      add.w     d5,d6
  51.      and.w     d2,d6
  52.      move.w    d6,d7
  53.      move.w    d3,d5     ;green
  54.      move.w    d4,d6
  55.      lsr.w     #4,d5
  56.      lsr.w     #4,d6
  57.      and.w     d2,d5
  58.      and.w     d2,d6
  59.      sub.w     d5,d6
  60.      muls      d0,d6
  61.      asr.w     #4,d6
  62.      add.w     d5,d6
  63.      and.w     d2,d6
  64.      lsl.w     #4,d7
  65.      add.w     d6,d7
  66.      move.w    d3,d5     ;blue
  67.      move.w    d4,d6
  68.      and.w     d2,d5
  69.      and.w     d2,d6
  70.      sub.w     d5,d6
  71.      muls      d0,d6
  72.      asr.w     #4,d6
  73.      add.w     d5,d6
  74.      and.w     d2,d6
  75.      lsl.w     #4,d7
  76.      add.w     d6,d7
  77.      move.w    d7,(a2)+  ;done
  78.  
  79.      dbf       d1,cic_loop1
  80.  
  81.      moveq.l   #32,d0  ;Load ### Colors into Active ViewPort
  82.      BASEREG a4
  83.      movea.l   _vport(a4),a0
  84.      movea.l   _GfxBase(a4),a6
  85.      BASEREG OFF
  86.      lea       cic_intercolor(PC),a1
  87.      jsr       _LVOLoadRGB4(a6)
  88.  
  89.      moveq.l   #3,d0
  90.      jsr       @WaitFRAMES(PC)
  91.  
  92.      movem.l   (SP)+,a2/a6/d2-d7
  93.      rts
  94. cic_intercolor:
  95.      ds.b      32*4  ;MaxKOLORs * 4
  96.  
  97.  
  98.   CODE,PUBLIC
  99.      xref      _LVOWaitTOF
  100. *****  VOID __regargs WaitFRAMES(UWORD frames(d0));
  101. @WaitFRAMES::
  102.      movem.l   a6/d2,-(SP)
  103.      BASEREG a4
  104.      movea.l   _GfxBase(a4),a6
  105.      BASEREG OFF
  106.      move.l    d0,d2
  107.      beq.s     wf_exit
  108. wf_loop:
  109.      jsr       _LVOWaitTOF(a6)
  110.      subq.w    #1,d2
  111.      bne.s     wf_loop
  112. wf_exit:
  113.      movem.l   (SP)+,a6/d2
  114.      rts
  115.  
  116. *****  extern ULONG __regargs
  117. *****     SLAM_BLITTER(struct custom *a0, BLIT_PARMS *a1);
  118.  
  119. @SLAM_BLITTER::
  120.  
  121. *** extern VOID __regargs SLAM_BLITTER(BLIT_PARMS *a0); ***
  122.  
  123. *****  Blitter begins at offset 64 (0x40)
  124. *****  BLIT_PARMS;
  125. *****     USHORT planes;              // 0
  126. *****   /*** 96  (0x60) ***/
  127. *****     SHORT  cmod,bmod,amod,dmod; // 2,4,6,8
  128. *****   /*** 112 (0x70) ***/
  129. *****     USHORT cdat,bdat,adat;      // 10,12,14
  130. *****   /*** 64  (0x40) ***/
  131. *****     USHORT con0, con1;          // 16,18
  132. *****     USHORT afwm,alwm;           // 20,22
  133. *****     USHORT *cpt,*bpt,*apt,*dpt; // 24,28,32,36
  134. *****     USHORT size;                // 40
  135. *****   /*** For MultiPlane Blits ***/
  136. *****     SHORT  adda,addb,addcd;     // 42,44,46
  137.  
  138.  
  139.      xref      _LVOOwnBlitter
  140.      xref      _LVODisownBlitter
  141.      xref      _LVOWaitBlit
  142.  
  143.      movem.l   a2/a6,-(SP)
  144.  
  145.      BASEREG a4
  146.      movea.l   _GfxBase(a4),a6
  147.      BASEREG OFF
  148.      lea       (a0),a2
  149.  
  150.      jsr       _LVOOwnBlitter(a6)
  151.      move.w    (a2)+,d1      ;Planes
  152.  
  153. sbloop:
  154.      lea       $dff040,a0         ; HARDWARE (blitter)
  155.      lea       (a2),a1
  156.  
  157.      jsr       _LVOWaitBlit(a6)   ; Doesn't modify d0,d1,a0,a1
  158.  
  159.      move.l    (a1)+,32(a0)    ;MODs
  160.      move.l    (a1)+,36(a0)
  161.      move.l    (a1)+,48(a0)    ;src Data
  162.      move.w    (a1)+,52(a0)
  163.  
  164.      move.l    (a1)+,(a0)+     ;con0 + con1
  165.      move.l    (a1)+,(a0)+     ;"a" word masks
  166.      move.l    (a1)+,(a0)+     ;csrc
  167.      move.l    (a1)+,(a0)+     ;bsrc
  168.      move.l    (a1)+,(a0)+     ;asrc
  169.      move.l    (a1)+,(a0)+     ;dest
  170.      move.w    (a1)+,(a0)      ;size and begin blit!!!
  171.  
  172.      moveq.l   #0,d0           ;Add offset to next plane
  173.      move.w    (a1)+,d0        ;a
  174.      add.l     d0,30(a2)
  175.      move.w    (a1)+,d0        ;b
  176.      add.l     d0,26(a2)
  177.      move.w    (a1)+,d0        ;cd
  178.      add.l     d0,22(a2)
  179.      add.l     d0,34(a2)
  180.  
  181.      subq.l    #1,d1           ;Decrement Plane counter
  182.      bne.s     sbloop
  183.  
  184.      jsr       _LVODisownBlitter(a6)
  185.  
  186.      movem.l   (SP)+,a2/a6
  187.      rts
  188.  
  189.      xref      _output
  190.      xref      _RStartPlane
  191.  
  192. ***** VOID __regargs ReadPoint(long int sX(d0), long int sY(d1));
  193. @ReadPoint::
  194.      move.l    d2,a1          ;Save d2 in a1
  195.      BASEREG   a4
  196.  
  197.      move.l    d1,d2          ; d1*=MOD (40)
  198.      lsl.l     #2,d2
  199.      add.l     d2,d1
  200.      lsl.l     #3,d1
  201.  
  202.      move.l    d0,d2
  203.      andi.w    #15,d2         ;d0=sX-=(d2=(sx&15))
  204.  
  205.      sub.l     d2,d0
  206.      lsr.l     #3,d0          ;d0=sX>>3
  207.      add.l     d1,d0          ;d0=(sX>>3)+(MOD*sY)
  208.      add.l     _RStartPlane(a4),d0 ;d0=StartPlane[d0]
  209.      move.l    #$8000,d1      ;Pixel=(0x8000>>d1)
  210.      lsr.l     d2,d1
  211.  
  212.      movea.l   d0,a0          ;Read(OffSet,Pixel)
  213.      and.w     (a0),d1
  214.  
  215.      beq.s     rp_nopixel
  216.      addq.l    #1,_output(a4)
  217. rp_nopixel
  218.  
  219.      BASEREG   OFF
  220.      move.l    a1,d2          ;Restore d2 from a1
  221.      rts
  222.  
  223.     END
  224.