; ; MIKBOT ; ; by Mike 24.12.1998 #msg Be happy! #def friend jmp !begin ; jump to the starting point ; data area, needed for aiming ; totally 26 entries, ment 256 div 10 to access data. ; first data addr is 1028, then 1029, 1030,{!!!} 1032, 1033 ; this happens because of mem alloc used by the simulation prog ; [50%] [75%] [100%] 3 4 4 2 4 4 2 3 4 2 3 4 1 2 3 1 1 2 0 0 1 0 -1 -1 -1 -1 -2 -2 -2 -3 -2 -3 -3 -2 -3 -4 -2 -4 -4 -3 -4 -4 -2 -4 -4 -2 -3 -3 -2 -3 -3 -1 -2 -2 -1 -1 -1 0 0 0 0 1 1 2 2 2 2 3 3 2 4 4 3 4 4 3 4 4 !begin mov friend, 15 ; 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 mov found, 0 xor fx, fx ; clear loop trigger out 17, ax ; set scan arc = a1 !scan_try 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 mov bx, 4 ; set end arc to 4 !scan_acc 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 out 12, dx ; rotate turret by a3 mov fx, 1 ; set loop trigger jmp !scan_try !scan_found cmp ax, bx ; check if done jne !scan_next 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 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, 4 ; set scan arc to 4 in 6, armor ; update damage out 11, 100 ; set thr=100% :2 inc counter ; counter=couter+1 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, 4 ; prepare to scan mov cx, 128 ; prepare to scan mov dx, 128 ; prepare to scan jmp !scan !scan_ret out 17, 4 ; set scan arc to 4 cmp found, 1 ; je 4 ; if found goto 4 jmp 2 ; goto 2 :4 in 2, ax ; get heat cmp ax, 300 ; check overheat jgr 2 ; if so goto 2 ;weapon control mov ax, @3 ; get accuracy ;aiming add ax, 128 ; ax:=ax+128; sub ax, @6 ; ax:=ax-thr_dir; ;add ax, @2 ; ax:=ax+tpos; ax=phi; mod ax, 256 ; set ax ot range [0..256] cmp @7, 50 ; if thr_spd<50 then jls !no_aim ; goto no_aim cmp @7, 75 ; if thr_spd<75 then jls !aim_50 ; goto aim_50 cmp @7, 100 ; if thr_spd<100 then jls !aim_75 ; goto aim_75 !aim_100 shr ax, 3 ; ax:=(ax*4) div 10; add ax, 1030 ; ax:=ax+1030; ax=@phi get bx, ax ; bx:=@ax; jmp !fire ; goto firing procedure; !aim_75 shr ax, 3 ; ax:=ax*4 div 10; add ax, 1029 ; ax:=ax+1029; ax=@phi get bx, ax ; bx:=@ax; jmp !fire ; goto firing procedure; !aim_50 shr ax, 3 ; ax:=ax*4 div 10; add ax, 1028 ; ax:=ax+1028; ax=@phi get bx, ax ; bx:=@ax; jmp !fire ; goto firing procedure; !no_aim out 15, @3 ; fire! fire! fire! fire! fire! fire! out 12, @3 ; rotate turret jmp 2 ; goto 2 !fire out 12, bx ; rotate turret out 15, 0 ; fire! fire! fire! fire! fire! fire! 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