;The MicroComputer. Programmed by Jude Hungerford. Work began on 17/10/2000. ;Don't copy anything from this without giving me some credit. I have taken ;ideas, but no direct code, from Zitgun. ;Last modified on 18/10/2000. Version 0.09 ;modlist- starting from version 0.08, updated when I can be bothered. ;0.07 - 0.08: ;in the routines that lock onto targets and reduce the scanarc, move the ;turret 0.8-1.8 instead of 0.5-1.5. ;0.08 - 0.09: ;make sure it starts moving again after an overheat, ;and move turret 1-2 instead of .8-1.8. The comments will be out of date. !init #config scanner= 3 #config weapon= 3 #config armor= 2 #config engine= 3 #config heatsinks= 1 #config mines= 0 #config shield= 0 mov AX, 1 int 3 ;keepshift off. out 17, 64 ;wide scan out 18, 0 ;No overburn out 11, 100 ;Full throttle. out 22 ;lay mine nop nop nop nop nop nop out 22 ;lay mine jmp !flip ;turn radar !flip out 12, 121 ;turn radar 121 degrees. jmp !scan128 ;scan for enemies !arc128 out 17, 64 ;set radar arc to 128 degree scans (64 each way). jmp !scan128 ;and scan. !arc32 out 17, 16 ;set radar arc to 32 degree scans (16 each way). cmp @3, 0 ;is it left or right? jls !arc32l ;if left, jump to appropriate label. jgr !arc32r ;if right, jump to appropriate label. jmp !arc32e ;otherwise, end function. !arc32l cmp @3, -2 ;How far left? jgr !arc32l1 ;if 1, move radar 26 degrees left. out 12, -32 ;if 2, move radar 32+26=58 degrees left !arc32l1 out 12, -32 ;execute the 26 degree turn. out 12, @3 ;small modification to fix getting stuck. jmp !arc32e ;and end function. !arc32r cmp @3, 2 ;How far right? jls !arc32r1 ;if 1, move radar 26 degrees right. out 12, 32 ;if 2, move radar 32+26=58 degrees right !arc32r1 out 12, 32 ;execute the 26 degree turn. out 12, @3 ;small modification to fix getting stuck. jmp !arc32e ;and end function. !arc32e jmp !scan32 ;scan with new radar settings. !arc8 out 17, 4 ;set radar arc to 8 degree scans (4 each way). cmp @3, 0 ;is it left or right? jls !arc8l ;if left, jump to appropriate label. jgr !arc8r ;if right, jump to appropriate label. jmp !arc8e ;otherwise, end function. !arc8l cmp @3, -2 ;How far left? jgr !arc8l1 ;if 1, move radar 6 degrees left. out 12, -8 ;if 2, move radar 8+6=14 degrees left !arc8l1 out 12, -8 ;execute the 6 degree turn. out 12, @3 ;small modification to fix getting stuck. jmp !arc8e ;and end function. !arc8r cmp @3, 2 ;How far right? jls !arc8r1 ;if 1, move radar 6 degrees right. out 12, 8 ;if 2, move radar 8+6=14 degrees right !arc8r1 out 12, 8 ;execute the 6 degree turn out 12, @3 ;small modification to fix getting stuck. jmp !arc8e ;and end function. !arc8e jmp !scan8 ;and scan. !arc4 call !mshot ;take a shot at the object that triggered arc4. out 17, 2 ;set radar arc to 4 degree scans (2 each way). cmp @3, 0 ;is it left or right? jls !arc4l ;if left, jump to appropriate label. jgr !arc4r ;if right, jump to appropriate label. jmp !arc4e ;otherwise, end function. !arc4l cmp @3, -2 ;How far left? jgr !arc4l1 ;if 1, move radar 3 degrees left. out 12, -4 ;if 2, move radar 4+3=7 degrees left !arc4l1 out 12, -4 ;execute the 3 degree turn. jmp !arc4e ;and end function. !arc4r cmp @3, 2 ;How far right? jls !arc4r1 ;if 1, move radar 2 degrees right. out 12, 4 ;if 2, move radar 4+3=7 degrees right !arc4r1 out 12, 4 ;execute the 3 degree turn jmp !arc4e ;and end function. !arc4e jmp !scan4 ;and scan. !scan128 in 7, EX ;scan cmp EX, 1500 ;anyone there? jls !arc32 ;if yes, narrow the scan. call !steer ;else, check steering jmp !flip ;and continue scanning. !scan32 in 7, EX ;scan cmp EX, 1500 ;anyone there? jls !arc8 ;if yes, narrow the scan. out 17, 64 ;else, increase the arc and call !steer jmp !flip ;continue scanning. !scan8 in 7, EX ;scan cmp EX, 1500 ;anyone there? jls !arc4 ;if yes, narrow the scan. out 17, 32 ;else, increase the arc and call !steer jmp !scan32 ;continue scanning. !scan4 in 7, EX ;scan cmp EX, 1500 ;anyone there? jls !kill ;if yes, fire. out 17, 8 ;Otherwise, increase the scan arc, and call !steer jmp !scan8 ;continue scanning. !kill out 12, @3 ;turn turret to target in 2, FX ;check heat cmp FX, 280 ;too hot? jgr !scan4 ;if yes, keep the lock but don't fire. Otherwise: cmp @13, 0 ;check speed of target. je !overspit ;if stationary, fire overburn bullets. cmp EX, 500 ;is the enemy close? jls !overspit ;if yes, fire overburn bullets. cmp EX, 900 ;is enemy within decent range? jls !spit ;if yes, fire normal bullets. call !potshot ;if no, fire a single bullet. jmp !scan4 ;and continue scanning. !overspit mov AX, 1 int 4 ;Overburn on. out 15, 0 ;fire. out 15, 0 ;fire. mov AX, 0 int 4 ;overburn off. mov EX, @2 ;turret offset shr EX, 1 ;halve out 14, EX ;turn body halfway to face enemy. jmp !scan4 ;keep scanning. !spit out 15, 0 ;fire. out 15, 0 ;fire. mov EX, @2 ;turret offset shr EX, 1 ;halve out 14, EX ;turn body halfway to face enemy. out 11, 100 ;make sure we're moving. jmp !scan4 ;keep scanning. !potshot out 15, 0 ;fire. out 14, @2 ;turn body to face enemy. out 11, 100 ;make sure we're moving. ret ;keep scanning. !steer out 11, 100 ;make sure we're moving (takes no time) int 12 ;Check if we've hit something. cmp FX, 0 ;If yes, jnz !rcol ;respond. ret ;if not, return to scans. !rcol int 13 ;set collision count to 0. out 11, -75 ;move backwards nop nop nop nop nop nop nop nop nop nop ;wait a bit out 14, 108 ;turn 108 degrees (of 256) out 11, 100 ;start moving again. ret ;go back to scanning. !mshot out 15, @3 ;take a modified shot, out 14, @2 ;turn body, ret ;return.