home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Source / pheno.lha / pha / BalkH.s < prev    next >
Encoding:
Text File  |  1987-12-17  |  8.4 KB  |  407 lines

  1. ;------------------------------------------------------------------------
  2. ;-                                    -
  3. ;-            'RasterBalk - Rymd'                -
  4. ;-                                    -
  5. ;------------------------------------------------------------------------
  6.  
  7. org    $20000
  8. load    $20000
  9.  
  10. >EXTERN        'Perspektiv2',Per
  11. >EXTERN        'BalkSin',Sin
  12. >EXTERN        'Welcome',Text
  13.  
  14. ;------------------------------------------------------------------------
  15.  
  16. S:        movem.l    d0-d7/a0-a6,-(sp)
  17.         bsr.s    Startup
  18.         bsr.L    InitRutin
  19.         bsr.s    StartCop
  20.         bsr.L    MainLoop
  21.         bsr.s    RestoreCop
  22.         movem.l    (sp)+,d0-d7/a0-a6
  23.         rts
  24.  
  25. Startup:    move.l    $4.W,a6
  26.         lea.l    Lib(pc),a1
  27.         lea    OldCop(pc),a2
  28.         moveq    #0,d0
  29.         moveq    #15,d3
  30.         jsr    -408(a6)
  31.         move.l    d0,a0
  32.         move.l    $26(a0),(a2)+
  33.         lea.l    $dff000,a6
  34.         move.w    2(a6),d0
  35.         bset    d3,d0
  36.         move.w    d0,(a2)+
  37.         move.w    $1c(a6),d0
  38.         bset    d3,d0
  39.         move.w    d0,(a2)+
  40.         rts
  41.  
  42. StartCop:    lea    CopperList(pc),a0
  43.         move.l    a0,$80(a6)
  44.         tst.w    $88(a6)
  45.         move.w    #$7fff,d0
  46.         move.w    d0,$96(a6)
  47.         move.w    d0,$9a(a6)
  48.         move.w    #$87c0,$96(a6)
  49.         move.w    #$c000,$9a(a6)
  50.         rts
  51.  
  52. RestoreCop:    lea    OldCop(pc),a0
  53.         move.l    (a0)+,$80(a6)
  54.         tst.w    $88(a6)
  55.         move.w    (a0)+,$96(a6)
  56.         move.w    (a0)+,$9a(a6)
  57.         rts
  58.  
  59.     ;-----------------------------------------------------
  60.         OldCop:        dc.l    0
  61.         OldDma:        dc.w    0
  62.         OldIrq:        dc.w    0
  63.         Lib:        dc.b    'graphics.library',0
  64.                 even
  65.     ;-----------------------------------------------------
  66.  
  67. ;------------------------------------------------------------------------
  68.  
  69. BlitWait:    btst    #14,2(a6)
  70.         bne.S    BlitWait
  71.         rts
  72.  
  73. ClearScreen:    bsr.S    BlitWait
  74.         move.l    #-1,$44(a6)
  75.         move.l    #$01000000,$40(a6)
  76.         move.w    d2,$66(a6)
  77.         move.l    d0,$54(a6)
  78.         move.w    d1,$58(a6)
  79.         rts
  80.  
  81. ;------------------------------------------------------------------------
  82.  
  83. InitRutin:    lea    CopAdr(pc),a3
  84.         movem.l    (a3),a0-a1
  85.         moveq    #-2,d0
  86.         lea.l    CopperList(pc),a2
  87. MLoop:        move.l    (a2),(a0)+
  88.         move.l    (a2)+,(a1)+
  89.         cmp.l    (a2),d0
  90.         bne.S    MLoop
  91.  
  92.         move.l    a0,d0
  93.         sub.l    (a3),d0
  94.         lea    CopAdd(pc),a2
  95.         move.l    d0,(a2)
  96.  
  97.         move.l    #$2007fffe,d0
  98.         move.l    #$01800000,d1
  99.         move.l    #$20ddfffe,d2
  100.         move.l    #$01000000,d3
  101.         move.w    #281-1,d7
  102. MLoop2:        move.l    d0,(a0)+
  103.         move.l    d0,(a1)+
  104.         move.l    d1,(a0)+
  105.         move.l    d1,(a1)+
  106.         move.l    d2,(a0)+
  107.         move.l    d2,(a1)+
  108.         add.l    d3,d0
  109.         add.l    d3,d2
  110.         dbra    d7,MLoop2
  111.         moveq    #-2,d0
  112.         move.l    d0,(a0)+
  113.         move.l    d0,(a1)+
  114.  
  115.         lea    BarSizes+64(pc),a0
  116.         moveq    #2,d0
  117.         moveq    #31,d7
  118. BarLoop1:    move.w    d0,d1
  119.         lsl.w    #6,d1
  120.         addq.w    #1,d1
  121.         move.w    d1,-(a0)
  122.         addq.w    #1,d0
  123.         dbf    d7,BarLoop1
  124.  
  125.         lea    BarAddress+128(pc),a0
  126.         lea    CopperBar(pc),a1
  127.         moveq    #32*2,d0
  128.         moveq    #32-1,d7
  129. BarLoop2:    move.l    a1,-(a0)
  130.         add.l    d0,a1
  131.         subq.w    #2,d0
  132.         dbf    d7,BarLoop2
  133.  
  134.         lea    MulsAdr,a0
  135.         moveq    #0,d0
  136.         moveq    #12,d1
  137.         move.w    #344-1,d7
  138. ML:        move.w    d0,(a0)+
  139.         add.w    d1,d0
  140.         dbf    d7,ML
  141.         rts
  142.  
  143.  
  144. CopAdr:        dc.l    $60000
  145.         dc.l    $70000
  146. CopAdd:        dc.l    0
  147. MulsAdr:    =    $65000
  148.  
  149. BarSizes:    blk.w    32,0
  150. BarAddress:    blk.l    32,0
  151.  
  152. ;------------------------------------------------------------------------
  153.  
  154. MainLoop:    tst.b    $6(a6)
  155.         bne.S    MainLoop
  156.         tst.b    $5(a6)
  157.         bne.S    MainLoop
  158.         btst    #10,$16(a6)
  159.         beq.S    MainLoop
  160.  
  161.         ;move.w    #$ff,$180(a6)
  162.         bsr.s    Bars
  163.         ;move.w    #$fff,$180(a6)
  164.  
  165.         btst    #6,$bfe001
  166.         bne.S    MainLoop
  167.         rts
  168.  
  169. ;------------------------------------------------------------------------
  170.  
  171. Bars:        bsr.s    Buffra
  172.         bsr.s    Rensa
  173.         bsr.s    Sinus
  174.         bsr.L    Rakna
  175.         bsr.L    Plotta
  176.         rts
  177.  
  178. Buffra:        lea    CopAdr(pc),a0
  179.         move.l    (a0),d0
  180.         move.l    4(a0),(a0)+
  181.         move.l    d0,(a0)
  182.         move.l    d0,$80(a6)
  183.         tst.w    $88(a6)
  184.         rts
  185.  
  186. Rensa:        lea    CopAdr(pc),a0
  187.         move.l    (a0),d0
  188.         add.l    8(a0),d0
  189.         addq.l    #6,d0
  190.         moveq    #12-2,d2
  191.         move.w    #281*64+1,d1
  192.         bsr.L    ClearScreen
  193.         rts
  194.  
  195. Sinus:        lea    Ollie(pc),a0
  196.         move.w    (a0),d0
  197.         move.w    #1000,d1
  198.         addq.w    #1,d0
  199.         cmp.w    d1,d0
  200.         blo.S    NoOllie
  201.         sub.w    d1,d0
  202. NoOllie:    move.w    d0,(a0)
  203.         add.w    d0,d0
  204.         lea    Sin,a0
  205.         move.w    (a0,d0.W),d0
  206.         and.w    #127,d0
  207.         add.w    #-204,d0
  208.         lea    YPos(pc),a0
  209.         move.w    d0,(a0)
  210.  
  211.         lea    ZPos(pc),a0
  212.         move.w    (a0),d4
  213.         sub.w    #6,d4
  214.         cmp.w    #480,d4
  215.         bge.S    NoNewZ
  216.         add.w    #120,d4
  217. NoNewZ:        move.w    d4,(a0)
  218.         rts
  219.  
  220. Ollie:        dc.w    0
  221. YPos:        dc.w    -140
  222. ZPos:        dc.w    1400
  223.  
  224. Rakna:        lea    BalkPosses(pc),a0
  225.         lea    Per(pc),a1
  226.         move.w    ZPos(pc),d0
  227.         move.w    #128,d4
  228.         move.w    YPos(pc),d5
  229.         moveq    #AntZ-1,d7
  230. BL1:        moveq    #AntY-1,d6
  231.         move.w    d5,d1
  232. BL2:        move.w    (a1,d0.W),d2
  233.         move.w    d2,d3
  234.         muls    d1,d2
  235.         lsl.l    #3,d2
  236.         swap    d2
  237.         move.w    d3,(a0)+
  238.         add.w    #204,d2
  239.         move.w    d2,(a0)+
  240.         add.w    d4,d1
  241.         dbf    d6,BL2
  242.         sub.w    #120,d0
  243.         dbf    d7,BL1
  244.         rts
  245.  
  246. Plotta:        lea    BalkPosses(pc),a0
  247.         lea    CopperBar(pc),a1
  248.         lea    BarAddress-4(pc),a2
  249.         lea    MulsAdr,a3
  250.         lea    Nuffror(pc),a4
  251.         move.l    CopAdr(pc),d5
  252.         add.l    CopAdd(pc),d5
  253.         addq.w    #6,d5
  254.  
  255.         bsr.L    BlitWait
  256.         moveq    #-1,d0
  257.         move.l    d0,$44(a6)
  258.         move.l    #$09f00000,$40(a6)
  259.         moveq    #12-2,d0
  260.         move.l    d0,$64(a6)
  261.  
  262.         moveq    #AntY*10-1,d7
  263. PLoop:        move.w    (a0)+,d0
  264.         lsr.w    #7,d0
  265.         and.w    #$fffc,d0
  266.         move.l    (a2,d0.W),d3
  267.         lsr.w    #2,d0
  268.         move.w    (a0)+,d1
  269.         move.w    d0,d4
  270.         lsr.w    #1,d4
  271.         sub.w    d4,d1
  272.         cmp.w    (a4)+,d1
  273.         bgt.S    NoBar
  274.         cmp.w    (a4)+,d1
  275.         bgt.S    NoUpper
  276.  
  277.         cmp.w    #32,d1
  278.         bls.S    NoBar
  279.         moveq    #64,d4
  280.         sub.w    d1,d4
  281.         cmp.w    d0,d4
  282.         bge.S    NoBar
  283.         sub.w    d4,d0
  284.         add.w    d4,d4
  285.         add.w    d4,d3
  286.         moveq    #64,d1
  287.  
  288. NoUpper:    sub.w    (a4),d1
  289.         lsl.w    #6,d0
  290.         addq.w    #1,d0
  291.         move.l    d5,d4
  292.         add.w    d1,d1
  293.         add.w    (a3,d1.W),d4
  294. BW:        btst    #14,2(a6)
  295.         bne.S    BW
  296.         movem.l    d3-d4,$50(a6)
  297.         move.w    d0,$58(a6)
  298. NoBar:        lea    Nuffror(pc),a4
  299.         dbf    d7,PLoop
  300.         rts
  301.  
  302. Nuffror:    dc.w    354,64,64
  303.  
  304. AntZ:        =    5
  305. AntY:        =    4
  306.  
  307. BalkPosses:    blk.w    2*[AntZ*AntY]*2,0
  308.  
  309. ;------------------------------------------------------------------------
  310.  
  311. CopperList:    dc.l    $008e4866,$009010c6,$00920030,$009400d8
  312.         dc.l    $01020000,$01040000,$01080000,$010a0000
  313.  
  314.         dc.l    $01800000
  315.         dc.l    $01000000
  316.  
  317.         dc.l    -2
  318.  
  319. ;------------------------------------------------------------------------
  320.  
  321. CopperBar:
  322. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00,$e00,$f00
  323. dc.w    $f00,$e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  324. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00,$e00
  325. dc.w    $f00,$e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  326.  
  327. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00,$e00
  328. dc.w    $e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  329. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00
  330. dc.w    $e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  331.  
  332. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00,$d00
  333. dc.w    $d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  334. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00
  335. dc.w    $d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  336.  
  337. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00
  338. dc.w    $c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  339. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00
  340. dc.w    $c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  341.  
  342. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00
  343. dc.w    $b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  344. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00
  345. dc.w    $b00,$a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  346.  
  347. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00
  348. dc.w    $a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  349. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900
  350. dc.w    $a00,$900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  351.  
  352. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800,$900
  353. dc.w    $900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  354. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800
  355. dc.w    $900,$800,$700,$600,$500,$400,$300,$200,$100,$000
  356.  
  357. dc.w    $000,$100,$200,$300,$400,$500,$600,$700,$800
  358. dc.w    $800,$700,$600,$500,$400,$300,$200,$100,$000
  359. dc.w    $000,$100,$200,$300,$400,$500,$600,$700
  360. dc.w    $800,$700,$600,$500,$400,$300,$200,$100,$000
  361.  
  362. dc.w    $000,$100,$200,$300,$400,$500,$600,$700
  363. dc.w    $700,$600,$500,$400,$300,$200,$100,$000
  364. dc.w    $000,$100,$200,$300,$400,$500,$600
  365. dc.w    $700,$600,$500,$400,$300,$200,$100,$000
  366.  
  367. dc.w    $000,$100,$200,$300,$400,$500,$600
  368. dc.w    $600,$500,$400,$300,$200,$100,$000
  369. dc.w    $000,$100,$200,$300,$400,$500
  370. dc.w    $600,$500,$400,$300,$200,$100,$000
  371.  
  372. dc.w    $000,$100,$200,$300,$400,$500
  373. dc.w    $500,$400,$300,$200,$100,$000
  374. dc.w    $000,$100,$200,$300,$400
  375. dc.w    $500,$400,$300,$200,$100,$000
  376.  
  377. dc.w    $000,$100,$200,$300,$400
  378. dc.w    $400,$300,$200,$100,$000
  379. dc.w    $000,$100,$200,$300
  380. dc.w    $400,$300,$200,$100,$000
  381.  
  382. dc.w    $000,$100,$200,$300
  383. dc.w    $300,$200,$100,$000
  384. dc.w    $000,$100,$200
  385. dc.w    $300,$200,$100,$000
  386.  
  387. dc.w    $000,$100,$200
  388. dc.w    $200,$100,$000
  389. dc.w    $000,$100
  390. dc.w    $200,$100,$000
  391.  
  392. dc.w    $000,$100
  393. dc.w    $100,$000
  394. dc.w    $000
  395. dc.w    $100,$000
  396.  
  397. dc.w    $000
  398. dc.w    $000
  399. dc.w    $000
  400. dc.w    $000
  401.  
  402. Per:        =    $25000
  403. Sin:        =    $40000
  404. Text:        =    $50000
  405. ss:
  406.  
  407.