home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaDemoCD2.iso / DEMOS / TRSI-CrackIntroNo2.lha / PLY2-Intro2 / INC / copper+blittermacros.s next >
Encoding:
Text File  |  1994-05-20  |  6.2 KB  |  368 lines

  1. *
  2. *****  COPPERMACROS  *******************************
  3. *
  4. ; WAIT-Befehl
  5. ;        >=X,Y
  6. wait    MACRO
  7.      dc.w    ((\1)>>1)!((\2)<<8)!1,$fffe
  8.     ENDM
  9. ; Bildschirmfarbe setzen
  10. ;        >=Farbe NR,Wert
  11. copcol  MACRO
  12.      dc.w    $180+((\1)*2),\2
  13.     ENDM
  14. ; DIW festlegen(als Copperliste)
  15. ;        >= winx,winy,winw,winh
  16. copwin  MACRO
  17.     dc.w    $8E,(\1)+((\2)<<8)
  18.     dc.w    $90,(\3)+((\1)&255)+((((\2)+(\4)-1)&255)<<8)
  19.     ENDM
  20. ; DDF    festlegen(als Clist)
  21. ;        >= winx,winy,winw in PIX.,winh,hresmode
  22. copddf    MACRO
  23.     IFEQ \5-0        ;Lores
  24.      dc.w    $92,(((\1)-17)/2)&$fff8
  25.      dc.w   $94,((((\1)-17)/2)&$fff8)+((\3)/2)-8
  26.     ENDC
  27.     IFEQ \5-1        ;Hires
  28.      dc.w    $92,(((\1)-9)/2)&$fffc
  29.      dc.w   $94,((((\1)-9)/2)&$fffc)+((\3)/4)-8
  30.     ENDC
  31.     ENDM
  32. ; Bitplane festlegen
  33. ;        >= planenr(1-6),startadresse
  34. coppln    MACRO
  35.     dc.w    $DC+((\1)*4),(\2)/65536
  36.     dc.w    $DE+((\1)*4),(\2)&$FFFF
  37.     ENDM
  38. ; Sprite festlegen
  39. ;        >= Spritenr(1-8),startadresse
  40. copspr    MACRO
  41.     dc.w    $11C+((\1)*4),(\2)/65536
  42.     dc.w    $11E+((\1)*4),(\2)&$FFFF
  43.     ENDM
  44. ; coppln-Befehl initialisieren
  45. ;        >= Coppln-Adresse,Screen-Adresse,dx wird verbraten
  46. initcoppln MACRO
  47.     move.l    #(\2),\3
  48.     move.w    \3,\1+6
  49.     swap    \3
  50.     move.w    \3,\1+2
  51.     ENDM
  52. ; Modulos festlegen
  53. ;        >=Wert
  54. copemod MACRO
  55.     dc.w    $10a,(\1)
  56.     ENDM
  57. copomod    MACRO
  58.     dc.w    $108,(\1)
  59.     ENDM
  60. ; Bildschirmmodus(BPLCON0) festlegen
  61. ;        >= BPLANZ,HIRES,DPLF,HAM,INTERLACE
  62. copmode    MACRO
  63.     dc.w    $100,((\1)<<12)+((\2)<<15)+((\3)<<10)+((\4)<<11)+((\5)<<2)
  64.     ENDM
  65. cprocoff MACRO
  66.     dc.w    $96,$8400
  67.     ENDM
  68. cprocon    MACRO
  69.     dc.w    $96,$400
  70.     ENDM
  71.  
  72. ; Copperliste starten
  73. ;        >= ?Adresse
  74.  
  75. initc    MACRO            ;Komplettstart
  76.     move.w    #$80,$96(a6)
  77.     move.l    \1,$80(a6)
  78.     clr.w    $88(a6)
  79.     move.w    #$83c0,$96(a6)
  80.     ENDM
  81. startc  MACRO            ;Nurstart
  82.     move.l    \1,$80(a6)
  83.     ENDM
  84. *
  85. ****  Blittermacros  *****************************
  86. *
  87. ; Auf Blitter warten
  88. wblit   MACRO
  89. .loop\@    btst    #14,$2(a6)
  90.     bne.s    .loop\@
  91.     ENDM
  92. lwblit   MACRO
  93.     wblit
  94.     ENDM
  95.  
  96. ; Prozessor während des Blittens an/aus
  97. procoff MACRO
  98.     move.w    #$8400,$96(a6)
  99.     ENDM
  100. procon    MACRO
  101.     move.w    #$400,$96(a6)
  102.     ENDM
  103. ; Blitter adjustieren
  104. ;        >= ABshift(FIX),ABCDDMA,Miniterm,Descend
  105. fixadj    MACRO 
  106.     move.l    #((\1)<<28)+((\2)<<24)+((\3)<<16)+((\1)<<12)+((\4)*2),$40(a6)
  107.     ENDM
  108. ;        >= ABshift (Dx mampf) ,ABCDDMA,Miniterm,Descend
  109. regadj    MACRO
  110.     swap    \1
  111.     move.w    #((\2)<<12)+((\3)<<4),\1
  112.     lsr.l    #4,\1
  113.     move.w  \1,$40(a6)
  114.     and.w    #$f000,\1
  115.     IFNE    \4
  116.      addq.w    #1,\1
  117.     ENDC 
  118.     move.w    \1,$42(a6)
  119.     ENDM    
  120.  
  121. ; Blitterposition festlegen
  122. ;        >=?Adresse
  123. blita    MACRO
  124.     move.l \1,$50(a6)
  125.     ENDM
  126. blitb    MACRO
  127.     move.l \1,$4c(a6)
  128.     ENDM
  129. blitc    MACRO
  130.     move.l \1,$48(a6)
  131.     ENDM
  132. blitd    MACRO
  133.     move.l \1,$54(a6)
  134.     ENDM
  135. ;        >=?Adresse,?Modulo
  136. mblita    MACRO
  137.     move.l \1,$50(a6)
  138.     move.w \2,$64(a6)
  139.     ENDM
  140. mblitb    MACRO
  141.     move.l \1,$4c(a6)
  142.     move.w \2,$62(a6)
  143.     ENDM
  144. mblitc    MACRO
  145.     move.l \1,$48(a6)
  146.     move.w \2,$60(a6)
  147.     ENDM
  148. mblitd    MACRO
  149.     move.l \1,$54(a6)
  150.     move.w \2,$66(a6)
  151.     ENDM
  152. ; Modulos
  153. ;    >=AMOD,DMOD
  154. setadmod MACRO
  155.     move.l    #((\1)<<16)+(\2),$64(a6)
  156.     ENDM
  157. ;    >=BMOD,CMOD
  158. setbcmod MACRO    
  159.     move.l    #((\2)<<16)+(\1),$60(a6)
  160.     ENDM
  161. ; Blitterfenster festlegen & Blitter starten
  162. ;        >=(#)Breite(in W.),(#)Höhe        
  163. doblit    MACRO
  164.     move.w #((\2)*64)+(\1),$58(a6)
  165.     ENDM
  166. *
  167. ******  VARSMACROS  ************************
  168. *
  169. ; Blittervariablen definieren
  170. defblit    MACRO
  171. bltsize    equ    $58
  172. bltcpth    equ    $48
  173. bltcptl    equ    $4a
  174. bltbpth    equ    $4c
  175. bltbptl    equ    $4e
  176. bltapth    equ    $50
  177. bltaptl    equ    $52
  178. bltdpth    equ    $54
  179. bltdptl    equ    $56
  180. bltcmod    equ    $60
  181. bltbmod    equ    $62
  182. bltamod    equ    $64
  183. bltdmod    equ    $66
  184. bltafwm    equ    $44
  185. bltalwm    equ    $46
  186. bltcon0    equ    $40
  187. bltcon1    equ    $42
  188. bltadat    equ    $74
  189. bltbdat    equ    $72
  190. bltcdat    equ    $70
  191.     ENDM
  192. ; Playfieldvars definieren
  193. defpln    MACRO
  194. diwstrt    equ    $8e
  195. diwstop    equ    $90
  196. ddfstrt    equ    $92
  197. ddfstop    equ    $94
  198. bpl1pth    equ    $e0
  199. bpl1ptl    equ    $e2
  200. bpl2pth    equ    $e4
  201. bpl2ptl    equ    $e6
  202. bpl3pth    equ    $e8
  203. bpl3ptl    equ    $ea
  204. bpl4pth    equ    $ec
  205. bpl4ptl    equ    $ee
  206. bpl5pth    equ    $f0
  207. bpl5ptl    equ    $f2
  208. bpl6pth    equ    $f4
  209. bpl6ptl    equ    $f6
  210. bplcon0    equ    $100
  211. bplcon1    equ    $102
  212. bplsft    equ    $102
  213.     ENDM
  214. defspr    MACRO
  215. spr0pth    equ    $120
  216. spr0ptl    equ    $122
  217. spr1pth    equ    $124
  218. spr1ptl    equ    $126
  219. spr2pth    equ    $128
  220. spr2ptl    equ    $12a
  221. spr3pth    equ    $12c
  222. spr3ptl    equ    $12e
  223. spr4pth    equ    $130
  224. spr4ptl    equ    $132
  225. spr5pth    equ    $134
  226. spr5ptl    equ    $136
  227. spr6pth    equ    $138
  228. spr6ptl    equ    $13a
  229. spr7pth    equ    $13c
  230. spr7ptl    equ    $13e
  231. spr0pos    equ    $140
  232. spr0ctl    equ    $142
  233. spr0data equ    $144
  234. spr0datb equ    $146
  235. spr1pos    equ    $148
  236. spr1ctl    equ    $14a
  237. spr1data equ    $14c
  238. spr1datb equ    $14e
  239. spr2pos    equ    $150
  240. spr2ctl    equ    $152
  241. spr2data equ    $154
  242. spr2datb equ    $156
  243. spr3pos    equ    $158
  244. spr3ctl    equ    $15a
  245. spr3data equ    $15c
  246. spr3datb equ    $15e
  247. spr4pos    equ    $160
  248. spr4ctl    equ    $162
  249. spr4data equ    $164
  250. spr4datb equ    $166
  251. spr5pos    equ    $168
  252. spr5ctl    equ    $16a
  253. spr5data equ    $16c
  254. spr5datb equ    $16e
  255. spr6pos    equ    $170
  256. spr6ctl    equ    $172
  257. spr6data equ    $174
  258. spr6datb equ    $176
  259. spr7pos    equ    $178
  260. spr7ctl    equ    $17a
  261. spr7data equ    $17c
  262. spr7datb equ    $17e
  263.     ENDM
  264. ; Sprite zeichnen
  265. ;     >=?x,?y,?xadd,?yadd,?Höhe,(#)Sprctrl,(#)Attach
  266. ;    Verbrät d0-d3, diese nicht für ?-Werte benutzen !
  267.  
  268. calcsprite MACRO
  269.     move.w    \2,d1
  270.     add.w    \4,d1
  271.     move.w    \1,d0
  272.     add.w    \3,d0
  273.     move.w    d0,d3
  274.     and.w    #1,d3
  275.     lsr.w    #1,d0
  276.     move.w    d0,d2
  277.     andi.w    #$ff,d2
  278.     move.w    d1,d0
  279.     add.l    \5,d0    ;Höhe
  280.     asl.w    #8,d1
  281.     bcc.s    scne8\@
  282.     bset    #2,d3
  283. scne8\@    or.w    d1,d2
  284.     asl.w    #8,d0
  285.     bcc.s    scnl8\@
  286.     bset    #1,d3
  287. scnl8\@ or.w    d0,d3
  288.     ifne    \7
  289.      bset    #7,d3
  290.     endc
  291.         move.w    d2,\6
  292.     move.w    d3,(\6)+2
  293.     ENDM
  294. ; Sprite zeichnen
  295. ;     >=?x,?y,?xadd,?yadd,?Höhe,(#)Sprctrl,(#)Attach
  296. ;    Verbrät d0-d3, diese nicht für ?-Werte benutzen !
  297.  
  298. calcspritenowd MACRO
  299.     move.w    \2,d1
  300.     add.w    \4,d1
  301.     move.w    \1,d0
  302.     add.w    \3,d0
  303.     move.w    d0,d3
  304.     and.w    #1,d3
  305.     lsr.w    #1,d0
  306.     move.w    d0,d2
  307.     andi.w    #$ff,d2
  308.     move.w    d1,d0
  309.     add.l    \5,d0    ;Höhe
  310.     asl.w    #8,d1
  311.     bcc.s    scne8\@
  312.     bset    #2,d3
  313. scne8\@    or.w    d1,d2
  314.     asl.w    #8,d0
  315.     bcc.s    scnl8\@
  316.     bset    #1,d3
  317. scnl8\@ or.w    d0,d3
  318.     ifne    \7
  319.      bset    #7,d3
  320.     endc
  321.     ENDM
  322. ******* FADEROUTINE **************
  323.  
  324. ; Copper-Liste Faden 
  325. ;    => Fadestrcut in a1, Copperliste in a2
  326. cfadeirq MACRO
  327.     subq.w    #1,8(a1)
  328.     bne.s    fiend\@
  329.     move.w    6(a1),8(a1)
  330.     move.w    (a1),d1
  331.     move.l    2(a1),a0
  332. fadl\@    clr.w    d6
  333.     move.w    #$f,d4
  334.     move.w    #$1,d5
  335.     bsr.s    dofad\@
  336.     bsr.s    dofad\@
  337.     bsr.s    dofad\@
  338.     addq.l    #2,a2
  339.     move.w    d6,(a2)+
  340.     addq.l    #2,a0
  341.     dbf    d1,fadl\@
  342. fiend\@    rts
  343. dofad\@    move.w    (a0),d2        ;Wish in d2
  344.     move.w    2(a2),d3    ;Real in d3
  345.     and.w    d4,d2
  346.     and.w    d4,d3
  347.     cmp.w    d3,d2
  348.     beq.s    dofend\@
  349.     bhi.s    addit\@
  350.     sub.w    d5,d3
  351.     bra.s    dofend\@
  352. addit\@    add.w    d5,d3    
  353. dofend\@ or.w    d3,d6
  354.     asl.w    #4,d4
  355.     asl.w    #4,d5
  356.     rts
  357.     ENDM
  358. fadestruct MACRO        ;wishpalette,anz,speed
  359.     dc.w (\2)-1    ;(0) Anz
  360.     dc.l \1     ;(2) Pal*
  361.     dc.w \3        ;(6) Speed
  362.     dc.w 1        ;(8) Co
  363.     ENDM
  364. setfadestruct MACRO        ;?Palptr,?Speed,*Struct
  365.     move.l    \1,\3+2
  366.     move.w    \2,\3+6
  367.     ENDM
  368.