;FEN 0.01, a variant of EHEU 0.78, also written by me. ;Version 0.01. ;Last modified 3/6/2001 !init #config scanner= 3 #config weapon= 3 #config armor= 4 #config engine= 0 #config heatsinks= 2 #def wpc #def ang #def rh ;relative heading #def ts ;target speed #def o ;pos/neg offset flag #def off ;firing offset out 11, 100 ;full throttle. out 22, 8 ;lay mine, trigger 8. out 17, 64 ;128 degree scan arc. mov DX, 64 mov AX, 1 int 3 ;keepshift on. out 22, 8 ;lay mine, trigger 8. jmp !steer !path cmp @9, 200 ;Have we travelled 200 metres? jgr !steer ;if yes, steer. int 12 ;collisions? cmp FX, 0 jgr !crash ;if yes, respond to crash. jmp !scan !crash int 13 ;reset collision count. !steer int 19 ;clear meters count. jmp !checkpos ;steer. !scan in 7, BX ;scan cmp BX, 1500 ;anyone in sight? jge !nonefound ;adjust scan arc to suit. jls !arcmodf ;modify arc & fire. !nonefound cmp DX, 64 ;Are we at maximum scan width already? je !flip ;if yes, flip turret. shl DX, 1 ;else, double DX and out 17, DX ;set new scans to DX width. jmp !path ;path !flip out 12, 125 ;turn turret 125 degrees. jmp !path ;path !arcmodf cmp DX, 2 ;is scan angle 1 degree? jle !fire ;if yes, fire. Else: shr DX, 1 ;halve DX out 17, DX ;set scans to DX. cmp @3, 0 ;is enemy in centre? jgr !accright ;if right, respond jls !accleft ;if left, respond. jmp !path ;else, path. !accright out 12, DX ;turn radar right by scanarc. cmp @3, 2 ;is it out by +2? jls !path ;if less, path. out 12, DX ;turn radar right by 200% scanarc. jmp !path ;path !accleft mov BX, DX ;set BX=scanarc neg BX ;and negate BX out 12, BX ;turn radar left by scanarc. cmp @3, -2 ;is it out by -2? jgr !path ;if more, path. out 12, BX ;turn radar left by 200% scanarc. jmp !path ;path !fire out 12, @3 ;correct turret. in 2, BX ;check heat. cmp BX, 200 ;too hot? jgr !lock ;if yes, lock. Else: out 15, 0 ;fire. jmp !lock !lock in 7, BX ;scan out 12, @3 ;adjust turret jmp !path ;and path. !checkpos mov wpc, 0 int 2 ;get x and y co-ordinates. cmp ex, 500 jls !wwall ;west side jge !ewall ;east side !wwall cmp fx, 500 jle !wwalln ;northwest jgr !wwalls ;southwest !wwalln cmp ex, fx ;closer to west or north wall? jle !wnq ;closer to west jgr !nwq ;closer to north !wwalls sub fx, 1000 neg fx ;distance rather than co-ord. cmp ex, fx ;closer to west or south wall? jle !wsq ;closer to west jgr !swq ;closer to south !ewall cmp fx, 500 jle !ewalln ;northeast jgr !ewalls ;southeast !ewalln sub ex, 1000 neg ex ;distance rather than co-ord. cmp ex, fx ;closer to east or north wall? jle !enq ;closer to east jgr !neq ;closer to north !ewalls cmp ex, fx ;closer to east or south wall? jge !esq ;closer to east jls !seq ;closer to south !wnq mov ang, 112 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !nwq mov ang, 80 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !wsq mov ang, 16 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !swq mov ang, 48 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !enq mov ang, 144 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !neq mov ang, 176 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !esq mov ang, 240 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan !seq mov ang, 208 ;desired heading sub ang, @1 ;difference out 14, ang ;turn to desired heading jmp !scan