; ==================== RATM ========================== ; ; written by Bohnensuppe ; test-version ; -------- JMP-insctruction to startup routine ------; jmp !startup ; ============================================== ; ; TARGET PREDICTION ; ; ============================================== ; *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *257, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 257 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *255, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 255 *256, 256, 256, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 257 *257, 257, 257, 256 *256, 256, 256, 256 *256, 256, 256, 256 *256, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 255 *255, 255, 255, 256 *256, 256, 256, 256 *256, 256, 256, 257 *257, 257, 257, 257 *257, 257, 257, 257 *258, 258, 258, 258 *258, 258, 258, 258 *257, 257, 257, 257 *257, 257, 257, 257 *257, 256, 256, 256 *256, 256, 256, 255 *255, 255, 255, 255 *255, 255, 255, 255 *254, 254, 254, 254 *254, 254, 254, 254 *255, 255, 255, 255 *255, 255, 255, 255 *255, 256, 256, 256 *256, 256, 257, 257 *257, 257, 257, 257 *258, 258, 258, 258 *258, 258, 258, 258 *258, 258, 258, 258 *258, 258, 258, 258 *257, 257, 257, 257 *257, 257, 256, 256 *256, 256, 255, 255 *255, 255, 255, 255 *254, 254, 254, 254 *254, 254, 254, 254 *254, 254, 254, 254 *254, 254, 254, 254 *255, 255, 255, 255 *255, 255, 256, 256 *256, 256, 257, 257 *257, 257, 258, 258 *258, 258, 258, 258 *258, 258, 259, 259 *259, 259, 258, 258 *258, 258, 258, 258 *258, 258, 257, 257 *257, 257, 256, 256 *256, 256, 255, 255 *255, 255, 254, 254 *254, 254, 254, 254 *254, 254, 253, 253 *253, 253, 254, 254 *254, 254, 254, 254 *254, 254, 255, 255 *255, 255, 256, 256 *256, 256, 257, 257 *257, 258, 258, 258 *258, 258, 259, 259 *259, 259, 259, 259 *259, 259, 259, 259 *259, 259, 258, 258 *258, 258, 258, 257 *257, 257, 256, 256 *256, 256, 255, 255 *255, 254, 254, 254 *254, 254, 253, 253 *253, 253, 253, 253 *253, 253, 253, 253 *253, 253, 254, 254 *254, 254, 254, 255 *255, 255, 256, 256 *256, 257, 257, 257 *257, 258, 258, 258 *259, 259, 259, 259 *259, 259, 259, 259 *259, 259, 259, 259 *259, 259, 259, 259 *258, 258, 258, 257 *257, 257, 257, 256 *256, 255, 255, 255 *255, 254, 254, 254 *253, 253, 253, 253 *253, 253, 253, 253 *253, 253, 253, 253 *253, 253, 253, 253 *254, 254, 254, 255 *255, 255, 255, 256 *256, 257, 257, 257 *258, 258, 258, 259 *259, 259, 259, 260 *260, 260, 260, 260 *260, 260, 260, 260 *260, 259, 259, 259 *259, 258, 258, 258 *257, 257, 257, 256 *256, 255, 255, 255 *254, 254, 254, 253 *253, 253, 253, 252 *252, 252, 252, 252 *252, 252, 252, 252 *252, 253, 253, 253 *253, 254, 254, 254 *255, 255, 255, 256 *256, 257, 257, 257 *258, 258, 259, 259 *259, 260, 260, 260 *260, 260, 260, 260 *260, 260, 260, 260 *260, 260, 260, 259 *259, 259, 258, 258 *257, 257, 257, 256 *256, 255, 255, 255 *254, 254, 253, 253 *253, 252, 252, 252 *252, 252, 252, 252 *252, 252, 252, 252 *252, 252, 252, 253 *253, 253, 254, 254 *255, 255, 255, 256 *256, 257, 257, 258 *258, 259, 259, 259 *260, 260, 260, 260 *261, 261, 261, 261 *261, 261, 261, 261 *260, 260, 260, 260 *259, 259, 259, 258 *258, 257, 257, 256 *256, 255, 255, 254 *254, 253, 253, 253 *252, 252, 252, 252 *251, 251, 251, 251 *251, 251, 251, 251 *252, 252, 252, 252 *253, 253, 253, 254 *254, 255, 255, 256 *256, 257, 257, 258 *258, 259, 259, 260 *260, 260, 261, 261 *261, 261, 261, 261 *261, 261, 261, 261 *261, 261, 260, 260 *260, 259, 259, 258 *258, 257, 257, 256 *256, 255, 255, 254 *254, 253, 253, 252 *252, 252, 251, 251 *251, 251, 251, 251 *251, 251, 251, 251 *251, 251, 252, 252 *252, 253, 253, 254 *254, 255, 255, 256 *256, 257, 257, 258 *258, 259, 259, 260 *260, 261, 261, 261 *261, 262, 262, 262 *262, 262, 262, 261 *261, 261, 261, 260 *260, 259, 259, 258 *258, 257, 257, 256 *256, 255, 255, 254 *254, 253, 253, 252 *252, 251, 251, 251 *251, 250, 250, 250 *250, 250, 250, 251 *251, 251, 251, 252 *252, 253, 253, 254 *254, 255, 255, 256 *256, 257, 258, 258 *259, 259, 260, 260 *261, 261, 261, 262 *262, 262, 262, 262 *262, 262, 262, 262 *262, 261, 261, 261 *260, 260, 259, 259 *258, 258, 257, 256 *256, 255, 254, 254 *253, 253, 252, 252 *251, 251, 251, 250 *250, 250, 250, 250 *250, 250, 250, 250 *250, 251, 251, 251 *252, 252, 253, 253 *254, 254, 255, 256 *256, 257, 258, 258 *259, 259, 260, 261 *261, 261, 262, 262 *262, 263, 263, 263 *263, 263, 263, 262 *262, 262, 261, 261 *261, 260, 259, 259 *258, 258, 257, 256 *256, 255, 254, 254 *253, 253, 252, 251 *251, 251, 250, 250 *250, 249, 249, 249 *249, 249, 249, 250 *250, 250, 251, 251 *251, 252, 253, 253 *254, 254, 255, 256 *256, 257, 258, 258 *259, 260, 260, 261 *261, 262, 262, 263 *263, 263, 263, 263 *263, 263, 263, 263 *263, 262, 262, 261 *261, 260, 260, 259 *258, 258, 257, 256 *256, 255, 254, 254 *253, 252, 252, 251 *251, 250, 250, 249 *249, 249, 249, 249 *249, 249, 249, 249 *249, 250, 250, 251 *251, 252, 252, 253 *254, 254, 255, 256 *256, 257, 258, 259 *259, 260, 261, 261 *262, 262, 263, 263 *263, 263, 264, 264 *264, 264, 263, 263 *263, 263, 262, 262 *261, 261, 260, 259 *259, 258, 257, 256 *256, 255, 254, 253 *253, 252, 251, 251 *250, 250, 249, 249 *249, 249, 248, 248 *248, 248, 249, 249 *249, 249, 250, 250 *251, 251, 252, 253 *253, 254, 255, 256 *256, 257, 258, 259 *259, 260, 261, 261 *262, 263, 263, 263 *264, 264, 264, 264 *264, 264, 264, 264 *263, 263, 263, 262 *261, 261, 260, 259 *259, 258, 257, 256 *256, 255, 254, 253 *253, 252, 251, 251 *250, 249, 249, 249 *248, 248, 248, 248 *248, 248, 248, 248 *249, 249, 249, 250 *251, 251, 252, 253 *253, 254, 255, 256 *256, 257, 258, 259 *260, 260, 261, 262 *262, 263, 263, 264 *264, 264, 265, 265 *265, 265, 264, 264 *264, 263, 263, 262 *262, 261, 260, 260 *259, 258, 257, 256 *256, 255, 254, 253 *252, 252, 251, 250 *250, 249, 249, 248 *248, 248, 247, 247 *247, 247, 248, 248 *248, 249, 249, 250 *250, 251, 252, 252 *253, 254, 255, 256 *256, 257, 258, 259 *260, 261, 261, 262 *263, 263, 264, 264 *265, 265, 265, 265 *265, 265, 265, 265 *264, 264, 263, 263 *262, 261, 261, 260 *259, 258, 257, 256 *256, 255, 254, 253 *252, 251, 251, 250 *249, 249, 248, 248 *247, 247, 247, 247 *247, 247, 247, 247 *248, 248, 249, 249 *250, 251, 251, 252 *253, 254, 255, 256 *256, 257, 258, 259 *260, 261, 262, 262 *263, 264, 264, 265 *265, 265, 266, 266 *266, 266, 265, 265 *265, 264, 264, 263 *262, 262, 261, 260 *259, 258, 257, 256 *256, 255, 254, 253 *252, 251, 250, 250 *249, 248, 248, 247 *247, 247, 246, 246 *246, 246, 247, 247 *247, 248, 248, 249 *250, 250, 251, 252 *253, 254, 255, 256 *256, 257, 258, 259 *260, 261, 262, 263 *263, 264, 265, 265 *266, 266, 266, 266 *266, 266, 266, 266 *265, 265, 264, 263 *263, 262, 261, 260 *259, 258, 257, 256 *256, 255, 254, 253 *252, 251, 250, 249 *249, 248, 247, 247 *246, 246, 246, 246 *246, 246, 246, 246 *247, 247, 248, 249 *249, 250, 251, 252 *253, 254, 255, 256 *257, 258, 259, 260 *260, 261, 262, 263 *264, 264, 265, 266 *266, 266, 266, 267 *267, 266, 266, 266 *266, 265, 264, 264 *263, 262, 261, 260 *260, 259, 258, 257 *255, 254, 253, 252 *252, 251, 250, 249 *248, 248, 247, 246 *246, 246, 246, 245 *245, 246, 246, 246 *246, 247, 248, 248 *249, 250, 251, 252 *252, 253, 254, 255 *257, 258, 259, 260 *261, 262, 263, 263 *264, 265, 265, 266 *266, 267, 267, 267 *267, 267, 267, 266 *266, 265, 265, 264 *263, 263, 262, 261 *260, 259, 258, 257 *255, 254, 253, 252 *251, 250, 249, 249 *248, 247, 247, 246 *246, 245, 245, 245 *245, 245, 245, 246 *246, 247, 247, 248 *249, 249, 250, 251 *252, 253, 254, 255 *257, 258, 259, 260 *261, 262, 263, 264 *265, 265, 266, 266 *267, 267, 267, 268 *268, 267, 267, 267 *266, 266, 265, 265 *264, 263, 262, 261 *260, 259, 258, 257 *255, 254, 253, 252 *251, 250, 249, 248 *247, 247, 246, 246 *245, 245, 245, 244 *244, 245, 245, 245 *246, 246, 247, 247 *248, 249, 250, 251 *252, 253, 254, 255 *257, 258, 259, 260 *261, 262, 263, 264 *265, 266, 266, 267 *267, 268, 268, 268 *268, 268, 268, 267 *267, 266, 266, 265 *264, 263, 262, 261 *260, 259, 258, 257 *255, 254, 253, 252 *251, 250, 249, 248 *247, 246, 246, 245 *245, 244, 244, 244 *244, 244, 244, 245 *245, 246, 246, 247 *248, 249, 250, 251 *252, 253, 254, 255 *257, 258, 259, 260 *261, 262, 263, 264 *265, 266, 267, 267 *268, 268, 268, 269 *269, 268, 268, 268 *267, 267, 266, 265 *264, 263, 262, 261 *260, 259, 258, 257 *255, 254, 253, 252 *251, 250, 249, 248 *247, 246, 245, 245 *244, 244, 244, 243 *243, 244, 244, 244 *245, 245, 246, 247 *248, 249, 250, 251 *252, 253, 254, 255 *257, 258, 259, 260 *261, 263, 264, 265 *266, 266, 267, 268 *268, 269, 269, 269 *269, 269, 269, 268 *268, 267, 266, 266 *265, 264, 263, 261 *260, 259, 258, 257 *255, 254, 253, 252 *251, 249, 248, 247 *246, 246, 245, 244 *244, 243, 243, 243 *243, 243, 243, 244 *244, 245, 246, 246 *247, 248, 249, 251 *252, 253, 254, 255 *257, 258, 259, 260 *262, 263, 264, 265 *266, 267, 268, 268 *269, 269, 269, 270 *270, 269, 269, 269 *268, 268, 267, 266 *265, 264, 263, 262 *260, 259, 258, 257 *255, 254, 253, 252 *250, 249, 248, 247 *246, 245, 244, 244 *243, 243, 243, 242 *242, 243, 243, 243 *244, 244, 245, 246 *247, 248, 249, 250 *252, 253, 254, 255 *257, 258, 259, 261 *262, 263, 264, 265 *266, 267, 268, 269 *269, 270, 270, 270 *270, 270, 270, 269 *269, 268, 267, 266 *265, 264, 263, 262 *261, 259, 258, 257 *255, 254, 253, 251 *250, 249, 248, 247 *246, 245, 244, 243 *243, 242, 242, 242 *242, 242, 242, 243 *243, 244, 245, 246 *247, 248, 249, 250 *251, 253, 254, 255 *257, 258, 259, 261 *262, 263, 265, 266 *267, 268, 268, 269 *270, 270, 270, 270 *270, 270, 270, 270 *269, 268, 268, 267 *266, 265, 263, 262 *261, 259, 258, 257 *255, 254, 253, 251 *250, 249, 247, 246 *245, 244, 244, 243 *242, 242, 242, 242 *242, 242, 242, 242 *243, 244, 244, 245 *246, 247, 249, 250 *251, 253, 254, 255 *257, 258, 260, 261 *262, 264, 265, 266 *267, 268, 269, 270 *270, 271, 271, 271 *271, 271, 271, 270 *270, 269, 268, 267 *266, 265, 264, 262 *261, 260, 258, 257 *255, 254, 252, 251 *250, 248, 247, 246 *245, 244, 243, 242 *242, 241, 241, 241 *241, 241, 241, 242 *242, 243, 244, 245 *246, 247, 248, 250 *251, 252, 254, 255 *257, 258, 260, 261 *262, 264, 265, 266 *267, 268, 269, 270 *271, 271, 271, 271 *271, 271, 271, 271 *270, 269, 268, 267 *266, 265, 264, 262 *261, 260, 258, 257 *255, 254, 252, 251 *250, 248, 247, 246 *245, 244, 243, 242 *241, 241, 241, 241 *241, 241, 241, 241 *242, 243, 244, 245 *246, 247, 248, 250 *251, 252, 254, 255 ; ============================================== ; ; TURRET CORRECTION ; ; ============================================== ; *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *2, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 1 *1, 1, 1, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-2, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, -1 *-1, -1, -1, 0 *0, 0, 0, 0 *0, 0, 0, 0 *0, 0, 0, 0 ; ============================================== ; ; CONFIGURATION ; ; ============================================== ; #config weapon=4 #config heatsinks=2 #config scanner=3 #config engine=1 #config armor=2 ; ============================================== ; ; DEFINED VARIABLES ; ; ============================================== ; #def Scanarc #def Range #def heat #def trspd #def trdeg #def trpred_tbl #def trpred_idx #def tucorr_tbl #def tucorr_idx #def tdsp #def fRndMove #def cTurnRate #def fArc4 #def fSpd ; ============================================== ; ; INITIALIZATION ; ; ============================================== ; !Startup or ax, 1 ; int i_overburn int i_keepshift mov trpred_tbl, 1028 mov tucorr_tbl, 3140 mov cTurnRate, 30 mov Scanarc, 64 mov fArc4, 300 mov fSpd, 500 opo p_arc, scanarc ; ============================================== ; ; DRIVING - CONTROL ; ; ============================================== ; !Drive ; ---------------------------------------------- ; ; RANDOM MOVEMENT ; ; ---------------------------------------------- ; !RndMove ipo p_rand, dx and dx, 128 sub dx, 64 opo p_steering, dx ; ---------------------------------------------- ; ; WALL CHECK ; ; ---------------------------------------------- ; !Wallcheck int i_locate mov fRndMove, 0ffh !lWall cmp ex, 200 ja !rWall and fRndMove, 0 !lcDir cmp @1, 128 jb !upWall opo p_steering, cTurnRate jae !lcDir !rWall cmp ex, 800 jb !upWall and fRndMove, 0 !rcDir cmp @1, 128 ja !upWall opo p_steering, cTurnRate jbe !rcDir !upWall cmp fx, 200 ja !dnWall and fRndMove, 0 !upcDir cmp @1, 64 jb !upcTmp cmp @1, 192 jb !spdcheck !upcTmp opo p_steering, cTurnRate jeq !upcDir jne !upcDir !dnWall cmp fx, 800 jb !spdcheck and fRndMove, 0 !dncDir cmp @1, 64 jb !spdcheck cmp @1, 192 ja !spdcheck opo p_steering, cTurnRate jeq !dncDir jne !dncDir ; ---------------------------------------------- ; ; SPEED CHECK ; ; ---------------------------------------------- ; !Spdcheck cmp [0], 100 jeq !Scan opo p_steering, 64 opo p_throttle, 100 ; ============================================== ; ; SCANNING - CONTROL ; ; ============================================== ; !Scan ipo p_scan, range cmp range, maxint jne !found cmp scanarc, 64 jeq !flip shl scanarc, 2 opo p_arc, scanarc jne !drive !flip opo p_trotate, 128 jeq !Drive !found cmp range, 200 ja !nof16 cmp scanarc, 16 jeq !fire16 !nof16 cmp scanarc, 4 jeq !fire4 opo p_steering, cTurnRate cmp @3, -1 jls !nacc2 jeq !nacc1 cmp @3, 1 jgr !pacc2 jeq !pacc1 shr scanarc, 2 opo p_arc, scanarc jne !scan !nacc2 mov dx, scanarc neg dx opo p_trotate, dx shr scanarc, 2 opo p_arc, scanarc jls !scan !nacc1 mov dx, scanarc shr dx, 1 neg dx opo p_trotate, dx shr scanarc, 2 opo p_arc, scanarc jeq !scan !pacc1 shr scanarc, 1 opo p_trotate, scanarc shr scanarc, 1 opo p_arc, scanarc jeq !scan !pacc2 opo p_trotate, scanarc shr scanarc, 2 opo p_arc, scanarc jgr !scan ; ============================================== ; ; FIRE - CONTROL ; ; ============================================== ; !fire4 ipo p_heat, heat cmp heat, 130 ja !drive ipo p_scan, range cmp range, 1500 ja !scan mov trspd, @13 mov trdeg, @6 cmp @13, 0 ja !pSpd neg trspd add trdeg, 128 and trdeg, 255 !pSpd shr trspd, 5 shr trdeg, 2 shl trspd, 6 mov trpred_idx, trpred_tbl add trpred_idx, trspd add trpred_idx, trdeg mov tucorr_idx, tucorr_tbl add tucorr_idx, @2 mov tdsp, [trpred_idx] add tdsp, [tucorr_idx] opo p_trotate, tdsp mov ax, @3 add ax, ax opo p_fire, ax opo p_fire, ax opo p_steering, cTurnRate jeq !fire4 jne !fire4 !fire16 ipo p_heat, heat cmp heat, 350 ja !drive ipo p_scan, range cmp range, 200 ja !scan mov trspd, @13 mov trdeg, @6 cmp @13, 0 ja !pSpd16 neg trspd add trdeg, 128 and trdeg, 255 !pSpd16 shr trspd, 5 shr trdeg, 2 shl trspd, 6 mov trpred_idx, trpred_tbl add trpred_idx, trspd add trpred_idx, trdeg mov tucorr_idx, tucorr_tbl add tucorr_idx, @2 mov tdsp, @3 sal tdsp, 3 add tdsp, [trpred_idx] add tdsp, [tucorr_idx] opo p_trotate, tdsp opo p_fire, @3 jeq !fire16 jne !fire16