#config scanner= 4 #config weapon= 2 #config armor= 2 #config engine= 3 #config heatsinks= 1 #config mines= 0 #config shield= 0 #def scanarc #def speed #def max_heat #def angle_1 #def angle_2 #def angle_3 #def angle_4 #def angle_5 #def angle_6 #def angle_7 #def angle_8 ;start up opo 22, 16 opo 11, 100 ;go mov scanarc, 64 mov speed, 100 mov max_heat, 250 mov ax, 1 int 3 ;keep shift opo 17, scanarc opo 22, 16 !start ipo 7, ax ;scan cmp ax, 1500 ;target jls !target jgr !no_target :100 cmp @0, 0 ;moving? je !stopped int 2 cmp ex, 250 jls !wall_left cmp ex, 750 jgr !wall_right cmp fx, 250 jls !wall_top cmp fx, 750 jgr !wall_bottom opo 14, 6 je !start jne !start ;********************************* ; * ;Wall avoiding * ; * ;********************************* !wall_left cmp @1, 128 ;desired heading is not towards wall so leave it jls !start int 19 ;resets meters travelled counter ipo 3, ax cmp ax, 192 jls !anticlockwise jge !clockwise !wall_right cmp @1, 128 ;heading not towards wall jgr !start int 19 ;resets meters travelled counter ipo 3, ax cmp ax, 64 jls !anticlockwise jge !clockwise !wall_top int 19 ;resets meters travelled counter ipo 3, ax cmp ax, 64 jls !clockwise cmp ax, 192 jgr !anticlockwise jmp !moving !wall_bottom int 19 ;resets meters travelled counter ipo 3, ax cmp ax, 128 jls !anticlockwise jge !clockwise !clockwise opo 14, 66 je !moving jne !moving !anticlockwise opo 14, -66 je !moving jne !moving !moving cmp @9, 16 opo 11, speed jls !moving jae !start ;******************************** !stopped opo 14, 32 neg speed opo 11, speed je !start jne !start ;******************************** ; ;targetting ; ;******************************** !target cmp scanarc, 4 je !firing mov bx, 202 add bx, @3 jne bx :200 ;@3 = -2 mov cx, scanarc neg cx opo 12, cx shr scanarc, 1 opo 17, scanarc je 100 jne 100 :201 ;@3 = -1 mov cx, scanarc shr cx, 1 neg cx opo 12, cx shr scanarc, 1 opo 17, scanarc je 100 jne 100 :202 ;@3 = 0 shr scanarc, 1 opo 17, scanarc je 100 jne 100 :203 ;@3 = 1 mov cx, scanarc shr cx, 1 opo 12, cx shr scanarc, 1 opo 17, scanarc je 100 jne 100 :204 ;@3 = 2 opo 12, scanarc shr scanarc, 1 opo 17, scanarc je 100 jne 100 !no_target cmp scanarc, 64 je !flip shl scanarc, 1 ;double scanarc opo 17, scanarc ;set it je 100 jne 100 !flip opo 12, 128 je 100 jne 100 ;******************************** !firing ipo 2, ax cmp ax, max_heat jgr !too_hot c