pouët.net

Rastorbars by Orb [web]

*****************************************************************************
* rastorbars
*
* a small 256 byte kef- or alcatraz bars (including file header)
* for amiga ocs...
*
* ultra^orb 20110601
*
*****************************************************************************
release         equ     1
plane           equ     $1f00
bgcol           equ     $215
col1            equ     $876
col2            equ     $c96
col3            equ     $de9

        section shortig, code_c
*****************************************************************************
start
        if      release=0
        moveq   #1,d0
        moveq   #1,d4
        lea     start-4,a3
        endc

        ;create sin
        move    #$381>>1,d5

        moveq   #127,d6
createsin
        add     d5,d4
        move.l  d4,d2
        asr     #7,d2
        move.b  d2,-(a3)
        neg     d2
        move.b  d2,-128(a3)

        subq    #7,d5
        dbf     d6,createsin

        ;d6 is later used for the blitter first/last mask
        swap    d6

mainloop:
        ;clear bitplane
        move    #plane+36,a5
        moveq   #(36/4)-1,d0
clr
        clr.l   -(a5)
        dbf     d0,clr

        moveq   #$3b,d7
        move    d5,d3
drawloop:
        lea     copper(pc),a0
        lea     $dff000+$42,a6
        move.l  a0,$80-$42(a6)


        ;get    sin value for the current line
        ext.w   d3
        move.b  (a3,d3),d2
        add     d7,d2
        ext.w   d2

        lea     (a5),a1

        move.b  (a3,d2),d0
        ext.w   d0

        ;write bit plane ptr
        move.l  a1,$e0-$42(a6)
        lea     18(a1),a1
        move.l  a1,$e4-$42(a6)

        ;calc screen adress and shift
        move    d0,d1
        lsl     #7,d0
        lsl     #4,d0
        asr     #4,d1

        ;and finally start the blitter to copy the bar
        move    d0,(a6)+        ;42

        ;minterm D = AB+!AC -> $CA
        or      #$fca,d0
        move    d0,$40-$44(a6)

        move.l  d6,(a6)+        ;44     mask
        lea     8(a1,d1),a1
        move.l  a1,(a6)+        ;48 source c    screen
        move.l  a0,(a6)+        ;4c source b    bar
        subq    #2,a0
        move.l  a0,(a6)+        ;50 source a    mask
        move.l  a1,(a6)+        ;54 dest        screen

sync
        cmp.b   $06-$58(a6),d7
        bne.s   sync
        move.w  #(2<<6)+2,(a6)+ ;58 start
        addq    #6,a6

        ;first blit will be wrong because the modulos aren't
        ;correct... but hm ... who cares ? ;)
        move.l  #$ffeafffe,(a6)+        ;mod c & b
        move.l  #$fffcffea,(a6)+        ;mod a & d

        subq.b  #1,d3
        addq.b  #1,d7
        bcc.s   drawloop

        ;some   sin movement
        addq    #1,d5

        if      release
        bra.s   mainloop
        else
        btst    #6,$bfe001
        bne.s   mainloop
        illegal
        endc
*****************************************************************************

        ;dummy fill up to reach 256 bytes
        ;cool even 2 bytes left
        dc.w    $DEAD

;       mask for the blitter
        dc.w    $0fff
copper
        ;bar data...
        ;placed inside the copper writes to 1f8... seems this doesn't harm
        dc.w    %000111111000, %011001100110

        ;colors
        dc.w    $0182,col1
        dc.w    $0184,col2
        dc.w    $0186,col3

        dc.w    $009a,$7fff             ; irqs off

        ;screen setup
        dc.w    $0096,$0020             ; sprites off
        dc.w    $008e,$3b81             ; window start
        dc.w    $0090,$fcd1             ; window stop
        dc.w    $0092,$0040+$28         ; fetch start
        dc.w    $0094,$0080+$28         ; fetch stop
        dc.w    $0100,$2200
        dc.w    $3b01,$fffe
        dc.w    $0180,bgcol
        dc.w    $fc01,$fffe
        dc.w    $0180,$0000



*****************************************************************************
        printt  "size:"
        if      release=1
        printv  *-start
        printv  *-start+36
        else
        printv  *-start-20
        printv  *-start-20+36
        endc
*****************************************************************************
        end