; Yep, there has been a bob routine written - it can only handle 60 bobs in ; it's current form (in this demo anyway) but it's only my first true routine. ; P.S. I know the bobs are only single colour things, but it's an achievement! ; First, some stuff to make altering the pattern a little easier bxmult equ 150 bymult equ 85 bxoffset equ 2 byoffset equ 1 bxstep equ 2 bystep equ 5 bxnext equ 7 bynext equ 10 bnumber equ 60 ; The sine table, created by a BASIC program sin8table incbin "sin8" even ; Data space for bob locations bobdata dcb.l bnumber,0 ; The bob data - first, size in words/pixels bobwide equ 2 ; words bobhigh equ 16 ; pixels ; The bob data - bitmap bobbitmap dc.w $0000,0,$0180,0,$03c0,0,$07e0,0 dc.w $0ff0,0,$1998,0,$36dc,0,$79de,0 dc.w $76de,0,$36dc,0,$1988,0,$0ff0,0 dc.w $07e0,0,$03c0,0,$0180,0,$0000,0 ; The bob data - the mask bobmask dc.w $0180,0,$03c0,0,$07e0,0,$0ff0,0 dc.w $1ff8,0,$3ffc,0,$7ffe,0,$ffff,0 dc.w $ffff,0,$7ffe,0,$3ffc,0,$1ff8,0 dc.w $0ff0,0,$07e0,0,$03c0,0,$0180,0 ; *** THE BOB CODE *** bobinit move.l #bnumber-1,d0 ; number of bobs move.l #bobdata,a0 ; bob position array move.w #0,d1 ; first bob starts at 0,0 move.w #0,d2 ; (screen positions taken bobinitloop move.w d1,(a0)+ ; from sine table) move.w d2,(a0)+ add.w #bxnext,d1 cmp.w #360,d1 bcc bobinitxwrap bobinitnoxwrap add.w #bynext,d2 cmp.w #360,d2 bcc bobinitywrap bobinitnoywrap dbf d0,bobinitloop rts bobinitxwrap sub.w #360,d1 bra bobinitnoxwrap bobinitywrap sub.w #360,d2 bra bobinitnoywrap bobmain bsr BOBW4B ; wait for blitter move.l #-1,bltafwm(a6) ; clear bob plane move.l #$01000000,bltcon0(a6) move.w #0,bltdmod(a6) move.l MemBase,bltdpt(a6) move.w #12052,bltsize(a6) move.l #bnumber-1,d0 ; update positions move.l #bobdata,a0 ; (pretty self-explanatory) bobupdateloop add.w #bxstep,(a0) cmp.w #360,(a0) bcc bxwrap bnoxwrap add.l #2,a0 add.w #bystep,(a0) cmp.w #360,(a0) bcc bywrap bnoywrap add.l #2,a0 dbf d0,bobupdateloop move.l #bobdata,a0 ; now draw the bobs move.l #sin8table,a1 move.l #bnumber-1,d0 bobdrawloop move.w (a0)+,d1 and.l #$ffff,d1 add.l d1,d1 move.w (a1,d1),d1 mulu #bxmult,d1 lsr.l #8,d1 add.l #bxoffset,d1 move.w (a0)+,d2 and.l #$ffff,d2 add.l d2,d2 move.w (a1,d2),d2 mulu #bymult,d2 lsr.l #8,d2 add.l #byoffset,d2 bsr.s putbob dbf d0,bobdrawloop rts bxwrap sub.w #360,(a0) bra bnoxwrap bywrap sub.w #360,(a0) bra bnoywrap putbob move.w d1,d3 lsr.w #4,d3 and.w #$f,d1 bsr.s BOBW4B move.l #$ffffffff,bltafwm(a6) lsl.w #8,d1 lsl.w #4,d1 move.w d1,bltcon1(a6) or.w #$0ff2,d1 move.w d1,bltcon0(a6) move.w #0,bltamod(a6) move.w #0,bltbmod(a6) move.w #40-(bobwide*2),bltcmod(a6) move.w #40-(bobwide*2),bltdmod(a6) move.l #bobbitmap,bltapt(a6) move.l #bobmask,bltbpt(a6) mulu #40,d2 add.l d3,d2 add.l d3,d2 add.l MemBase,d2 move.l d2,bltcpt(a6) move.l d2,bltdpt(a6) move.w #bobhigh*64+bobwide,bltsize(a6) rts BOBW4B btst #14,dmaconr(a6) BOBW4Bloop btst #14,dmaconr(a6) bne.s BOBW4Bloop rts