ahh@j.cc.purdue.edu (Brent L. Woods) (02/27/88)
Program Name: Vacbench
Submitted By: Randy G. Jouett <jpdres11%usl-pc@usl.csnet>
Summary: Video hack (of sorts).
Poster Boy: Brent Woods (ahh@j.cc.purdue.edu)
Tested, part 1 of 1
NOTES: What do I say? Do I want to spoil the surprise or not? Well,
I guess I do, to save people downloading time, if they aren't
interested. This program turns your mouse pointer into a pixel
vacuum cleaner. We rather liked it. Amusing.
Brent Woods, Co-Moderator, comp.{sources,binaries}.amiga
USENET: ...!j.cc.purdue.edu!ahh ARPANET: ahh@j.cc.purdue.edu
BITNET: PODUM@PURCCVM PHONE: +1 (317) 743-8421
USNAIL: 320 Brown St., #406 / West Lafayette, IN 47906
================================================================
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# macros.i
# vac.asm
# Vac1.5.uu
# VacReadme
# This archive created: Wed Jan 27 00:57:03 1988
echo shar: extracting macros.i
sed 's/^XX//' << \SHAR_EOF > macros.i
XX*************************************************************************
XX* Macros.i -- Useful macro definition collection
XX*************************************************************************
XX
XXSYS MACRO *
XX IFGT NARG-2
XX FAIL !!!
XX ENDC
XX IFEQ NARG-2
XX MOVE.L \2,a6
XX ENDC
XX JSR _LVO\1(a6)
XX ENDM
XX
XXXLVO MACRO *
XX XREF _LVO\1
XX ENDM
XX
XXblink macro
XX bchg.b #1,$bfe001
XX endm
SHAR_EOF
if test 365 -ne "`wc -c macros.i`"
then
echo shar: error transmitting macros.i '(should have been 365 characters)'
fi
echo shar: extracting vac.asm
sed 's/^XX//' << \SHAR_EOF > vac.asm
XX*******************************************************************************
XX* *
XX* VacBench.asm Version 1.5 By Randy Jouett 02/8/88 (MetaCompost). *
XX* This program is released into the pubic/public domain :-) *
XX* If you notice any bugs, please e-mail me at one of the following addresses: *
XX* *
XX* {ihnp4,cbosgd}!killer!usl!usl-pc!jpdres11 *
XX* ut-sally!usl!usl-pc!jpdres11 *
XX* jpdres11%usl-pc@usl.CSNET *
XX* *
XX*******************************************************************************
XX
XX TTL VacBench.asm
XX
XX include "macros.i"
XX include "intuition.i"
XX include "view.i"
XX include "gfx.i"
XX include "ibase.i"
XX include "rastport.i"
XX include "screens.i"
XX include "memory.i"
XX
XX XLVO OpenLibrary
XX XLVO CloseLibrary
XX XLVO OpenWindow
XX XLVO CloseWindow
XX XLVO ActivateWindow
XX XLVO ViewPortAddress
XX XLVO ReadPixel
XX XLVO WritePixel
XX XLVO BltBitMapRastPort
XX XLVO BltBitMap
XX XLVO SetAPen
XX XLVO GetMsg
XX XLVO ReplyMsg
XX XLVO SetPointer
XX XLVO ClearPointer
XX XLVO SetRGB4
XX XLVO AllocRaster
XX XLVO FreeRaster
XX XLVO AllocMem
XX XLVO FreeMem
XX XLVO InitBitMap
XX XLVO LoadRGB4
XX
XXVACWIDTH equ 16
XXVACHEIGHT equ 46
XX
XX* Open IntuitionBase and GfxBase
XXmain:
XX moveq #0,d0 ;Library version.
XX lea.l GfxName,a1 ;Put address of graphics.library in a1.
XX SYS OpenLibrary,4 ;Open graphics.library.
XX move.l d0,GBase ;Save library ptr.
XX
XX moveq #0,d0 ;Now do same for Intuition library
XX lea.l IntuiName,a1
XX SYS OpenLibrary
XX move.l d0,IBase
XX
XX move.l IBase,a2
XX move.l ib_ActiveScreen(a2),a2 ;Get ActiveScreen.
XX lea.l sc_ViewPort(a2),a4
XX move.l a4,svp ;The ViewPort.
XX lea.l sc_RastPort(a2),a2 ;The RastPort.
XX move.l vp_ColorMap(a4),a4 ;The ColorMap.
XX
XX move.l cm_ColorTable(a4),a0 ;The ColorTable.
XX lea.l ctable,a1
XX moveq #31,d0
XX1$:
XX move.w (a0)+,(a1)+
XX dbf d0,1$
XX
XX move.l #32,count
XX move.l rp_BitMap(a2),a2 ;The Bitmap.
XX move.l a2,bm1 ;Save BitMap ptr.
XX moveq #0,d0
XX move.b bm_Depth(a2),d0 ;Get Depth.
XX move.l d0,depth
XX move.w bm_BytesPerRow(a2),d0 ;Calculate width.
XX lsl.w #3,d0
XX move.l d0,width
XX moveq #0,d0
XX move.w bm_Rows(a2),d0
XX move.l d0,height ;Save height.
XX
XX move.l #bm_SIZEOF,d0
XX move.l #MEMF_CHIP!MEMF_CLEAR,d1 ;Chip mem. Clear it out.
XX SYS AllocMem ;Allocate the mem.
XX move.l d0,bm2 ;Save prt for new BitMap.
XX beq cleanup
XX
XX move.l bm2,a0 ;Init the Bitmap
XX move.l depth,d0
XX move.l width,d1
XX move.l height,d2
XX SYS InitBitMap,GBase
XX
XX move.l depth,d3
XX subq.w #1,d3
XX move.l bm2,a2
XX lea.l bm_Planes(a2),a3
XXalloc:
XX move.l width,d0
XX move.l height,d1
XX SYS AllocRaster
XX move.l d0,(a3)+
XX dbf d3,alloc
XX
XX move.l bm1,a0 ;Copy the RastPorts BitMap to
XX moveq #0,d0 ;our new BitMap.
XX moveq #0,d1
XX move.l bm2,a1
XX moveq #0,d2
XX moveq #0,d3
XX move.l width,d4
XX move.l height,d5
XX move.l #$0c0,d6
XX move.l #$fff,d7
XX move.l #0,a2
XX SYS BltBitMap
XX
XX lea.l newwin,a2 ;Save Width & height in the
XX move.l width,d0 ;proper fields.
XX move.w d0,nw_Width(a2)
XX move.l height,d0
XX move.w d0,nw_Height(a2)
XX move.l a2,a0
XX SYS OpenWindow,IBase ;Open the Window.
XX move.l d0,vacwin ;Save prt to mywin
XX
XX move.l vacwin,a0 ;Get the window's ViewPort.
XX SYS ViewPortAddress
XX move.l d0,vp ;Save vp.
XX
XX move.l vacwin,a5 ;Grab window's RastPort.
XX move.l wd_RPort(a5),d0
XX move.l d0,rp ;Save rp.
XX
XX move.l bm2,a0 ;Blit the new BitMap to our
XX moveq #0,d0 ;window's RastPort.
XX moveq #0,d1
XX move.l rp,a1
XX moveq #0,d2
XX moveq #0,d3
XX move.l width,d4
XX move.l height,d5
XX move.l #$0c0,d6
XX SYS BltBitMapRastPort,GBase
XX
XX* SetPointer to Vaccume Cleaner
XX
XX lea.l vaccolors,a2 ;get colors
XX moveq #0,d5
XX moveq #0,d6
XXsetprt: ;Set register colors.
XX cmp.w #3,d5
XX beq 1$
XX move.w (a2)+,d6
XX move.l d6,d0
XX and.w #$f00,d6
XX lsr.w #8,d6
XX move.l d6,red
XX move.l d0,d6
XX and.w #$0f0,d6
XX lsr.w #4,d6
XX move.l d6,green
XX move.l d0,d6
XX and.w #$00f,d6
XX move.l d6,blue
XX move.l vp,a0 ;Put vp in a0.
XX move.l d5,d0
XX add.w #17,d0 ;Calculate proper register.
XX move.l red,d1 ;Move colors into registers.
XX move.l green,d2
XX move.l blue,d3
XX SYS SetRGB4 ;Set the colors.
XX add.w #1,d5 ;Bump counter.
XX jmp setprt ;Do it again.
XX1$:
XX moveq #0,d0 ;SetPointer to vaccume
XX move.l vacwin,a0 ;cleaner.
XX lea.l vacsprite,a1
XX move.l #VACHEIGHT,d0
XX move.l #VACWIDTH,d1
XX moveq #1,d2
XX moveq #1,d3
XX SYS SetPointer,IBase
XX
XX move.l vacwin,a0
XX SYS ActivateWindow ;Active the Window.
XX
XX****** Vac: The heart of the code ******
XX
XX move.l IBase,a5
XX move.l ib_ActiveScreen(a5),a5
XX moveq #0,d0
XX move.b sc_DetailPen(a5),d0
XX move.l d0,bgpen
XX move.b sc_BlockPen(a5),d0
XX move.l d0,fgpen
XX move.l vacwin,a3
XXvac:
XX move.l wd_UserPort(a3),a0 ;Grab the UserPort and get
XX SYS GetMsg,4 ;a message.
XX tst.l d0
XX beq 1$
XX move.l d0,a1
XX SYS ReplyMsg ;Reply to the message and get
XX bra cleanup ;out.
XX1$:
XX moveq #0,d0
XX move.w sc_MouseX(a5),d0
XX move.l d0,mx ;Save MouseX in mx
XX move.w sc_MouseY(a5),d0
XX move.l d0,my ;Save MouseY in my
XX moveq #10,d5 ;Size of Matrix
XX moveq #10,d6 ;Offset for x
XX moveq #10,d7 ;Offset for y
XX2$:
XX move.l rp,a1 ;Put rp in a1
XX move.l mx,d2
XX move.l my,d3
XX sub.l d6,d2
XX move.l d2,d0 ;Put x in d0 for ReadPixel
XX sub.l d7,d3
XX move.l d3,d1 ;put y in d1 for ReadPixel.
XX SYS ReadPixel,GBase ;ReadPixel at location.
XX cmp.l fgpen,d0 ;is it the same color a fgpen?
XX bne 3$ ;Nope. Go get another pixel.
XX move.l rp,a1 ;Must be equal to fgpen.
XX move.l bgpen,d0 ;Put bgpen in d0.
XX SYS SetAPen ;Set pen to background color.
XX
XX move.l rp,a1
XX move.l d2,d0
XX move.l d3,d1
XX SYS WritePixel ;Change Pixel to background.
XX
XX move.l rp,a1
XX move.l fgpen,d0
XX SYS SetAPen ;Set pen back to fgpen.
XX
XX move.l rp,a1 ;Write the pixel @ x+1 y+1
XX addq #1,d2
XX move.l d2,d0
XX addq #1,d3
XX move.l d3,d1
XX SYS WritePixel
XX3$:
XX subq #1,d6
XX tst.l d6
XX beq 4$
XX bra 2$
XX4$:
XX moveq #10,d6
XX subq #1,d7
XX subq #1,d5
XX beq clearem ;Hit Zero. Start over
XX bra 2$ ;Else, continue.
XX
XXclearem:
XX move.l rp,a1 ;Clear out pixels close to
XX move.l bgpen,d0 ;sprite.
XX SYS SetAPen
XX
XX moveq #3,d4
XX lea.l mxoffsets,a0
XX lea.l myoffsets,a2
XX1$:
XX move.l rp,a1
XX move.l mx,d2
XX sub.w (a0)+,d2
XX move.l d2,d0
XX move.l my,d3
XX sub.w (a2)+,d3
XX move.l d3,d1
XX SYS WritePixel
XX dbne d4,1$
XX bra vac
XX
XX****** Clean up everything and exit program ******
XX
XXcleanup:
XX move.l svp,a0
XX lea.l ctable,a1
XX move.l count,d0
XX SYS LoadRGB4,GBase
XX
XX moveq #0,d0
XX move.l depth,d4
XX subq.w #1,d4
XX move.l bm2,a3
XX lea.l bm_Planes(a3),a3
XXfree:
XX move.l (a3)+,a0
XX move.l width,d0
XX move.l height,d1
XX SYS FreeRaster,GBase
XX dbf d4,free
XX
XX move.l bm2,a1
XX move.l #bm_SIZEOF,d0
XX SYS FreeMem,4
XX
XX move.l vacwin,a0
XX SYS ClearPointer,IBase ;Clear out the Vac pointer.
XX
XX move.l vacwin,a0
XX SYS CloseWindow ;Close the Window.
XX
XX move.l IBase,a1 ;Put gfxbase in a1
XX SYS CloseLibrary,4 ;Close graphics.library
XX
XX move.l GBase,a1 ;Put gfxbase in a1
XX SYS CloseLibrary ;Close graphics.library
XX rts ;Exit program.
XX
XX**************************************************************************
XX* VacBench Data *
XX**************************************************************************
XX
XX section VacBenchdata,data
XX
XX****** Libraries ******
XXIntuiName:
XX dc.b 'intuition.library',0
XX ds 0
XX
XXGfxName:
XX dc.b 'graphics.library',0
XX ds 0
XX
XX****** Library Pointers ******
XX XDEF GBase
XXGBase:
XX ds.l 1
XX XDEF IBase
XXIBase:
XX ds.l 1
XX
XX****** NewWindow *****
XXnewwin:
XX dc.w 0,0 ;Left edge, top edge.
XX dc.w 0,0 ;Width, height.
XX dc.b 0,1 ;Detail and block pen.
XX dc.l MOUSEBUTTONS ;IDCMP flags.
XX dc.l BORDERLESS!SIMPLE_REFRESH ;Window flags.
XX dc.l 0 ;Prt to first gadget.
XX dc.l 0 ;Image (check mark).
XX dc.l 0 ;Window title ptr.
XX dc.l 0 ;Screen ptr.
XX dc.l 0 ;BitMap ptr.
XX dc.w 0,0 ;MinWidth, MinHeight.
XX dc.w 640,200 ;MaxWidth, MaxHeight.
XX dc.w WBENCHSCREEN ;Screen type.
XX
XX****** Window Stuff ******
XXvacwin:
XX ds.l 1
XXsvp:
XX ds.l 1
XXctable:
XX ds.w 32
XXcount:
XX ds.l 1
XXvp:
XX ds.l 1
XXrp:
XX ds.l 1
XXbm1:
XX ds.l 1
XXbm2:
XX ds.l 1
XXdepth:
XX ds.l 1
XXwidth:
XX ds.l 1
XXheight:
XX ds.l 1
XXmx:
XX ds.l 1
XXmy:
XX ds.l 1
XXfgpen:
XX ds.l 1
XXbgpen:
XX ds.l 1
XXred:
XX ds.l 1
XXgreen:
XX ds.l 1
XXblue:
XX ds.l 1
XX
XX****** Sprite Data ******
XXvacsprite:
XX dc.w $0000,$0000
XX dc.w $0000,$7000
XX dc.w $0000,$f800
XX dc.w $0000,$f800
XX dc.w $0c00,$fc00
XX dc.w $1e00,$7e00
XX dc.w $1f00,$1c00
XX dc.w $0f80,$0800
XX dc.w $07c0,$0000
XX dc.w $03e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0000
XX dc.w $01e0,$0210
XX dc.w $03f0,$0618
XX dc.w $07f8,$0e1c
XX dc.w $0ffc,$1e1e
XX dc.w $1ffe,$3e1f
XX dc.w $1ffe,$3e1f
XX dc.w $1ffe,$3f3f
XX dc.w $1ffe,$3fff
XX dc.w $0ffc,$3fff
XX dc.w $17fa,$3fff
XX dc.w $1bf6,$3fff
XX dc.w $1c0e,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $1dee,$3fff
XX dc.w $0dee,$1fff
XX dc.w $05ec,$0ffe
XX dc.w $01e8,$07fc
XX dc.w $0000,$03f8
XX dc.w $0000,$0000
XX
XXvaccolors:
XX dc.w $567,$000,$e30
XX ds 0
XX
XXmxoffsets:
XX dc.w 1,1,0,0
XX
XXmyoffsets:
XX dc.w 0,1,1,0
XX END
SHAR_EOF
if test 9281 -ne "`wc -c vac.asm`"
then
echo shar: error transmitting vac.asm '(should have been 9281 characters)'
fi
echo shar: extracting Vac1.5.uu
sed 's/^XX//' << \SHAR_EOF > Vac1.5.uu
X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^8B>0 +0@/
XXM "@L> $3J[_+B!Y 7"QY *$ZN_\0@>0 %Q.KO^X(GD H+'@
XXM!$ZN_F(B>0 "1.KOYB3G4 /L 6P $ /N #X ]8 /,
XXM #Q@ [( .D #G@ Y@ ., #A W@ -R #; V8
XXM -0 #1@ T ,Z #- R@ ,B "^ NX +H "V@
XXM M +* "P K8 *H "H@ IP *0 "A@ EX )8 "
XXM3@ CX (T "*@ A0 (. !^@ ?0 'N !X@ =P '0
XXM !P@ :8 &< !D 8H & !=@ 7 %F !8 58
XXM %0 !1@ 3H $P !*@ 0X $( _@ /0 #D W@
XXM -0 #, P@ +P "V L *H "@ B@ 'X !R
XXM9@ %P !* . "H D &@ !( $ _( /J
XXM ;FEN='5I=&EO;BYL:6)R87)Y &=R87!H:6-S+FQI8G)A<GD
XXM 0 @ A
XXM H R !
XXM
XXM
XXM < /@ #X P _ > 'X 'P < ^ " 'P ^ '@
XXM !X > '@ !X > '@ !X > '@ A #\ 88!_@.
XXM' _\'AX?_CX?'_X^'Q_^/S\?_C__#_P__Q?Z/_\;]C__' X__QWN/_\=[C__
XXM'>X__QWN/_\=[C__'>X__QWN/_\=[C__'>X__QWN/_\=[C__'>X__PWN'_\%
XXK[ _^ >@'_ _@ !6< XP $ 0 ! $ #\O\%
XX
XXend
SHAR_EOF
if test 2627 -ne "`wc -c Vac1.5.uu`"
then
echo shar: error transmitting Vac1.5.uu '(should have been 2627 characters)'
fi
echo shar: extracting VacReadme
sed 's/^XX//' << \SHAR_EOF > VacReadme
XX
XX Here's my debugged version of VacBench. I have also included the
XXsource code (maybe it will make it to a Fish Disk now :-).
XX
XX Useage: Type "Vac1.5" in the CLI.
XX
XX If you notice any bugs, I can be reached at one of the addresses
XXlisted in the source (USENET or CSNET). I can also be reached at:
XX
XX Randy Jouett
XX 121 Miller St.
XX Lafayette, La. 70503 or via 1-318-235-0438 (home)
XX
XXNOTE: If you decide to call, please check your time zone before doing so.
XXI *HATE* getting phone calls at 1:00 in the morning.
XX
XXLater,
XX Randy
SHAR_EOF
if test 520 -ne "`wc -c VacReadme`"
then
echo shar: error transmitting VacReadme '(should have been 520 characters)'
fi
# End of shell archive
exit 0