Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Deform_PGZ:
  2.                                                 ;$FFFFF73C contains current vertical scroll speed, example: 01, moving two pixels down
  3.         move.w  ($FFFFF73C).w,d5                ;move it to d5 as word: d5=0100
  4.         ext.l   d5                              ;extend d5, d5=00000100 (on negative, d5=FFFFFE00)
  5.         asl.l   #4,d5                           ;shift left 4 times, d5=00001000
  6.         asl.l   #1,d5                           ;shift left once, d5=00002000
  7.         cmpi.w  #100,($FFFFF618).w
  8.         bmi.s   @slow
  9.         asl.l   #1,d5                           ;shift left once, d5=00004000
  10.         @slow:
  11.         bsr Bg_Scroll_Y                         ;go to BG_Scroll_Y
  12.  
  13.         move.w  ($FFFFF70C).w,($FFFFF618).w     ;move $FFFFF70C (current Y position of background layer) to $FFFFF618 (some dupe)
  14.  
  15.         lea ($FFFFA800).w,a1
  16.         move.w  (v_scrshiftx).w,d4
  17.         ext.l   d4
  18.         asl.l   #6,d4
  19.         move.l  d4,d1
  20.         asl.l   #1,d4
  21.         add.l   d1,d4
  22.         moveq   #2,d6
  23.         bsr ScrollBlock3
  24.         move.w  (v_scrshiftx).w,d4
  25.         ext.l   d4
  26.  
  27.         asl.l   #6,d4
  28.         moveq   #6,d6
  29.         bsr ScrollBlock5
  30.         move.w  (v_scrshiftx).w,d4
  31.         ext.l   d4
  32.         asl.l   #7,d4
  33.         moveq   #4,d6
  34.         bsr ScrollBlock4
  35.  
  36.                 @this:
  37.  
  38.         lea ($FFFFCC00).w,a1        ; load beginning address of horizontal scroll buffer to a1
  39.         move.b  #232,d3             ; max number of lines to write
  40.         move.w  ($FFFFF618).w,d1    ; get current bg vertical position
  41.         neg.w   d1
  42.         add.w   #72-1,d1            ; bigger than first part? (-1 because of dbf)
  43.         bpl.w   PGZ_Deform1         ; if not, branch
  44.         add.w   #48,d1          ; second part?
  45.         bpl.w   PGZ_Deform2         ; if not, branch
  46.         add.w   #4,d1              
  47.         bpl.w   PGZ_Deform3        
  48.         add.w   #4,d1              
  49.         bpl.w   PGZ_Deform4        
  50.         add.w   #8,d1              
  51.         bpl.w   PGZ_Deform5
  52.         add.w   #8,d1              
  53.         bpl.w   PGZ_Deform6
  54.         add.w   #16,d1             
  55.         bpl.w   PGZ_Deform7
  56.         add.w   #16,d1             
  57.         bpl.w   PGZ_Deform8
  58.         add.w   #32,d1             
  59.         bpl.w   PGZ_Deform9
  60.         add.w   #72,d1             
  61.         bpl.w   PGZ_DeformA
  62.         add.w   #16,d1             
  63.         bpl.w   PGZ_DeformB
  64.         add.w   #48,d1             
  65.         bpl.w   PGZ_DeformC
  66.         add.w   #16,d1             
  67.         bpl.w   PGZ_DeformD
  68.         add.w   #16,d1             
  69.         bpl.w   PGZ_DeformE
  70.         add.w   #80,d1             
  71.         bpl.w   PGZ_DeformF
  72.         add.w   #16,d1             
  73.         bpl.w   PGZ_Deform10
  74.         add.w   #64,d1             
  75.         bpl.w   PGZ_Deform11
  76.         add.w   #16,d1             
  77.         bpl.w   PGZ_Deform12
  78.         add.w   #32,d1             
  79.         bpl.w   PGZ_Deform13
  80.         add.w   #16,d1             
  81.         bpl.w   PGZ_Deform14       
  82.  
  83. PGZ_Deform1:
  84.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  85.         neg.w   d0          ; negate (positive to negative)
  86.         swap    d0          ; send to the left side of d0
  87.         lea     ($FFFFA800).w,a2
  88.         addq    #$0001,(a2)
  89.         move.w  (a2),d2
  90.         lsr.w   #1,d2
  91.         move.w  d2,d0
  92.         neg.w   d0
  93.  
  94. PGZ_DeformLoop_1:
  95.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  96.         sub.b   #1,d3           ; subtract for limit, it doesnt need the check for the first 232, only the last block and beyond
  97.         beq.w   PGZ_Deform_Stop ; if 0, branch
  98.         dbf d1,PGZ_DeformLoop_1 ; repeat d1 number of scanlines
  99.  
  100.         move.w  #48-1,d1        ; Mountains
  101. PGZ_Deform2:
  102.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  103.         neg.w   d0          ; negate (positive to negative)
  104.         swap    d0          ; send to the left side of d0
  105.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  106.         neg.w   d0          ; negate (positive to negative)
  107.         asr.w   #4,d0           ; divide
  108.         ;(6%)
  109. PGZ_DeformLoop_2:
  110.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  111.         sub.b   #1,d3
  112.         beq.w   PGZ_Deform_Stop ; if 0, branch
  113.         dbf d1,PGZ_DeformLoop_2 ; repeat d1 number of scanlines
  114.  
  115.         move.w  #4-1,d1     ; treea
  116. PGZ_Deform3:
  117.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  118.         neg.w   d0          ; negate (positive to negative)
  119.         swap    d0          ; send to the left side of d0
  120.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  121.         neg.w   d0          ; negate (positive to negative)
  122.         asr.w   #3,d0           ; divide
  123.         ;(12%)
  124.  
  125.        
  126. PGZ_DeformLoop_3:
  127.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  128.         sub.b   #1,d3
  129.         beq.w   PGZ_Deform_Stop ; if 0, branch
  130.         dbf d1,PGZ_DeformLoop_3 ; repeat d1 number of scanlines
  131.  
  132.         move.w  #4-1,d1     ; trees
  133. PGZ_Deform4:
  134.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  135.         neg.w   d0          ; negate (positive to negative)
  136.         swap    d0          ; send to the left side of d0
  137.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  138.         neg.w   d0          ; negate (positive to negative)
  139.         move.w  d0,d2           ; copy to d2
  140.         asr.w   #2,d0           ; divide 4
  141.         asr.w   #4,d2           ; divide 16
  142.         sub.w   d2,d0
  143.         ;(19%)
  144.  
  145. PGZ_DeformLoop_4:
  146.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  147.         sub.b   #1,d3
  148.         beq.w   PGZ_Deform_Stop ; if 0, branch
  149.         dbf d1,PGZ_DeformLoop_4 ; repeat d1 number of scanlines
  150.  
  151.         move.w  #8-1,d1     ; trees
  152. PGZ_Deform5:
  153.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  154.         neg.w   d0          ; negate (positive to negative)
  155.         swap    d0          ; send to the left side of d0
  156.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  157.         neg.w   d0          ; negate (positive to negative)
  158.         asr.w   #2,d0           ; divide
  159.         ;(25%)
  160.  
  161. PGZ_DeformLoop_5:
  162.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  163.         sub.b   #1,d3
  164.         beq.w   PGZ_Deform_Stop ; if 0, branch
  165.         dbf d1,PGZ_DeformLoop_5 ; repeat d1 number of scanlines
  166.  
  167.         move.w  #8-1,d1     ; trees
  168. PGZ_Deform6:
  169.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  170.         neg.w   d0          ; negate (positive to negative)
  171.         swap    d0          ; send to the left side of d0
  172.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  173.         neg.w   d0          ; negate (positive to negative)
  174.         move.w  d0,d2           ; copy to d1
  175.         asr.w   #1,d0           ; divide
  176.         asr.w   #3,d2           ; divide
  177.         sub.w   d2,d0
  178.         ;(37%)
  179.  
  180.  
  181.        
  182. PGZ_DeformLoop_6:
  183.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  184.         sub.b   #1,d3
  185.         beq.w   PGZ_Deform_Stop ; if 0, branch
  186.         dbf d1,PGZ_DeformLoop_6 ; repeat d1 number of scanlines
  187.  
  188.         move.w  #16-1,d1        ; trees
  189. PGZ_Deform7:
  190.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  191.         neg.w   d0          ; negate (positive to negative)
  192.         swap    d0          ; send to the left side of d0
  193.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  194.         neg.w   d0          ; negate (positive to negative)
  195.         move.w  d0,d2           ; copy to d1
  196.         asr.w   #1,d0           ; divide
  197.         asr.w   #4,d2           ; divide
  198.         sub.w   d2,d0
  199.         ;(44%)
  200.  
  201.        
  202. PGZ_DeformLoop_7:
  203.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  204.         sub.b   #1,d3           ; subtract for limit
  205.         beq.w   PGZ_Deform_Stop ; if 0, branch
  206.         dbf d1,PGZ_DeformLoop_7 ; repeat d1 number of scanlines
  207.  
  208.         move.w  #16-1,d1        ; trees
  209.  
  210. PGZ_Deform8:
  211.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  212.         neg.w   d0          ; negate (positive to negative)
  213.         swap    d0          ; send to the left side of d0
  214.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  215.         neg.w   d0          ; negate (positive to negative)
  216.         asr.w   #1,d0           ; divide
  217.         ;(50%)
  218.  
  219. PGZ_DeformLoop_8:
  220.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  221.         sub.b   #1,d3           ; subtract for limit
  222.         beq.w   PGZ_Deform_Stop ; if 0, branch
  223.         dbf d1,PGZ_DeformLoop_8 ; repeat d1 number of scanlines
  224.  
  225.         move.w  #32-1,d1        ; trees
  226.  
  227. PGZ_Deform9:
  228.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  229.         neg.w   d0          ; negate (positive to negative)
  230.         swap    d0          ; send to the left side of d0
  231.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  232.         neg.w   d0          ; negate (positive to negative)
  233.         move.w  d0,d2           ; copy to d2
  234.         asr.w   #3,d2           ; divide by 8
  235.         add.w   d2,d0
  236.         asr.w   #1,d0           ; divide by 2
  237.         ;(56%)
  238. PGZ_DeformLoop_9:
  239.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  240.         sub.b   #1,d3           ; subtract for limit
  241.         beq.w   PGZ_Deform_Stop ; if 0, branch
  242.         dbf d1,PGZ_DeformLoop_9 ; repeat d1 number of scanlines
  243.  
  244.         move.w  #72-1,d1        ; River + Dirt under first row of trees
  245.  
  246. PGZ_DeformA:
  247.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  248.         neg.w   d0          ; negate (positive to negative)
  249.         swap    d0          ; send to the left side of d0
  250.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  251.         neg.w   d0          ; negate (positive to negative)
  252.         move.w  d0,d2           ; copy to d2
  253.         asr.w   #2,d2           ; divide by 4
  254.         add.w   d2,d0
  255.         asr.w   #1,d0           ; divide by 2
  256.         ;(62%)
  257.  
  258. PGZ_DeformLoop_A:
  259.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  260.         sub.b   #1,d3           ; subtract for limit
  261.         beq.w   PGZ_Deform_Stop ; if 0, branch
  262.         dbf d1,PGZ_DeformLoop_A ; repeat d1 number of scanlines
  263.  
  264.         move.w  #16-1,d1        ; Dirt under river
  265.  
  266. PGZ_DeformB:
  267.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  268.         neg.w   d0          ; negate (positive to negative)
  269.         swap    d0          ; send to the left side of d0
  270.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  271.         neg.w   d0          ; negate (positive to negative)
  272.         move.w  d0,d2           ; copy to d2
  273.         asr.w   #1,d2           ; divide by 2
  274.         add.w   d2,d0
  275.         asr.w   #1,d0           ; divide by 2
  276.         ;(75%)
  277. PGZ_DeformLoop_B:
  278.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  279.         sub.b   #1,d3           ; subtract for limit
  280.         beq.w   PGZ_Deform_Stop ; if 0, branch
  281.         dbf d1,PGZ_DeformLoop_B ; repeat d1 number of scanlines
  282.  
  283.         move.w  #48-1,d1        ; Bricks
  284. PGZ_DeformC:
  285.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  286.         neg.w   d0          ; negate (positive to negative)
  287.         swap    d0          ; send to the left side of d0
  288.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  289.         neg.w   d0          ; negate (positive to negative)
  290.         move.w  d0,d2           ; copy to d2
  291.         asr.w   #1,d2           ; divide by 2
  292.         add.w   d2,d0
  293.         asr.w   #1,d0           ; divide by 2
  294.         asr.w   #2,d2           ; divide by 4
  295.         add.w   d2,d0
  296.         ;(87%)
  297. PGZ_DeformLoop_C:
  298.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  299.         sub.b   #1,d3           ; subtract for limit
  300.         beq.w   PGZ_Deform_Stop ; if 0, branch
  301.         dbf d1,PGZ_DeformLoop_C ; repeat d1 number of scanlines
  302.  
  303.         move.w  #16-1,d1        ; This is a dummy, change once background is imported
  304.  
  305. PGZ_DeformD:
  306.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  307.         neg.w   d0          ; negate (positive to negative)
  308.         swap    d0          ; send to the left side of d0
  309.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  310.         neg.w   d0          ; negate (positive to negative)
  311.         move.w  d0,d2           ; copy to d1
  312.         asr.w   #1,d0           ; divide by 2
  313.         asr.w   #4,d2           ; divide by 16
  314.         sub.w   d2,d0
  315. PGZ_DeformLoop_D:
  316.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  317.         sub.b   #1,d3           ; subtract for limit
  318.         beq.w   PGZ_Deform_Stop ; if 0, branch
  319.         dbf d1,PGZ_DeformLoop_D ; repeat d1 number of scanlines
  320.  
  321.         move.w  #16-1,d1        ; This is a dummy, change once background is imported
  322.  
  323. PGZ_DeformE:
  324.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  325.         neg.w   d0          ; negate (positive to negative)
  326.         swap    d0          ; send to the left side of d0
  327.         lea     ($FFFFA800).w,a2
  328.         subq    #$0002,(a2)
  329.         move.w  (a2),d0
  330.         neg.w   d0
  331. PGZ_DeformLoop_E:
  332.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  333.         sub.b   #1,d3           ; subtract for limit
  334.         beq.w   PGZ_Deform_Stop ; if 0, branch
  335.         dbf d1,PGZ_DeformLoop_E ; repeat d1 number of scanlines
  336.  
  337.         move.w  #80-1,d1        ; This is a dummy, change once background is imported
  338.  
  339. PGZ_DeformF:
  340.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  341.         neg.w   d0          ; negate (positive to negative)
  342.         swap    d0          ; send to the left side of d0
  343.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  344.         neg.w   d0          ; negate (positive to negative)
  345.         asr.w   #3,d0           ; divide
  346. PGZ_DeformLoop_F:
  347.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  348.         sub.b   #1,d3           ; subtract for limit
  349.         beq.w   PGZ_Deform_Stop ; if 0, branch
  350.         dbf d1,PGZ_DeformLoop_F ; repeat d1 number of scanlines
  351.  
  352.         move.w  #16-1,d1        ; This is a dummy, change once background is imported
  353.  
  354. PGZ_Deform10:
  355.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  356.         neg.w   d0          ; negate (positive to negative)
  357.         swap    d0          ; send to the left side of d0
  358.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  359.         neg.w   d0          ; negate (positive to negative)
  360.         asr.w   #2,d0           ; divide
  361. PGZ_DeformLoop_10:
  362.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  363.         sub.b   #1,d3           ; subtract for limit
  364.         beq.w   PGZ_Deform_Stop ; if 0, branch
  365.         dbf d1,PGZ_DeformLoop_10    ; repeat d1 number of scanlines
  366.  
  367.         move.w  #64-1,d1        ; This is a dummy, change once background is imported
  368.  
  369. PGZ_Deform11:
  370.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  371.         neg.w   d0          ; negate (positive to negative)
  372.         swap    d0          ; send to the left side of d0
  373.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  374.         neg.w   d0          ; negate (positive to negative)
  375.         move.w  d0,d2           ; copy to d1
  376.         asr.w   #3,d0           ; divide
  377.         asr.w   #4,d2           ; divide
  378.         sub.w   d2,d0
  379. PGZ_DeformLoop_11:
  380.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  381.         sub.b   #1,d3           ; subtract for limit
  382.         beq.w   PGZ_Deform_Stop ; if 0, branch
  383.         dbf d1,PGZ_DeformLoop_11    ; repeat d1 number of scanlines
  384.  
  385.         move.w  #16-1,d1        ; This is a dummy, change once background is imported
  386.  
  387. PGZ_Deform12:
  388.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  389.         neg.w   d0          ; negate (positive to negative)
  390.         swap    d0          ; send to the left side of d0
  391.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  392.         neg.w   d0          ; negate (positive to negative)
  393.         asr.w   #2,d0           ; divide
  394. PGZ_DeformLoop_12:
  395.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  396.         sub.b   #1,d3           ; subtract for limit
  397.         beq.s   PGZ_Deform_Stop ; if 0, branch
  398.         dbf d1,PGZ_DeformLoop_12    ; repeat d1 number of scanlines
  399.  
  400.         move.w  #32-1,d1        ; This is a dummy, change once background is imported
  401.  
  402. PGZ_Deform13:
  403.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  404.         neg.w   d0          ; negate (positive to negative)
  405.         swap    d0          ; send to the left side of d0
  406.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  407.         neg.w   d0          ; negate (positive to negative)
  408.         move.w  d0,d2           ; copy to d1
  409.         asr.w   #3,d0           ; divide
  410.         asr.w   #4,d2           ; divide
  411.         sub.w   d2,d0
  412. PGZ_DeformLoop_13:
  413.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  414.         sub.b   #1,d3           ; subtract for limit
  415.         beq.s   PGZ_Deform_Stop ; if 0, branch
  416.         dbf d1,PGZ_DeformLoop_13    ; repeat d1 number of scanlines
  417.  
  418.         move.w  #32-1,d1        ; This is a dummy, change once background is imported
  419.  
  420. PGZ_Deform14:
  421.         move.w  ($FFFFF700).w,d0    ; load FG screen's X position
  422.         neg.w   d0          ; negate (positive to negative)
  423.         swap    d0          ; send to the left side of d0
  424.         move.w  ($FFFFF708).w,d0    ; load BG screen's X position
  425.         neg.w   d0          ; negate (positive to negative)
  426.         asl.w   #1,d2           ; divide
  427. PGZ_DeformLoop_14:
  428.         move.l  d0,(a1)+        ; dump both the FG and BG scanline position to buffer
  429.         sub.b   #1,d3           ; subtract for limit
  430.         beq.s   PGZ_Deform_Stop ; if 0, branch
  431.         dbf d1,PGZ_DeformLoop_14    ; repeat d1 number of scanlines
  432.  
  433. PGZ_Deform_Stop:
  434. rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement