; Publically distributable ; define vars #def armor #def hitcheck #def hit #def accuracy #def x #def y #def sfire #def move #def th #def bo #def hot #def true #def false #def si set move 4000 set sfire 6000 set true -1 set false 0 set hot false set si 0 ; Settings... :1 mov hitcheck 50 opo 17 5 ; scan-arc width is now 5 opo 13 ; aim turret forward. call move opo 11 100 ; Throttle to 100% mov ax, 1 int 3 ; turn keep-shift on. ; Main loop... :2 opo 11, 100 ; Throttle to 100% ;Shift 19 opo 12 11 ; Rotate turret right ;if enemy gosub 1000 ipo 7 ax ; Scan! cmp ax 5000 ; find anything? ja 3 ; if not, continue on... call 1000 ; if so, let's shoot it. :3 ;if hit gosub 2000 mov hit 0 ; hit=0 call hitcheck cmp hit 0 ; have we been shot? je 4 ; if not, let's continue... call 4000 ; if so, let's pick a new direction. :4 ;if heat>250 gosub 8999 ipo 2 ax ; get heat into AX cmp ax 250 ; are we hotter than 250? jls 5 ; if not, skip along.. set hot true jmp 99 :5 set hot false :99 ipo 7 ax ; Scan for an enemy cmp ax 5000 ; find anything? ja 6 ; if not, continue... call 1000 ; if so, call the firing routine :6 inc si cmp si, 10 jb 98 set si 0 ipo 16 th cmp th 5000 ja 98 mov ax th call 5000 call sfire :98 ;Get location int 2 ; EX,FX = X,Y ;Scenario 1 cmp ex 950 ; X>=950? jb 11 ; If not, skip. call 4001 ; If so, call scenario1 :11 ;Scenario 2 cmp ex 50 ; X<=50? ja 12 ; If not, skip. call 4002 ; If so, call scenario2 :12 ;Scenario 3 cmp fx 950 ; Y>=950? jb 13 ; If not, skip. call 4003 ; If so, call scenario3 :13 ;Scenario 4 cmp fx 50 ; Y <= 50? ja 14 ; If not, skip. call 4004 ; If so, call scenario4 :14 ipo 1, ax ; Get currnt throttle cmp ax, 0 ; throttle>0? ja 20 ; if so, skip call 2000 ; if not, let's get moving! :20 jmp 2 ; Return to the main program ; Shooting sub-routine... :1000 ;fire ipo 8 th ; get scan accuracy shl th 1 ; Do a (accuracy*3) in 3 moves add th th call sfire ; Use my handy spread fire routine ;if hit gosub 2000 set hit 0 ; hit=0 gsb hitcheck cmp hit 0 ; have we been hit? je 1001 ; if not, skip along call 2000 ; otherwise, let's do something! :1001 ipo 2, ax ; get heat cmp ax, 150 ; over 150? ja 1002 ; if so, let's not bother scanning. ;if enemy goto 1000 ipo 7 ax ; scan again. cmp ax 1000 ; find anything? jls 1000 ; if so, attack! :1002 call 2000 ; veer off ret ; Lost 'em... let's return... ;Veer off... :2000 ;randspin gsb 4000 ;Delay 9 & move 100 opo 11 100 ; Throttle to 100% ret ; Cool-down subroutine... :8999 ;if heat>200 goto 8999 ipo 2 ax ; ax=heat cmp ax 200 ; heat over 200? jb 9000 ; if so, set the flag set hot true ; Set the hot flag to true ret :9000 set hot false ; We're not hot, set the flag to false ret ;Hitcheck :50 ;read and compare armor ipo 6 ax ; get armor cmp ax armor ; has it changed? ;if no damage then simply exit. jeq 51 ; no damage.. let's go ;if hit, then say so! set armor ax ; update armor variable set hit 1 ; register the hit. :51 ret ;Randspin :4000 ;Randspin ipo 10 ax ; Get random number and ax 0xFF ; now it is 0-255. ;Get location int 5 ; EX,FX = X,Y ;Scenario 1 cmp ex 950 ; X>950? jae 4001 ; If so, scenario1. ;Scenario 2 cmp ex 50 ; X<50? jbe 4002 ; If so, scenario2. ;Scenario 3 cmp fx 950 ; Y>950? jae 4003 ; If so, scenario3. ;Scenario 4 cmp fx 50 ; Y<50? jbe 4004 ; If so, scenario4. ;Last resort (not near a wall) opo 14 ax ; use random heading chosen above. delay 10 opo 11 100 ; throttle to 100% ret ;Scenario 1 :4001 ipo 10, ax ; random number and ax 0x40 ; now it is 0-63. add ax 0xA0 ; now it is 160-223 call 5000 ; turn to that heading. ret ;Scenario 2 :4002 ipo 10, ax ; random number and ax 0x40 ; now it is 0-63. add ax, 0x20 ; now it is 32-95. call 5000 ; turn to that heading. ret ;Scenario 3 :4003 ipo 10, ax ; random number and ax 0x40 ; now it is 0-63. add ax, 0E0h ; now it is 224-287. and ax, 255 ; now it is 224-255 or 0-31. call 5000 ; turn to that heading. ret ;Scenario 4 :4004 ipo 10, ax ; random number and ax 0x40 ; now it is 0-63. add ax, 60h ; now it is 96-159. call 5000 ; turn to that heading. ret ;course-setting subroutine ;set course to heading in AX. :5000 mov bx, @1 ; get current desired heading ; (not actual heading) sub ax, bx ; get number of degrees to turn. opo 14, ax ; turn! delay 5 opo 11, 100 ; Throttle to 100% ret :6000 ; This routine does a "spread-fire" ; sort of fire. It sends out five ; bullets. cmp hot, true je 6001 opo 18, 1 ; Turn overburn on mov bo, th add bo, 0 opo 15, bo mov bo, th add bo, -1 opo 15, bo mov bo, th add bo, 1 opo 15, bo mov bo, th add bo, -2 opo 15, bo mov bo, th add bo, 2 opo 15, bo opo 18, 0 ; Turn overburn off :6001 ret ; Return to caller #end This robot came partially from RandMan3. I have altered it very much, if you compare the two. Please send any comments to me at zorkian@geocities.com - I will read all of them and reply to most of them. :)