home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / DEMOS / MEGADEMO / PASSIONP.ARJ / PASSIONP.MSA / JELLY / GEL_CUBE.S < prev    next >
Text File  |  1997-03-05  |  2KB  |  63 lines

  1. ; *************************************************************************
  2. ; *****              Routine which draws a jelly cube.                *****
  3. ; *************************************************************************
  4. ; The jelly cube is not clipped. It is always x centered.
  5. ; *************************************************************************
  6. ; Parameters:    a3.l = adress of ramvideo.
  7. ;    d7.l = adress of source image. (linear image)
  8. ;    a4.l = adress of zoom routines adress table.
  9. ;    d4.w = y1.
  10. ;    d5.w = y2.
  11. ;    d6.w = jelly_coefficient. (Between -8 ~ 16)
  12.  
  13.   movem.l    d0-a6,-(sp)
  14.  
  15.   sub.w    d4,d5    ; d5=y2-y1=dy.
  16.   move.l    #.y_table,a5    ; Table y->adress, with x centering...
  17.   add.w    d4,d4    ; One word per y.
  18.   add.w    (a5,d4.w),a3    ; a3 points on the good (x;y).
  19.   move.l    #.edges,a5    ; Table of edges.
  20.   addq.w    #8,d6    ; This table begins at offset 0.
  21.   mulu.w    #96*2,d6    ; d6 is the offset to the good edge.
  22.   add.w    d6,a5    ; a5 points on the edge to use.
  23.   move.w    d5,.counter
  24.   addq.w    #$1,d5    ; d5=y2-y1+1=dy.
  25.   mulu.w    #682,d5    ; d5=dy*65536/96.
  26.   move.w    #$8000,d6    ; d6=error.
  27.   move.l    #.return,a2    ; For the return.
  28.  
  29. .one_line:
  30.   add.w    d5,d6    ; error=error+(dy*65536/96).
  31.   bcc.s    .pass_one_line
  32. .draw_one_line:
  33.   move.l    a3,a1    ; Ramvideo adress.
  34.   move.l    d7,a0    ; Source image.
  35.   move.w    (a5)+,d0    ; d0 is the edge*4.
  36.   move.l    (a4,d0.w),a6    ; a6=adress of the zoomrout to use.
  37.   add.w    #$a0,a3    ; Next line.
  38.   add.l    #96,d7    ; Next source line.
  39.   jmp    (a6)    ; Print the line.
  40. .return:
  41.   sub.w    #$1,.counter    ; We have done one line.
  42.   bpl.s    .one_line
  43.   movem.l    (sp)+,d0-a6
  44.   rts
  45.  
  46. .pass_one_line:
  47.   addq.w    #$2,a5    ; Next edge.
  48.   add.l    #96,d7    ; Next source line.
  49.   bra.s    .one_line
  50.  
  51. .edges:
  52.   incbin    'a:\jelly\gel_edge.xxx'
  53.  
  54. .y_table:        ; Table y->adress.
  55. N set 56        ; For x centering.
  56.  rept    200
  57.   dc.w    N
  58. N set N+160        ; Next line.
  59.  endr
  60.  
  61. .counter:
  62.   ds.w    1
  63.