; 'Last Man Standing' ; AT-Robots Model light-weight ; optimized version ; 32 compiled lines ; ; Started: 05/08/99 ; Finished: 08/08/99 ; by Juergen Werner #config scanner=5 #config weapon=3 #config armor=3 #config engine=0 #config heatsinks=1 #config mines=0 #config shield=0 !begin mov dx, 64 ; scanarc stored in dx !start opo 17, dx : set scanarc ipo 7, fx ; scan cmp fx, 1501 ; found one? jae !flip ; found no one -> flip ;*** OLD ROUTINE FOR TURRET CORRECTION ;*** mov bx, dx ; scanarc to bx ;*** mpy bx, @3 ; multiply with accuracy ;*** sar bx, 1 ; divide by 2 ;*** opo 12, bx ; rotate turret to enemy ;NEW ROUTINE FOR TURRET CORRECTION cmp 0, @3 ; check accuracy jeq !finished ; if 0 then no change -> finished mov bx, dx ; scanarc to bx jls !positive ; if acc positive -> positive ;negative neg bx ; else acc is negative cmp -2, @3 ; compare accuracy to -2 jeq !continue ; if so, no multiplication needed sar bx, 1 ; /2 jne !continue ; ok !positive cmp 2, @3 ; compare accuracy to 2 jeq !continue ; if so, no multiplication needed sar bx, 1 ; /2 !continue opo 12, bx ; rotate turret to enemy !finished ;decrease scanarc cmp dx, 1 ; scanarc = 1? jbe !special ; if so -> special shr dx, 1 ; half scanarc ;targetnear cmp fx, 200 ; target far away? jae !start ; far away -> start, else fire !special cmp 0, @7 ; target moving jne !fire ; if moving just -> fire shr dx, 1 ; not moving decrease scanarc, fire opo 15, 0 ; fire, target doesn't move !fire opo 15, 0 ; fire jeq !start ; start over jne !start ; start over !flip opo 12, 128 ; turn turret round jae !begin ; start over and set scanarc = 64