; SPINNER robot by Paul Drees (pad53945@sci.tamucc.edu) ; this robot spins around and locks onto the first enemy it sees, ; then starts firing at it. It has trouble if the enemy comes close ; to it. #config engine=1 #config armor=3 #msg Ooh, twirly... !start mov ex, 15 ; set turn rate to 15 degrees ipo 10, dx ; get a random number cmp dx, 0 ; decide whether to go left or right jae !goright neg cx ; go left !goright ipo 10, dx and dx, 255 opo 13, dx ; set turret to 0 degrees opo 17, 4 ; set scan arc to 4 degrees mov ax, 0 ; turn keepshift off int 3 !twirl opo 14, ex ; turn opo 11, 100 ; and go forward ipo 7, bx ; scan for an enemy cmp bx, 1500 ; is one there? jbe !notwirl ; if so, then go kill it ja !twirl ; and continue !notwirl mov ax, 1 int 3 ; turn keepshift on !kill mov fx, @3 shl fx, 1 add fx, @3 ipo 2, cx ; check my heat cmp cx, 200 ; is it higher than 200? ja !nofire ; then don't fire opo 15, fx ; else fire! !nofire opo 12, fx ; rotate turret for accuracy opo 14, ex ; turn cmp cx, 200 ; check heat again ja !nofire2 opo 15, fx ; else fire again! !nofire2 opo 11, 100 ; and go forward ipo 7, bx ; scan for an enemy cmp bx, 1500 ; is one there? ja !nokill ; if not, then start scanning cmp bx, 100 ; is the enemy really close? ja !kill ; if not, keep going mov fx, ex ; else get my turn speed shl fx, 2 ; * 4 opo 14, fx ; and go that way jbe !kill ; and keep going !nokill mov ax, 0 int 3 ; set keepshift off ja !twirl