home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d573 / plasma.lha / Plasma / FastPix.asm next >
Assembly Source File  |  1991-12-22  |  2KB  |  94 lines

  1.     CSECT   text
  2. ;use SC BLINK option to merge this guy with our default c code hunk
  3.     XDEF    @ReadPix
  4.     XDEF    @FastPix
  5. @FastPix
  6. ; D0 has x pos
  7. ; D1 has Y pos
  8. ; 4(sp) has color
  9.     Movem.l    d2-d3/a2,-(sp)
  10.     lea    _ytable(a4),a0 ; ytable array base addr
  11.     asl.l    #1,d1 ; array offset for shorts
  12.     move.w    0(a0,d1.l),a2 ; byteoffset = ytable[y]
  13.     move.l    d0,d2 ; get x in d2
  14.     asr.l    #3,d2 ; div 8 for col byte
  15.     adda.l    d2,a2 ; add to byteoffset
  16.     
  17.     and.l    #7,d0 ; x = x % 8
  18.     move.l    #7,d2
  19.     sub.w    d0,d2
  20.     ext.l    d2
  21.     moveq.l    #0,d3
  22.     move.w    _nplanes(a4),d3
  23.     moveq.l    #0,d0
  24. pixloop    move.w    d3,d0
  25.     asl.l    #2,d0
  26.     lea    _bp(a4),a0
  27.     move.l    a2,d1
  28.     move.l    0(a0,d0.l),a1
  29.     add.l    d1,a1
  30.  
  31. checkcolor
  32.     move.l    16(sp),d0 ; load color
  33.     btst    d3,d0
  34.     bne    setpixel
  35.  
  36. clearpixel
  37.     bclr    d2,(a1)
  38.     dbra    d3,pixloop
  39.     movem.l    (sp)+,d2-d3/a2
  40.     rts
  41.  
  42. setpixel
  43.     bset    d2,(a1)
  44.     dbra    d3,pixloop
  45.     movem.l    (sp)+,d2-d3/a2
  46.     rts
  47.  
  48.  
  49. @ReadPix
  50. ; D0 has x pos
  51. ; D1 has Y pos
  52.     Movem.l    d2-d4/a2,-(sp)
  53.     lea    _ytable(a4),a0 ; ytable array base addr
  54.     asl.l    #1,d1 ; array offset for shorts
  55.     move.w    0(a0,d1.l),a2 ; byteoffset = ytable[y]
  56.     move.l    d0,d2 ; get x in d2
  57.     asr.l    #3,d2 ; div 8 for col byte
  58.     adda.l    d2,a2 ; add to byteoffset
  59.     
  60.     and.l    #7,d0 ; x = x % 8
  61.     move.l    #7,d2
  62.     sub.w    d0,d2
  63.     ext.l    d2
  64.     moveq.l    #0,d3
  65.     move.w    _nplanes(a4),d3
  66.     moveq.l    #0,d0
  67.     moveq.l    #0,d4
  68. pixloo    move.w    d3,d4
  69.     asl.l    #2,d4
  70.     lea    _bp(a4),a0
  71.     move.l    a2,d1
  72.     move.l    0(a0,d4.l),a1
  73.     add.l    d1,a1
  74.  
  75.     btst.b    d2,(a1)
  76.     bne    setpixel2
  77.  
  78.     dbra    d3,pixloo
  79.     movem.l    (sp)+,d2-d4/a2
  80.     rts
  81.  
  82. setpixel2
  83.     bset.l    d3,d0
  84.     dbra    d3,pixloo
  85.     movem.l    (sp)+,d2-d4/a2
  86.     rts
  87.  
  88.  
  89.     CSECT    __MERGED,data ; naming this hunk __MERGED means a4 relative
  90.     XREF    _bp
  91.     XREF    _nplanes
  92.     XREF    _ytable
  93.     end
  94.