;The Monkey Paw ;Created by David Mears aka Stiletto ;Robot locks on nearest threat in it's scan arc and blows it away ;using 2 shot blasts. a watch is done on speed and heat to make sure ;it doesn't stop. It drives randomly. increases scan arc to 180 degrees, ;shifts down by 1/4s until using 8 degree arc with lock, then fires. ;Added wall watching routine. 1 point damage wasn't really that bad, but ;Monkeypaw shouldn't loose points to walls any more. Getting stuck was ;more problemmatic. ;also circles now if takes too much damage too quickly.. this routine ;doesn't really seam to help or hinder the robot because it isn't ;called often enough. ;this robot may be publicly distributed, though I retain copyright. ;Version 1.2 completed 4/12/97 #DEF sarc #DEF rng #def acc #def lastdmg #def turnok #def turnby #msg Lucky You! mov turnok, 0 ipo 6, lastdmg mov ax, 1 ;1=on int 3 ;keepshift, on mov sarc, 64 ;set starting scan arc var opo 17, SARC ;implement starting scan !MAIN call !MOVE ;moving out DO ax ;loop ax times (random) !for ipo 2, ax ;check heat cmp ax, 230 ;is it less than 230? jge !TOHOT call !SCAN ;Look for a target !TOHOT opo 11, 100 call !dmgchk ;are we hurt? call !gps ;where do we roam? call !turnchk ;big evasive LOOP !for ;go back to for until cx=0 jmp !MAIN ;main loop !SCAN ipo 7, rng ;check scanner cmp rng, maxint ;to far? je !widescan ;gotta widen the scan arc then ipo 8, acc ;get accuracy add acc, acc ;double accuracy cmp sarc, 4 ;scan arc small enough? jgr !smaller ;not small enough, shrink opo 15, acc ;FIRE opo 15, acc ;FIRE opo 12, acc ;rotate turrnet ret ;end of fire routine !smaller shr sarc, 2 ;reduce scan arc by 1/4 mpy acc, sarc ;mult acc by sarc opo 12, acc ;rotate turrent opo 17, sarc ;zoom ret !widescan cmp sarc, 64 ;is arc 64 jge !ROTATE ;rotate the puppy Shl sarc, 2 ;increase scan by 4 opo 17, sarc ret !ROTATE opo 12, 128 ;go 180 ret !MOVE ipo 10, ax ;Get random count and ax, 127 ;make it conform int 2 ;where am I? cmp ex, 75 ;check for walls jls !leftwall ;left wall cmp ex, 925 ;right wall jgr !rightwall ;right wall cmp fx, 75 ;top wall jls !topwall ;top wall cmp fx, 925 ;bottom wall jgr !bottomwall ;Everything else ipo 10, bx ;Get Random Direction and bx, 255 ;0..255 jmp !endrotate !leftwall opo 11, 45 ;no damage on impact.. cmp fx, 75 ;top wall jls !topleft ;top wall cmp fx, 925 ;bottom wall jgr !bottomleft ipo 10, bx ;get Random Direction and bx, 63 ;direction.. add bx, 32 ;always leave wall jmp !endrotate !topleft ipo 10, bx ;get Random Direction and bx, 31 ;direction.. add bx, 80 ;add 80 jmp !endrotate !bottomleft ipo 10, bx ;get Random Direction and bx, 31 ;direction.. add bx, 16 ; plus 16 jmp !endrotate !rightwall opo 11, 45 ;no damage on impact cmp fx, 10 ;top wall jls !topright ;top wall cmp fx, 925 ;bottom wall jgr !bottomright ipo 10, bx ;get Random Direction and bx, 63 ;direction.. add bx, 160 jmp !endrotate !topright ipo 10, bx ;get Random Direction and bx, 31 ;direction.. add bx, 144 jmp !endrotate !bottomright ipo 10, bx ;get Random Direction and bx, 31 ;direction.. add bx, 208 jmp !endrotate !topwall opo 11, 45 ;no damage on impact ipo 10, bx ;get Random Direction and bx, 63 ;direction.. add bx, 96 ;64 + jmp !endrotate !bottomwall opo 11, 45 ;no damage on impact ipo 10, bx ;get Random Direction and bx, 63 ;direction.. sub bx, 32 ;64 + !endrotate mov DX, @1 ;get compass heading sub BX, DX ;right direction opo 14, BX ;turn random number of degrees !waitforit ipo 3, bx cmp bx, @1 jne !waitforit ipo 6, lastdmg opo 11, 100 ;Full Throttle cmp turnok, 0 jle !donerotate dec turnok !donerotate ret !dmgchk ipo 6, ax ;damage? cmp ax, lastdmg ;check damage jeq !nodmg ;no dmage cmp turnok, 2 jge !okmove add turnok, 2 ;uh-oh. ipo 10, turnby and turnby, 31 sub turnby, 15 !okmove call !move ;evasive !nodmg ret !gps int 2 ;where am I? cmp ex, 50 jle !tooclose cmp ex, 950 jge !tooclose cmp fx, 50 jle !tooclose cmp fx, 950 jge !tooclose ret !tooclose call !move ret !turnchk cmp turnok, 2 jne !donechk opo 14, turnby !donechk ret #END