home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src3.dms / in.adf / Source / Pobs / Pobs.lha / pobs.s < prev   
Encoding:
Text File  |  1992-06-07  |  9.5 KB  |  411 lines

  1. ;------------------------------------------------!
  2. ; *OLD* testroutine, just for checking out how   !
  3. ; boring it is not to use the blitter......      !
  4. ; I have not modified the original code, which   !
  5. ; I wrote a long time ago.. This code CAN be     !
  6. ; Optimized in a LOT of ways. Please don't mail  !
  7. ; any "why do that, when you can do this", "You  !
  8. ; sure are inconsequent" (I was inconsequent!),  !
  9. ; "Slow code, this is much faster" (I can also   !
  10. ; make this routine faster...), "You brake every !
  11. ; bloody rule here boy.." (I did that yes, and   !
  12. ; still do, but very faster..:-), "Grrr." and    !
  13. ; so on. If you don't like it then get rid of it!!
  14. ; You can always use it to look at the patterns  !
  15. ; by changing the pointer-speeds!                !
  16. ;------------------------------------------------!
  17.  
  18.     org    $20000
  19.     load    $20000
  20. j:
  21.     move.l     4,a6
  22.     move.l     #0,d0
  23.     lea     gfxname,a1
  24.     jsr     -408(a6)
  25.     tst     d0
  26.     beq     error
  27.     move.l     d0,a6
  28.     move.l     38(a6),oldcop
  29.     move.l     #copperlist,$dff080
  30.     clr.w     $dff088
  31.     move.w    #$0020,$dff096
  32.     move.w    #$4000,$dff09a
  33.  
  34.     bsr    main
  35.  
  36.     move.w    #$8020,$dff096
  37.     move.w    #$c000,$dff09a
  38.     move.l     oldcop,$dff080
  39.     clr.l     $dff088
  40. error:    rts
  41.  
  42. gfxname:dc.b     'graphics.library',0,0
  43.     even
  44. oldcop:    dc.l     0
  45.  
  46. ;==============================================================================
  47. screen    =    $40000
  48. width    =    40
  49. height    =    256
  50.  
  51. sinx_pointer1:    dc.l    sin_xtab
  52. sinx_pointer2:    dc.l    sin_xtab
  53. siny_pointer1:    dc.l    sin_ytab
  54. siny_pointer2:    dc.l    sin_ytab
  55. sinx_add1:    dc.w    4        ;change values here to obtain
  56. sinx_add2:    dc.w    2        ;new patterns
  57. siny_add1:    dc.w    2
  58. siny_add2:    dc.w    4
  59. sinx_dist1:    dc.w    12
  60. sinx_dist2:    dc.w    6
  61. siny_dist1:    dc.w    2
  62. siny_dist2:    dc.w    14
  63. number:        dc.w    23        ;number of 'pobs'
  64. ;==============================================================================
  65. main:    bsr    InPtabs
  66.     bsr    Rmasks
  67.  
  68. .loop:    cmp.b    #$30,$dff006
  69.     bne    .loop
  70.     
  71.     bsr    Swap
  72.     bsr    Clear
  73.     bsr    Calc        
  74.     bsr    Put        
  75.         
  76.     btst    #6,$bfe001
  77.     bne    .loop
  78.     rts
  79.  
  80. ;--------------------------------------------
  81. InPtabs:lea    pob_xbuffer(pc),a0
  82.     move.w    #0,d0
  83. .xloop:    move.w    d0,d1
  84.     move.w    d0,d2
  85.     and.w    #$000f,d1
  86.     lsl.w    #6,d1
  87.     move.w    d1,(a0)+
  88.     and.w    #$fff0,d2
  89.     ror.w    #3,d2
  90.     move.w    d2,(a0)+
  91.     addq    #1,d0
  92.     cmp.w    #width*8,d0
  93.     bne.s    .xloop
  94.         
  95.     lea    pob_ybuffer,a0
  96.     move.w    #0,d0
  97. .yloop:    move.w    d0,d1
  98.     mulu    #width,d1
  99.     add.l    #screen,d1
  100.     move.l    d1,(a0)+
  101.     addq    #1,d0
  102.     cmp.w    #height,d0
  103.     bne.s    .yloop
  104.     rts
  105. ;--------------------------------------------
  106. Rmasks:    move.w    #0,d7
  107.     lea    shape_buffer(pc),a1
  108. .loop1:    lea    pob_shape2(pc),a0
  109.     move.w    #16,d6
  110. .loop2:    move.l    (a0)+,d0
  111.     ror.l    d7,d0
  112.     move.l    d0,(a1)+
  113.     subq    #1,d6
  114.     bne.s    .loop2
  115.     addq    #1,d7
  116.     cmp.w    #16,d7
  117.     bne.s    .loop1
  118.     rts
  119. ;--------------------------------------------
  120. Clear:    move.l    #screen,d0
  121.     add.w    work_add(pc),d0
  122.     move.l    d0,$dff054
  123.     move.l    #$01000000,$dff040
  124.     move.w    #0,$dff066
  125.     move.w    #$4014,$dff058
  126.     rts
  127. ;--------------------------------------------
  128. Wblit:    btst    #6,$dff002
  129.     bne.s    Wblit
  130.     rts
  131. ;--------------------------------------------
  132. InPput:    lea    pob_xbuffer(pc),a0
  133.     lea    pob_ybuffer(pc),a1
  134.     lea    shape_buffer(pc),a4
  135.     move.w    work_add(pc),d6
  136.     move.w    #width,d2
  137.     rts
  138. ;--------------------------------------------
  139. Swap:    cmp.w    #0,work_add
  140.     beq.s    .set
  141.     move.w    #$0000,work_add
  142.     move.w    #$5000,cop1
  143.     rts
  144. .set:    move.w    #$5000,work_add
  145.     move.w    #$0000,cop1
  146.     rts
  147. ;--------------------------------------------
  148. Calc:
  149.     bsr    Inc
  150.     lea    coord_stack(pc),a0
  151.     move.l    sinx_pointer1(pc),a2
  152.     move.l    sinx_pointer2(pc),a3
  153.     move.l    siny_pointer1(pc),a4
  154.     move.l    siny_pointer2(pc),a5
  155.     move.w    number,d7
  156. .loop:    add.w    sinx_dist1(pc),a2
  157.     add.w    sinx_dist2(pc),a3
  158.     cmp.w    #$eeee,(a2)
  159.     bne.s    .not_x1
  160.     suba    #720,a2
  161. .not_x1:cmp.w    #$eeee,(a3)
  162.     bne.s    .not_x2
  163.     suba    #720,a3
  164. .not_x2:move.w    (a2),d0
  165.     add.w    (a3),d0
  166.     add.w    siny_dist1(pc),a4
  167.     add.w    siny_dist2(pc),a5
  168.     cmp.w    #$eeee,(a4)
  169.     bne.s    .not_y1
  170.     suba    #720,a4
  171. .not_y1:cmp.w    #$eeee,(a5)
  172.     bne.s    .not_y2
  173.     suba    #720,a5
  174. .not_y2:move.w    (a4),d1
  175.     add.w    (a5),d1
  176.     move.w    d0,(a0)+
  177.     move.w    d1,(a0)+
  178.     subq    #1,d7
  179.     bne    .loop
  180.     rts
  181. ;--------------------------------------------
  182. Inc:    move.l    sinx_pointer1(pc),a0
  183.     add.w    sinx_add1(pc),a0
  184.     cmp.w    #$eeee,(a0)
  185.     bne.s    .skip1
  186.     sub.w    #720,a0
  187. .skip1:    move.l    a0,sinx_pointer1
  188.  
  189.     move.l    sinx_pointer2(pc),a0
  190.     add.w    sinx_add2(pc),a0
  191.     cmp.w    #$eeee,(a0)
  192.     bne.s    .skip2
  193.     sub.w    #720,a0
  194. .skip2:    move.l    a0,sinx_pointer2
  195.  
  196.     move.l    siny_pointer1(pc),a0
  197.     add.w    siny_add1(pc),a0
  198.     cmp.w    #$eeee,(a0)
  199.     bne.s    .skip3
  200.     sub.w    #720,a0
  201. .skip3:    move.l    a0,siny_pointer1
  202.  
  203.     move.l    siny_pointer2(pc),a0
  204.     add.w    siny_add2(pc),a0
  205.     cmp.w    #$eeee,(a0)
  206.     bne.s    .skip4
  207.     sub.w    #720,a0
  208. .skip4:    move.l    a0,siny_pointer2
  209.     rts
  210. ;--------------------------------------------
  211. Put:    bsr    InPput
  212.     lea    coord_stack(pc),a5
  213.     move.w    number(pc),d7
  214. .loop:    move.w    (a5)+,d0
  215.     move.w    (a5)+,d1
  216.  
  217.     add.w    d0,d0
  218.     add.w    d0,d0
  219.     add.w    d1,d1
  220.     add.w    d1,d1
  221.     move.l    (a0,d0.w),d0
  222.     move.l    (a1,d1.w),a3
  223.     add.w    d6,a3
  224.     add.w    d0,a3
  225.     swap    d0
  226.     move.l    a4,a2
  227.     adda    d0,a2
  228.         
  229.     move.l    (a2)+,d0
  230.     or.l    d0,(a3)
  231.     add.w    d2,a3
  232.     move.l    (a2)+,d0
  233.     or.l    d0,(a3)
  234.     add.w    d2,a3
  235.     move.l    (a2)+,d0
  236.     or.l    d0,(a3)
  237.     add.w    d2,a3
  238.     move.l    (a2)+,d0
  239.     or.l    d0,(a3)
  240.     add.w    d2,a3
  241.     move.l    (a2)+,d0
  242.     or.l    d0,(a3)
  243.     add.w    d2,a3
  244.     move.l    (a2)+,d0
  245.     or.l    d0,(a3)
  246.  
  247.     subq    #1,d7
  248.     bne.s    .loop
  249.     rts
  250.  
  251. ;==============================================================================
  252. shape_buffer:    blk.l    256,0
  253. pob_xbuffer:    blk.l    [width*8],0
  254. pob_ybuffer:    blk.l    height,0
  255.  
  256. pob_shape:    dc.w    %0000001111000000,0
  257.         dc.w    %0000111111110000,0
  258.         dc.w    %0001111111111000,0
  259.         dc.w    %0011111111111100,0
  260.         dc.w    %0011111111111100,0
  261.         dc.w    %0111111111111110,0
  262.         dc.w    %1111111111111111,0
  263.         dc.w    %1111111111111111,0
  264.         dc.w    %1111111111111111,0
  265.         dc.w    %1111111111111111,0
  266.         dc.w    %0111111111111110,0
  267.         dc.w    %0011111111111100,0
  268.         dc.w    %0011111111111100,0
  269.         dc.w    %0001111111111000,0
  270.         dc.w    %0000111111110000,0
  271.         dc.w    %0000001111000000,0
  272.  
  273. pob_shape2:    dc.w    %0000000110000000,0
  274.         dc.w    %0000000110000000,0
  275.         dc.w    %0000011111100000,0
  276.         dc.w    %0000011111100000,0
  277.         dc.w    %0000000110000000,0
  278.         dc.w    %0000000110000000,0
  279. work_add:    dc.w    0
  280.  
  281. coord_stack:    blk.l    500,0
  282.  
  283. sin_xtab:
  284.     dc.w    75,76,78,79,80,82,83,84
  285.     dc.w    85,87,88,89,91,92,93,94
  286.     dc.w    96,97,98,99,101,102,103,104
  287.     dc.w    106,107,108,109,110,111,112,114
  288.     dc.w    115,116,117,118,119,120,121,122
  289.     dc.w    123,124,125,126,127,128,129,130
  290.     dc.w    131,132,132,133,134,135,136,136
  291.     dc.w    137,138,139,139,140,141,141,142
  292.     dc.w    142,143,144,144,145,145,145,146
  293.     dc.w    146,147,147,147,148,148,148,149
  294.     dc.w    149,149,149,149,150,150,150,150
  295.     dc.w    150,150,150,150,150,150,150,150
  296.     dc.w    150,149,149,149,149,149,148,148
  297.     dc.w    148,147,147,147,146,146,145,145
  298.     dc.w    145,144,144,143,142,142,141,141
  299.     dc.w    140,139,139,138,137,136,136,135
  300.     dc.w    134,133,132,132,131,130,129,128
  301.     dc.w    127,126,125,124,123,122,121,120
  302.     dc.w    119,118,117,116,115,114,113,111
  303.     dc.w    110,109,108,107,106,104,103,102
  304.     dc.w    101,99,98,97,96,94,93,92
  305.     dc.w    91,89,88,87,85,84,83,82
  306.     dc.w    80,79,78,76,75,74,72,71
  307.     dc.w    70,68,67,66,65,63,62,61
  308.     dc.w    59,58,57,56,54,53,52,51
  309.     dc.w    49,48,47,46,44,43,42,41
  310.     dc.w    40,39,38,36,35,34,33,32
  311.     dc.w    31,30,29,28,27,26,25,24
  312.     dc.w    23,22,21,20,19,18,18,17
  313.     dc.w    16,15,14,14,13,12,11,11
  314.     dc.w    10, 9, 9, 8, 8, 7, 6, 6
  315.     dc.w     5, 5, 5, 4, 4, 3, 3, 3
  316.     dc.w     2, 2, 2, 1, 1, 1, 1, 1
  317.     dc.w     0, 0, 0, 0, 0, 0, 0, 0
  318.     dc.w     0, 0, 0, 0, 0, 1, 1, 1
  319.     dc.w     1, 1, 2, 2, 2, 3, 3, 3
  320.     dc.w     4, 4, 5, 5, 5, 6, 6, 7
  321.     dc.w     8, 8, 9, 9,10,11,11,12
  322.     dc.w    13,14,14,15,16,17,18,18
  323.     dc.w    19,20,21,22,23,24,25,26
  324.     dc.w    27,28,29,30,31,32,33,34
  325.     dc.w    35,36,37,39,40,41,42,43
  326.     dc.w    44,46,47,48,49,51,52,53
  327.     dc.w    54,56,57,58,59,61,62,63
  328.     dc.w    65,66,67,68,70,71,72,74
  329.     dc.w    75
  330.     dc.w    $eeee,$eeee,$eeee,$eeee
  331.     dc.w    $eeee,$eeee,$eeee,$eeee
  332.     dc.w    $eeee,$eeee,$eeee,$eeee
  333.     dc.w    $eeee,$eeee,$eeee,$eeee
  334.     dc.w    $eeee,$eeee,$eeee,$eeee
  335.     dc.w    $eeee,$eeee,$eeee,$eeee
  336.     dc.w    $eeee,$eeee,$eeee,$eeee
  337.     dc.w    $eeee,$eeee,$eeee,$eeee
  338.     dc.w    $eeee,$eeee,$eeee,$eeee
  339.     dc.w    $eeee,$eeee,$eeee,$eeee
  340.  
  341.  
  342. sin_ytab:
  343.     dc.w    57,59,60,61,62,63,64,65
  344.     dc.w    66,66,67,68,69,70,71,72
  345.     dc.w    73,74,75,76,77,78,79,80
  346.     dc.w    81,82,83,84,84,85,86,87
  347.     dc.w    88,89,90,90,91,92,93,94
  348.     dc.w    94,95,96,97,97,98,99,100
  349.     dc.w    100,101,102,102,103,103,104,105
  350.     dc.w    105,106,106,107,107,108,108,109
  351.     dc.w    109,110,110,110,111,111,112,112
  352.     dc.w    112,112,113,113,113,114,114,114
  353.     dc.w    114,114,114,115,115,115,115,115
  354.     dc.w    115,115,115,115,115,115,115,115
  355.     dc.w    115,115,114,114,114,114,114,114
  356.     dc.w    113,113,113,112,112,112,112,111
  357.     dc.w    111,110,110,110,109,109,108,108
  358.     dc.w    107,107,106,106,105,105,104,103
  359.     dc.w    103,102,102,101,100,100,99,98
  360.     dc.w    97,97,96,95,94,94,93,92
  361.     dc.w    91,90,90,89,88,87,86,85
  362.     dc.w    84,84,83,82,81,80,79,78
  363.     dc.w    77,76,75,74,73,72,71,70
  364.     dc.w    69,68,67,66,66,65,64,63
  365.     dc.w    62,61,60,59,58,56,55,54
  366.     dc.w    53,52,51,50,49,49,48,47
  367.     dc.w    46,45,44,43,42,41,40,39
  368.     dc.w    38,37,36,35,34,33,32,31
  369.     dc.w    31,30,29,28,27,26,25,25
  370.     dc.w    24,23,22,21,21,20,19,18
  371.     dc.w    18,17,16,15,15,14,13,13
  372.     dc.w    12,12,11,10,10, 9, 9, 8
  373.     dc.w     8, 7, 7, 6, 6, 5, 5, 5
  374.     dc.w     4, 4, 3, 3, 3, 3, 2, 2
  375.     dc.w     2, 1, 1, 1, 1, 1, 1, 0
  376.     dc.w     0, 0, 0, 0, 0, 0, 0, 0
  377.     dc.w     0, 0, 0, 0, 0, 0, 1, 1
  378.     dc.w     1, 1, 1, 1, 2, 2, 2, 3
  379.     dc.w     3, 3, 3, 4, 4, 5, 5, 5
  380.     dc.w     6, 6, 7, 7, 8, 8, 9, 9
  381.     dc.w    10,10,11,12,12,13,13,14
  382.     dc.w    15,15,16,17,18,18,19,20
  383.     dc.w    21,21,22,23,24,25,25,26
  384.     dc.w    27,28,29,30,31,31,32,33
  385.     dc.w    34,35,36,37,38,39,40,41
  386.     dc.w    42,43,44,45,46,47,48,49
  387.     dc.w    49,50,51,52,53,54,55,56
  388.     dc.w    57
  389.     dc.w    $eeee,$eeee,$eeee,$eeee
  390.     dc.w    $eeee,$eeee,$eeee,$eeee
  391.     dc.w    $eeee,$eeee,$eeee,$eeee
  392.     dc.w    $eeee,$eeee,$eeee,$eeee
  393.     dc.w    $eeee,$eeee,$eeee,$eeee
  394.     dc.w    $eeee,$eeee,$eeee,$eeee
  395.     dc.w    $eeee,$eeee,$eeee,$eeee
  396.     dc.w    $eeee,$eeee,$eeee,$eeee
  397.     dc.w    $eeee,$eeee,$eeee,$eeee
  398.     dc.w    $eeee,$eeee,$eeee,$eeee
  399.  
  400. ;==============================================================================
  401. copperlist:
  402.     dc.l     $008e2c81,$00902cc1
  403.     dc.l     $00920038,$009400d0
  404.     dc.l     $01001200    
  405.     dc.l    $01800000
  406.     dc.l     $01820ff0
  407.     dc.l     $00e00004
  408.     dc.w    $00e2
  409. cop1:    dc.w    $0000
  410.     dc.w     $ffff,$fffe
  411.