home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI04.ARJ / ictari.04 / ASSEMBLY / ASMBELR1.S next >
Text File  |  1987-09-15  |  5KB  |  176 lines

  1. *
  2. * HBL Color change...
  3. * A6 reserved as colorpointer.
  4. * Code BY Thomas Abrahamsson 1990
  5. * For *INC* Magazine
  6. * Documented version:
  7. * (C) BlueSTar 1990
  8. * Of course, this routine is not
  9. * optimized at all, that's up to
  10. * you (hehe)!
  11. *
  12.  
  13.  
  14.     pea        0  *Let's enter supervisor
  15.     move.w    #$20,-(sp)
  16.     trap    #1
  17.     addq.l    #6,sp
  18.     move.l    d0,nd+2 *Save old stack
  19.     bsr    scra  * Build the screen
  20.     bsr    bygg_lista *Prepare A6 color list,
  21.     bsr    init *Init Interrupt routines....
  22.     
  23. lopen: *The main loop
  24.      .wait_vbl: *Wait for the VBL
  25.     tst.b    vsync * Dito
  26.     beq.s    .wait_vbl *Dito
  27.     sf    vsync * Set false VBL flag
  28.     cmp.b    #$81,$fffffc02.w *Key pressed?
  29.     bne    lopen *Oh, no!
  30.     bsr    bye *Reinstall old interrupts...
  31.     MOVE.W    #$324,$FF8240 *Just for fun!
  32.  
  33. nd:    move.l    #0,-(sp)     set user back
  34.     move.w    #$20,-(sp)
  35.     trap        #1
  36.     add.l        #6,sp 
  37.     clr.w    -(sp) *And good bye
  38.     trap    #1 *END
  39. ****************************
  40.  
  41. bye:    move.w    #$2700,sr
  42. shbl    move.l    #0,$120          restore old interrupts
  43. svbl    move.l    #0,$70
  44. s09    move.b    #0,$fffa09
  45. sxx    MOVE.B    #0,$FFFA07
  46. s1b    move.b    #0,$fffa1b
  47. s21    move.b    #0,$fffa21
  48.     bset        #3,$fffffa17
  49.     move.w    #$2300,sr
  50.     rts
  51. init:    move.w    #$2700,sr
  52.     move.l    $120,shbl+2    *save old interrupts
  53.     move.l    $70,svbl+2
  54.     move.b    $fffa09,s09+3
  55.     MOVE.B    $FFFA07,sxx+3
  56.     move.b    $fffa1b,s1b+3
  57.     move.b    $fffa21,s21+3
  58.     move.l    #hbl,$120
  59.     move.l    #vbl,$70
  60.     MOVE.B    #1,$FFFA07
  61.     MOVE.b    #0,$fffa09
  62.     move.b    #1,$fffa21 *STEP step
  63.     move.b    #8,$fffa1b
  64.     bclr        #3,$fffffa17
  65.     OR.B        #1,$FFFFFA13
  66.     move.w    #$2300,sr
  67.     rts
  68. vbl:    move.w    #$770,$ff8240 *Check time!
  69.     bsr        bygg_lista
  70.     lea        fet_lista,a6
  71.     st        vsync
  72.     move.w    #$000,$ff8240 *Dito
  73.     rte
  74.  
  75. scra: *Build screen
  76.     *movem.l    pal,d0-d7 *New palette!
  77.     *movem.l    d0-d7,$ff8240 *to $ff8240!
  78.     move.l    $44e.w,a0 *Physbase.
  79.     moveq.l    #39,d1 *40-1 Words in X.
  80.     tjo:
  81.     move.l    a0,a4 *Restore physbase
  82.     add.w        #8,a0 * 8 out
  83.     move.l    #200-1,d2 * 200 lines screen
  84.     tji: *Big loop
  85.     lea        img(pc),a2 * The bitplane data
  86.     tju: *Little loop
  87.     move.w    (a2)+,(a4) * To screen, PL0
  88.     move.w    (a2)+,2(a4) *PL1
  89.     move.w    (a2)+,4(a4) *PL2
  90.     move.w    (a2)+,6(a4) *PL3
  91.     lea        160(a4),a4 *160 bytes/ line
  92.     dbra        d2,tji *Loop it thanx
  93.     dbra        d1,tjo *Dito
  94.     rts
  95.  
  96. *pal:   dc.w $0000,$0222,$0500,$0700,$0444,$0666,$0500,$0700 
  97. *       dc.w $0620,$0730,$0650,$0770,$0620,$0730,$0650,$0770
  98.  
  99. img:    dc.w    %1010101010101010 *BITPLANE 0
  100.     dc.w    %0110011001100110 *1
  101.     dc.w    %0001111000011110 *2
  102.     dc.w    %0000000000000000 *3 
  103.  
  104.  
  105. hbl:  move.l    (a6)+,$ffff8240.w
  106.     move.l    (a6)+,$ffff8244.w *AARRGH...
  107.     move.l    (a6)+,$ffff8248.w
  108.     move.l    (a6)+,$ffff824c.w
  109.     rte
  110.  
  111. bygg_lista: *BUild colorlist!
  112.     moveq        #0,d0
  113.     moveq        #0,d1
  114.     moveq        #0,d3
  115.     add.w        #1,variabel *Sinus Counter Pointer
  116.     move.w    variabel,d3
  117.     cmp.w        #angel,d3 *loop sinus?
  118.     bne.s        dier *NOO!
  119.       clr.w    variabel *Yeah
  120.      moveq.l    #0,d3 *Funny
  121.     dier:
  122.     * Y in d3
  123.     *lsl        #1,d3 *Mulu 2
  124.     lea        sunis(pc),a4 *Data list
  125.     move.b    (a4,d3.w),d3 *sinusdata to d3
  126.     and.w        #7,d3 *And with 8 lower bits
  127.     lea        fal_pal(pc),a0 *and offset into colorimg
  128.     lsl        #4,d3 *Mulu 16, Eg ( 8 words per line = 16 bytes)
  129.     add.w        d3,a0 *Offset this too
  130.     lea        fet_lista(pc),a1 *Adress to the BIG list
  131.     move.l    #24,d0 *25 * 8 = 200
  132.     move.l    a0,a2 *Save
  133.     so: * BIG loop
  134.     move.l    a2,a0 *Add.er
  135.     rept     8
  136.     move.l    (a0)+,(a1)+ *From Colorimg to BIG list
  137.     move.l    (a0)+,(a1)+
  138.     move.l    (a0)+,(a1)+ *OPtimize with movem here yourself... (Jag orkar inte)
  139.     move.l    (a0)+,(a1)+
  140.     endr     *8 ggr
  141.     dbra        d0,so *Do loop
  142.     clr.w        -16(A1)
  143.     rts *Return.us
  144.  
  145. variabel:    dc.w    0 *Cnter
  146. vsync    dc.w    0 *Flag
  147. angel        equ    314 *Numebr siuns numbers
  148.     even
  149. sunis: * Y sinus data... Optimize here to use .b if you want to.
  150.   * 0-155 ,Sektor  1/4 cirkel  0-99/0-99 x,y
  151.    dc.b   127,129,132,134,137,139,142,144,147,149,152,154,157,159,162,164,166,169,171,174,176,178,181,183,185,187,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218
  152.    dc.b   219,221,223,224,226,228,229,231,232,233,235,236,237,239,240,241,242,243,244,245,246,247,247,248,249,250,250,251,251,252,252,252,253,253,253,253,253,253,253,253,253
  153.    dc.b   253,253,253,252,252,252,251,251,250,250,249,248,247,247,246,245,244,243,242,241,240,239,237,236,235,233,232,231,229,228,226,225,223,221,219,218,216,214,212,210,208
  154.    dc.b   207,205,203,200,198,196,194,192,190,188,185,183,181,178,176,174,171,169,167,164,162,159,157,154,152,149,147,144,142,139,137,134,132,129,127,124,122,119,117,114,111
  155.    dc.b   109,106,104,101,99,97,94,92,89,87,84,82,80,77,75,73,70,68,66,64,61,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,30,29,27,26,24
  156.    dc.b   23,21,20,18,17,16,15,13,12,11,10,9,8,7,6,6,5,4,4,3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2
  157.    dc.b   2,3,3,4,5,5,6,7,8,9,10,11,12,13,14,16,17,18,19,21,22,24,25,27,28,30,32,33,35,37,39,41,42,44,46,48,50,52,54,57,59
  158.    dc.b   61,63,65,67,70,72,74,77,79,81,84,86,89,91,93,96,98,101,103,106,108,111,113,116,118,121,124,126
  159.    even
  160.  
  161. fal_pal:
  162.     * IMAGE:
  163.     rept    2
  164.     dc.w    $0,$777,$777,$777,$777,$777,$777,$333
  165.     dc.w    $0,$777,$222,$222,$222,$333,$333,$111
  166.     dc.w    $0,$777,$222,$222,$333,$333,$333,$111
  167.     dc.w    $0,$777,$222,$333,$333,$333,$333,$111
  168.     dc.w    $0,$777,$333,$333,$333,$333,$444,$111
  169.     dc.w    $0,$777,$333,$333,$333,$444,$444,$111
  170.     dc.w    $0,$777,$333,$333,$444,$444,$444,$111
  171.     dc.w    $0,$333,$111,$111,$111,$111,$111,$111
  172.     endr
  173.  
  174. fet_lista:    ds.w    8*200
  175.  
  176.