;------------------------------------- ; Robot info ;------------------------------------- ; name: Fire, version 2.1 ; created: 6 Jan 2000 ; author: Dmitry N. Finozhenok ; e-mail: dfn@chat.ru ;------------------------------------- #def throttle #def scan_arc #def distance ;--------------------------------- ; Program init ;--------------------------------- mov ax, 1 int 3 ; set keepshift mov throttle, 100 out 11, throttle ; full throttle mov scan_arc, 64 ; max scan arc ;--------------------------------- ; Main loop ;--------------------------------- !start call !scan call !move !heat in 2, ax cmp ax, 250 jb !start call !move jmp !heat ;---------------------------------- ; Move control ;---------------------------------- !move cmp ColCnt, 1 jb !donemove mov ColCnt, 0 neg throttle out 11, throttle !donemove out 14, 2 ret ;---------------------------------- ; Scan control ;---------------------------------- !scan out 17, scan_arc in 7, distance cmp distance, 1600 jb !found cmp scan_arc, 64 jb !scan_wide out 12, 128 jmp !donescan !scan_wide shl scan_arc, 1 jmp !donescan !found cmp scan_arc, 2 ja !scan_more call !delta add ax, [3] cmp ax, 4 ja !real_rot cmp ax, -4 jb !real_rot jmp !fire !real_rot out 12, ax mov ax, ax !fire cmp distance, 500 out 15, ax out 15, ax ja !donescan out 15, ax jmp !donescan !scan_more cmp [3], 0 je !scan_0 jb !scan_minus cmp [3], 1 jne !scan_p2 shr scan_arc, 1 out 12, scan_arc shr scan_arc, 1 jmp !donescan !scan_0 shr scan_arc, 2 jmp !donescan !scan_p2 out 12, scan_arc shr scan_arc, 2 jmp !donescan !scan_minus cmp [3], -1 jne !scan_m2 shr scan_arc, 1 mov ax, scan_arc shr scan_arc, 1 neg ax out 12, ax jmp !donescan !scan_m2 mov ax, scan_arc neg ax out 12, ax shr scan_arc, 2 !donescan cmp scan_arc, 1 ja !scanend mov scan_arc, 2 !scanend ret ;--------------------------------- ; Calculate move delta ;--------------------------------- !delta mov fx, [13] mov ex, [6] cmp fx, 0 ja !move_forward neg fx xor ex, 128 !move_forward mov dx, 1 cmp ex, 128 jb !right_half mov dx, -1 sub ex, 256 neg ex !right_half cmp fx, 350 ja !vel_4 cmp fx, 250 ja !vel_3 cmp fx, 150 ja !vel_2 cmp fx, 50 ja !vel_1 jmp !angle_0 !vel_1 cmp ex, 16 jb !angle_0 cmp ex, 112 jb !angle_1 jmp !angle_0 !vel_2 cmp ex, 54 jb !vel_2_1 cmp ex, 100 ja !vel_2_2 jmp !angle_3 !vel_2_1 cmp ex, 24 ja !angle_2 cmp ex, 7 ja !angle_1 jmp !angle_0 !vel_2_2 cmp ex, 120 jb !angle_1 jmp !angle_0 !vel_3 cmp ex, 40 jb !vel_3_1 cmp ex, 77 ja !vel_3_2 jmp !angle_4 !vel_3_1 cmp ex, 26 ja !angle_3 cmp ex, 14 ja !angle_2 cmp ex, 4 ja !angle_1 jmp !angle_0 !vel_3_2 cmp ex, 97 jb !angle_3 cmp ex, 111 jb !angle_2 cmp ex, 123 jb !angle_1 jmp !angle_0 !vel_4 cmp ex, 80 ja !vel_4_2 cmp ex, 41 jb !vel_4_1 jmp !angle_5 !vel_4_1 cmp ex, 28 ja !angle_4 cmp ex, 19 ja !angle_3 cmp ex, 11 ja !angle_2 cmp ex, 3 ja !angle_1 jmp !angle_0 !vel_4_2 cmp ex, 95 jb !angle_4 cmp ex, 105 jb !angle_3 cmp ex, 115 jb !angle_2 cmp ex, 124 jb !angle_1 !angle_0 mov ax, 0 jmp !deltadone !angle_1 mov ax, 1 jmp !deltadone !angle_2 mov ax, 2 jmp !deltadone !angle_3 mov ax, 3 jmp !deltadone !angle_4 mov ax, 4 jmp !deltadone !angle_5 mov ax, 5 !deltadone cmp dx, 0 ja !delta_plus neg ax !delta_plus ret