;Tempest v0.5 ;Written By Ceryen Tan ;E-mail:MTan840108@aol.com ;Description:This robot moves back and forth across the screen, avoiding walls while scanning ; in circles and fire if any target is found. Does very well in avoiding many shots ; and works best up very close. ; ;Please don't take credit for this robot!It is only meant for demonstration. ;initiating header #msg Evasive Maneuvers!! #config scanner=3 #config weapon=2 #config armor=2 #config engine=4 #config heatsinks=1 #config mines=0 #config shield=0 #def armor #def scan #def speed #def heat #def heading #def collisions opo 17 8 ;sets scan-arc ipo 6 ax ;gets armor reading set armor ax ;sets armor reading ;main program !main do 32 :1 ;loop beginning opo 11 100 ;full speed! ipo 6 ax ;gets armor reading cmp ax armor ;compares armor w/ last armor reading set armor ax ;sets armor=current armor jls 4 ;if less, do this int 2 ;get position cmp ex 120 ;too close to wall? jls !left ;if yes, do this cmp ex 880 ;too close to wall? jgr !right ;if yes, do this cmp fx 120 ;too close to wall? jls !top ;if yes, do this cmp fx 880 ;too close to wall? jgr !bottom ;if yes, do this int 12 ;sees collision count cmp fx 1 ;collide? jge !reverse ;if yes, reverse opo 12 10 ;turns turret 10 ipo 7 scan ;scans cmp scan 1500 ;sees if scan found something jls !target ;if yes, target int 12 ;sees collision count cmp fx 1 ;collide? jge !reverse ;if yes, reverse int 2 ;get position cmp ex 120 ;too close to wall? jle !left ;if yes, do this cmp ex 880 ;too close to wall? jge !right ;if yes, do this cmp fx 120 ;too close to wall? jle !top ;if yes, do this cmp fx 880 ;too close to wall? jge !bottom ;if yes, do this loop 1 ;loop end int 12 ;gets collision count cmp fx 1 ;collide? jge !reverse ;if yes, reverse opo 14 32 ;turns robot 32 degrees opo 12 -32 ;turns turret back jmp !main ;restart main !left mov ax 64 jmp !set-course jmp 1 !right mov ax 192 jmp !set-course jmp 1 !bottom mov ax 0 jmp !set-course jmp 1 !top mov ax 128 jmp !set-course jmp 1 :4 opo 14 40 jmp 1 !target ipo 2 heat ;gets heat cmp heat 175 ;too hot? jge 1 ;if yes, ignore target cmp @3 0 ;which direction? jls !fireleft ;fire left jgr !fireright ;fire right jeq !firecenter ;fire forward !fireleft opo 18 1 opo 15 -1 opo 15 -2 opo 15 -3 opo 18 0 jmp 1 !fireright opo 18 1 opo 15 1 opo 15 2 opo 15 3 opo 18 0 jmp 1 !firecenter opo 18 1 opo 15 0 opo 15 1 opo 15 -1 opo 18 0 jmp 1 !reverse mov fx 0 int 13 ;resets collision count ipo 7 scan cmp scan 1500 jls !target opo 14 128 ;turn around opo 11 100 ;full speed jmp 1 ;go back to one !set-course mov bx @1 ;get current desired heading ;(not actual heading) and ax 255 ;Fix ax into 0-255. sub ax bx ;get number of degrees to turn. opo 14 ax ;turn! neg ax ;makes ax negative opo 12 ax ;turns turret back jmp 1 ; All done!