; The Leper ; By Leper ; ;I have commented this robot quite well so that other people can hopefully understand what is ;going on. ;I have tried to make it as efficient as possible by using @x calls rather than reading from ;ports which i only just realised take up alot of time. ;But in some places i know it is inefficient but i couldn't think of another way round of doing ;things #config scanner= 2 #config weapon= 2 #config armor= 2 #config engine= 5 #config heatsinks= 1 #config mines= 0 #config shield= 0 #def scanarc #def speed #msg The Almighty Leper ;start up mov ax, 1 int 3 ;keep shift mov speed, 100 opo 11, speed ;gets robot moving at max speed mov scanarc, 64 opo 22, 10 opo 22, 10 ;lay mines :100 cmp @0, 0 ;get speed je !stopped :200 opo 17, scanarc ;set scan arc ipo 7, ax ;scan cmp ax, 1500 jgr !no_target cmp @0, 0 jls !flip_robot ;if going backwards and found a target turn around je !steering jne !steering :201 cmp scanarc, 8 je !fire mov ax, 302 add ax, @3 je ax jne ax :300 ;accuracy = -2 mov bx, scanarc add bx, scanarc neg bx shr bx, 1 opo 12, bx ;turret faces where enemy was shr scanarc, 1 ;1/2scanarc je 100 jne 100 :301 ;accuracy = -1 mov bx, scanarc neg bx shr bx, 1 opo 12, bx ;turret faces where enemy was shr scanarc, 1 ;1/2scanarc je 100 jne 100 :302 ;accuracy = 0 opo 15 ;take a lucky shot shr scanarc, 1 ;1/2scanarc je 100 jne 100 :303 ;accuracy = 1 mov bx, scanarc shr bx, 1 opo 12, bx ;turret faces where enemy was shr scanarc, 1 ;1/2scanarc je 100 jne 100 :304 ;accuracy = 2 mov bx, scanarc add bx, scanarc shr bx, 1 opo 12, bx ;turret faces where enemy was shr scanarc, 1 ;1/2scanarc je 100 jne 100 !stopped neg speed opo 11, speed ;go opo 14, 48 ;turn a bit so if no target u dont just go back and forward je 200 jne 200 !no_target cmp scanarc, 64 je !flip_sensor shl scanarc, 1 ;double scanarc je 100 jne 100 !flip_sensor opo 12 ,128 ;turn turret to opposite direction je 100 jne 100 !steering mov ax, @2 ;current turret offset shr ax opo 14, ax ;steer 1/2 of the turret offset je 201 jne 201 !fire ipo 2, ax ;testing heat cmp ax, 300 jgr 100 cmp ax, 100 jls !overburn :500 ipo 7, ax ;another scan to get new accuracy mov bx, @3 add bx, @3 opo 15, bx mov ax, 0 ;if overburn was on it turns it off int 4 je 100 jne 100 !overburn mov ax, 1 int 4 ;over burn on je 500 jne 500 !flip_robot opo 14, 128 ;about turn neg speed ;will make the speed positive opo 11, speed ;go je 201 jne 201