; ; MIKBOT ; ; by Mike 19.08.1999 #msg Be happy! #def friend mov friend, 40 ; set friend id out 19, friend ; set id=friend jmp !main ; goto starting point ;scanner subroutine ;INPUT : AX <- starting scan arc (a1) ; BX <- ending scan arc (may be changed due to accuracy) ; CX <- scan param 2 (a2) ; DX <- scan param 3 (a3) ;OUTPUT : found -> [0,1] 1 if found ; sets turret to desired angle #def found !scan ;err 4 mov found, 0 ;err 41 xor fx, fx ; clear loop trigger out 17, ax ; set scan arc = a1 !scan_try ;err 5 in 7, ex ; get distance to scanned obj cmp @5, friend ; check scanned bot id je !scan_exit ; if native then exit cmp @7, 90 ; check foe speed jle !scan_acc ;err 51 mov bx, 4 ; set end arc to 4 !scan_acc ;err 6 cmp ex, 2000 ; check if found jls !scan_found !scan_exit cmp fx, 0 ; check if we are in the loop jnz !scan_ret ; if so goto done ;err 61 out 12, dx ; rotate turret by a3 mov fx, 1 ; set loop trigger jmp !scan_try !scan_found ;err 7 cmp ax, bx ; check if done jne !scan_next ;err 71 mov found, 1 ; found!!! jmp !scan_ret !scan_next shr ax, 1 ; a1=a1 div 2 shr cx, 1 ; a2=a2 div 2 add dx, cx ; a3=a3+a2 out 12, ax ; rotate turret by a1 ;err 8 jmp !scan ;end scanner subroutine #def armor #def counter !main mov counter,0 ; counter=0 mov ax, 1 ; ax=1 int 3 ; set keep_shift out 17, 2 ; set scan arc to 2 in 6, armor ; update damage out 11, 100 ; set thr=100% :2 inc counter ; counter=couter+1 ;out 12, 5 ; rotate turret by 5dgr in 6, cx ; get armor cmp armor, cx ; check damage jne 6 ; if hit goto 5 cmp @0, 0 ; check if stopped je 5 ; if so goto 6 in 7, ax ; get dist to foe cmp @5, friend ; check scanned bot id je 3 ; if id=friend then exit; cmp ax, 2000 ; check found jls 4 ; if so goto 4 :3 mov ax, 64 ; prepare to scan mov bx, 2 ; prepare to scan mov cx, 128 ; prepare to scan mov dx, 128 ; prepare to scan jmp !scan !scan_ret out 17, 2 ; set scan arc to 2 cmp found,1 ; je 4 ; if found goto 4 jmp 2 ; goto 1 :4 in 2, ax ; get heat cmp ax, 200 ; check overheat jgr 2 ; if so goto 2 mov ax, @3 ; get accuracy add ax, ax ; err @6 cmp @7, 10 ; check target speed jls 41 ; if <10 then overburn cmp @6, 250 ; check foe heading jgr 41 cmp @6, 5 ; check foe heading jls 41 jmp 42 :41 out 18, 1 ; set overburn out 15, ax ; fire! out 15, ax ; fire! out 15, ax ; fire! out 15, ax ; fire! out 15, ax ; fire! out 18, 0 ; reset overburn :42 out 15, ax ; fire! out 12, ax ; rotate turret jmp 2 ; goto 2 :5 out 11, 100 ; set thr=100% :6 in 6, cx ; get armor mov armor, cx ; update damage cmp counter,10 ; check counter jle 2 mov counter,0 ; counter=0 out 14, 120 ; turn right by 120dgr out 11, 100 ; set thr=100% jmp 2 ; goto 2 #END