home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-23 | 1.4 KB | 59 lines | [TEXT/?bDv] |
- !
- ! Corner
- !
- ! This bot is just like Finder, except that it first moves into
- ! the upper-left (0,0) corner of the arena. This way, it only
- ! needs to scan a 90 degree arc to cover the whole arena.
- !
-
- #DATA
-
- EQU INCR 7
- EQU START_SCAN 0
- DEF S
- DEF X_VEL
- DEF Y_VEL
-
- #CODE ASM
-
- :XMOVE_TO_CORNER
- NEG X0, X_VEL ! Velocity equals negative position
- VEL X_VEL, 0
- CMP X0, 10 ! While X-position > 10, keep
- BGT XMOVE_TO_CORNER ! moving,
- VEL 0, 0 ! (otherwise) stop
- :YMOVE_TO_CORNER
- NEG Y0, Y_VEL ! Velocity equals negative position
- VEL 0, Y_VEL
- CMP Y0, 10 ! While Y-position > 10, keep
- BGT YMOVE_TO_CORNER ! moving,
- VEL 0, 0 ! (otherwise) stop
-
- MOV START_SCAN, S ! Initialize scan angle
-
- :TRACK_ENEMY
- SUB 20, S ! When the scanlock is lost, come
- ! back here to look for him
- :SCANLOOP
- ADD INCR, S
- CMP S, 93 ! Avoid scanning the arena wall:
- BLE CONTINUE ! if angle > 93, Reset to (roughly)
- SUB 96, S ! 0.
-
- :CONTINUE ! The following is the Finder code:
- SCN S
- CMP S0, 0
- BEQ SCANLOOP
-
- :SCANLOCK
- MOV S1, R1
- FIR 1
- NOP ! Used to synchronize the fire loop
- NOP ! with the weapon cycle time (=10)
- SCN S
- CMP S0, 0
- BEQ TRACK_ENEMY
- JMP SCANLOCK
-
- #END
-