;Nero, programmed by Jude Hungerford. Work started on 21/12/2000. ;Version 0.02 ;Last modified 21/12/2000 ;Thought it was time I started on a new robot. My previous 'bot, EHEU, has ;become a 20k slow sniper, and that isn't really what I wanted. The plan is ;that this 'bot will be very fast-moving, have a large emphasis on not ;getting hit, and target prediction will kind of fade into the background. ;I'm also hoping to keep the size of this one down. I think that for this ;one I'll abandon my policy of only using registers, never variables. ;I will incorporate code from EHEU, however I will tidy it up and try to make ;it all faster. ;Credits: This robot owes its basic idea to TOBI-1 and SHADOW, and thus to ;all robots that those two draw ideas from as well. It probably also owes ;ideas to others, but I won't try to list all the 'bots that have taught me ;something. Basically, thanks to everyone else out there who writes 'bots and ;doesn't lock them. ;If you get ideas from this 'bot, please don't lock yours, and it would be ;nice if you gave me credit for anything you take from me- code, ideas, ;whatever. ;Modlist: ;Blank file - 0.00: ;Wrote the introduction. ;0.00 - 0.01: ;Wrote movement function. May need work, but I think the idea is sound. ;Okay, the movement function works okay. I might play around with it a bit ;later (it would be kind of good to be able to change the point it moves ;around) but it'll do for the moment. ;0.01 - 0.02: ;Writing the radar and firing routines... ;They're too slow. ;For now, I'm just going to put my new configuration and driving routines ;into EHEU and continue from there. Nero is being dropped, at least for the ;moment. !init #config scanner= 2 #config weapon= 2 #config armor= 2 #config engine= 5 #config heatsinks= 1 #config mines= 0 #config shield= 0 out 22, 8 ;lay mine, trigger radius 8. mov ax, 1 ;true int 3 ;keepshift = true. int 4 ;overburn = true. #def arc ;scan arc variable. #def wpc ;wall proximity count. #def ang ;generic angle variable. #def dst ;generic distance variable. mov arc, 64 ;128 degree scan arc. out 17, arc ;set scan arc. out 11, 100 ;full throttle. put 0, 385 ;target prediction put 0, 386 put 1, 387 put 1, 388 put 1, 389 put 2, 390 put 2, 391 put 2, 392 put 2, 393 put 3, 394 put 3, 395 put 3, 396 put 3, 397 put 3, 398 put 4, 399 put 4, 400 out 22, 8 ;lay mine, trigger radius 8. !path out 11, 100 ;full throttle. 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, dst ;scan cmp dst, 1500 ;anyone in sight? jge !nonefound ;adjust scan arc to suit. jls !arcmodf ;modify arc & fire. !nonefound cmp arc, 64 ;Are we at maximum scan width already? je !flip ;if yes, flip turret. shl arc, 1 ;else, double arc and out 17, arc ;set new scans to arc width. jmp !path ;path !flip out 12, 127 ;turn turret 127 degrees. jmp !path ;path !arcmodf cmp arc, 2 ;is scan angle 1 degree? je !fire ;if yes, fire. Else: shr arc, 1 ;halve DX out 17, arc ;set scans to DX. cmp @3, 0 ;is enemy in centre? jgr !accright ;if right, respond jls !accleft ;if left, respond. jmp !cfire ;else, cfire. !accright out 12, arc ;turn radar right by scanarc. cmp @3, 2 ;is it out by +2? jls !cfire ;if less, cfire. Else: out 12, BX ;turn radar right by scanarc again. jmp !cfire ;cfire. !accleft mov BX, arc ;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 !cfire ;if no, cfire. Else: out 12, BX ;turn radar left by scanarc again. jmp !cfire ;cfire. !cfire cmp arc, 4 ;was arc 8 or less? jle !fire ;if yes, fire. jmp !path ;else path. !fire out 12, @3 ;correct turret. in 2, BX ;check heat. cmp BX, 100 ;too hot? jgr !scan ;if yes, scan. Else: cmp @7, 0 ;Is target stationary? je !statfire ;if yes, fire at stationary target. Else: jgr !pmovfire ;if moving forward, fire forwards of target. jls !nmovfire ;if moving backward, fire backward of target. jmp !path !statfire out 15, 0 out 15, 0 out 15, 0 jmp !path !pmovfire mov bx, @6 ;BX=heading of enemy. shr bx, 3 ;bx/=8 cmp bx, 16 ;greater than 128 degrees? (negative shot?) jgr !pmovfiren ;yes, jump to section. add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. jmp !fireadj ;fire adjusted shots. !pmovfiren add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. neg cx jmp !fireadj ;fire adjusted shots. !nmovfire mov bx, @6 ;BX=heading of enemy. shr bx, 3 ;bx/=8 cmp bx, 16 ;greater than 128 degrees? (negative shot?) jgr !nmovfiren ;yes, jump to section. add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. neg cx jmp !fireadj ;fire adjusted shots. !nmovfiren add bx, 385 ;bx+=385 (for memory addressing) get cx, bx ;cx = contents of memory location bx. jmp !fireadj ;fire adjusted shots. !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 !fireadj ;adjusted firing routine. out 15, 0 ;fire w/ new angle. out 12, cx ;move turret. out 15, 0 ;fire w/ new angle. out 12, cx ;move turret. out 15, 0 ;fire w/ new angle. jmp !scan