NASAMS defends Ukraine (MSX) by Nick Shcherbyna
A downloadable game
' EXTREME-256 BASIC 10-liner for MSX (C) 2023 Nick Shcherbyna - Museum Of Computer Technology - Lviv, Ukraine ' One year of full-scale russian invasion to Ukraine have passed. Brave Ukrainian forces stopped their evil legions, but ' the terrorist state continues air attacks using various sorts of drones and missiles. Fortunately, Western allies gave ' some powerful air-defence systems, so with your professionalism and some luck peaceful Ukrainian cities will survive. ' NASAMS (Norwegian Advanced Surface to Air Missile System) is a distributed and networked medium to long range ' air-defence system. The missile has a range of up to 25 km. ' The system integrates US-built AN/TPQ-36A LASR (Low Altitude Surveillance RADAR) 3D radars and AIM-120 AMRAAM ' missiles with an indigenously developed BMC4I system called Fire Distribution Center. The FDC connected to a ' TPQ-36A radar forms an "Acquisition Radar and Control System" (ARCS). ' Player controls three NASAMS Multi-Missile Launchers by pressing [ 1 ]..[ 4 ], numbered according to location (left to ' right). Key corresponding to the AN/TPQ-36A does nothing. System is deployed in distinct configuration for each level. ' There are three levels, where russians launch different stuff: ' 1) EASY - HESA Shahed 136 drone (aka Geran-2); ' 2) MEDIUM - 3M54-1 Kalibr cruise missile; ' 3) HARD - 9M723 Iskander-M quasi-ballistic missile. ' Next level is opened after destroying 10 enemy objects. When a russian object is intercepted, score is increased. ' Otherwise score is decreased, and game is over when it drops below zero. ' You can try the game in different MSX emulators, e.g. https://webmsx.org/ ' For WebMSX, copy the BASIC code to clipboard, press [ Alt ]-[ V ] and [ Ctrl ]-[ V ], then press [ F5 ] to start. ' Or just open the URL from NASAMS.URL. Glory to Ukraine! '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 0DEFINTA-Z:SCREEN2,2,0:OPEN"GRP:"AS#1:G=0:L=0:Q=0:DIMM(3):DEFFNR(V,S,M)=V/SANDMOR(VANDM)*S:FORI=0TO3:A$="":B$="":FORJ=0TO15:READK,Z:A$=A$+STRING$(K+1,Z):B$=B$+STRING$(K+1,FNR(FNR(FNR(Z,2,85),4,51),16,15)):J=J+K:NEXT:SPRITE$(I)=A$+B$:NEXT:ONSPRITEGOSUB8 ' Variables: ' G - air raid siren frequency; ' L - level (1..3), 0 for title screen; ' Q - score; ' M() - number of missiles per launcher. ' Functions: ' FNR() - helper function for horizontal mirroring of sprite, see https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel ' All sprites are horizontally symmetrical: ' SPRITE$(0) - our SL-AMRAAM surface-to-air missile; ' SPRITE$(1) - HESA Shahed 136/Geran-2 drone; ' SPRITE$(2) - 3M54-1 Kalibr cruise missile; ' SPRITE$(3) - 9M723 Iskander-M quasi-ballistic missile. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 1N=0:S=0:T=1:U=3:Y=-32:Z=209:COLOR12,7,1:CLS:LINE(0,160)-(255,191),10,BF:FORP=0TO3:M(P)=6:GOSUB6:IFL=0THENREADA$:PRESET(128-4*LEN(A$),9*P+62):COLOR2+P:PRINT#1,A$:NEXTELSENEXT:COLOR4,10:PRESET(0,184):PRINT#1,"Score";Q;:PRESET(200,184):PRINT#1,"Level";L; ' Variables: ' N - number of intercepted enemy objects; ' S - rotation angle of AN/TPQ-36A LASR 3D radar (0 is 0|180, 7 is 180|360 deg.); ' T - rotation angle of AN/TPQ-36A radar (1 for 0..180, -1 for 180..360); ' U - green shade of radar surface (3 for angles 0..180, 12 for angles 180..360); ' X - x-coordinate of SL-AMRAAM (not initialized here); ' Y - y-coordinate of SL-AMRAAM; ' V - x-coordinate of enemy object (not initialized here); ' Z - y-coordinate of enemy object. ' - Draw ground; ' - in a loop on variable P (0..3): ' - Initialize the number of missiles per launcher; ' - Draw NASAMS Multi-Missile Launcher or AN/TPQ-36A radar by subroutine 6; ' - Put text (title, "YOU WIN" or "GAME OVER", depending on current DATA pointer); ' - Draw current score and level. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 2IFL=0ANDK$=" "ORN>9THENPUTSPRITE0,(0,208):IFL=3THENREADA$,A$,A$:GOTO7ELSEL=L+1:GOTO1ELSEK$=INKEY$:R=80*L:IFM(L)>0THENLINE(R+S+1,160)-(R+14-S,174),U,BF:LINE(R,160)-(R+S,174),10,BF:LINE(R+15-S,160)-(R+15,174),10,BF:S=S+T:IFS=0ORS=7THENT=-T:IFSTHENU=15-U ' - Conditionally switch to the next level; ' - If level 3 completed, skip "GAME OVER" message and go to 7; ' - Poll keyboard; ' - If AN/TPQ-36A radar is alive, rotate it. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 3PUTSPRITE0,(X,Y),15,0:X=X-4*(Z>0)*SGN(V-X):IFY>-32ANDY<ZANDY<96THENY=-32ELSEIFY>-32THENY=Y-4ELSEP=VAL(K$)-1:IFP>=0ANDP<4THENIFP<>LANDM(P)>0THENM(P)=M(P)-1:GOSUB9:X=80*P:Y=144:RESTORE8:FORI=0TO4:READA,B:SOUNDA,B:NEXT:'DedicatedToMyFriendVegardSkjefstad ' - Put the SL-AMRAAM missile; ' - Adjust its x position to lock on target; ' - Adjust its y position if launched, launch if the corresponding key pressed (redraw the launcher with one more empty slot, play sound effect). '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 4SOUND4,192+G:G=(G+2)AND63:SOUND10,7-G/16:SOUND7,179ORL=0AND12:PUTSPRITE1,(V,Z),6,L:IFZ<160THENZ=Z+2*LELSEW=V-(Z=209):GOSUB8:PUTSPRITE1,(V,Z):IFQ<0THEN7ELSEV=16*INT(15*RND(1)):Z=-32:SPRITEON:IFWMOD80=0THENM(W/80)=0:IFM(0)+M(1)+M(2)+M(3)=0THENQ=-1:GOTO7 ' - Play air raid siren sound; ' - Put an enemy object; ' - Adjust its y position or explode if ground is reached (decrement score, game is over if negative, initialize new object position, delete all missiles in M() if launcher is hit). '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 5IFK$<>CHR$(27)THEN2ELSESOUND7,191:END:DATA5,1,,3,,7,5,1,,3,,7,,7,,128,1,255,,127,,63,,31,,15,,7,5,3,,1,,15,,7,4,3,1,63,5,3,,1,,31,,15,5,7,5,3,1,1,*NASAMS* defends Ukraine,(C) 2023 Nick Shcherbyna,"Keys: [1]-[4] Fire, [Esc] Quit",Press [SPACE] to start ' - End game if [Esc] was pressed. ' DATA: ' - Sprites (SL-AMRAAM, Shahed 136, Kalibr, Iskander-M); ' - Title text. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 6IFP=3THEN9ELSE:I=80*P+24:A=8+8*((P+L)MOD2):FORJ=ITOI+40STEPA:K=170-(J*L+J+P*L)MOD9:C=9+6*(KMOD2):LINE(J+KMOD2,183)-(J+A-2,K+1),C-1,BF:LINE(J+KMOD2,K)-(J+A-2,K-(7*P+L)MOD5),C,BF:FORB=182TOK+1STEP-4:FORC=J+2TOJ+A-3STEP2:PSET(C,B),10:NEXT:NEXT:NEXT:GOTO9 ' Subroutine: ' - Draw buildings between the current (P) and next NASAMS component. Color, width, height, and depth are picked by hashing formulas. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 7SOUND7,190:L=0:Z=-32:IFQ<0THENA$="V15T100L8GEL4AL2EO4":PLAY"O3"+A$:PLAYA$:Q=0:GOTO1ELSEA$="V15T160O4L4GGBL8GL4ABAGF#DG.L8AL4BAL2G":A$=A$+A$:PLAYA$:A$="L4BO5DFL8ET120FGFEDCDEDCO4BAT160L4GBO5D.L8C#T120DEDCO4BAGBL4O5DCL8O4BAL4L2G":PLAYA$:PLAYA$:Q=0:GOTO1 ' - Plays either the defeat melody (fragment of ruzzian "Dubinushka") ' or the victory melody (fragment of Ukrainian "Oi u luzi chervona kalyna"). ' Note: I am not a musician at all, so sorry for inexactness. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 8IFZ=209THENRETURNELSESPRITEOFF:RESTORE8:FORI=0TO4:READA,B:SOUNDA,B:NEXT:FORI=0TO7:CIRCLE(V+7,Z+7),I,9:NEXT:F=Z<160:N=N-F:FORI=7TO0STEP-1:CIRCLE(V+7,Z+7),I,10+3*F:NEXT:Q=Q-(F+1+F)*L:Y=-32:Z=209:LINE(103,191)-(40,184),10,BF:PRINT#1,Q;:RETURN:DATA7,183,8 ' Subroutine: ' - Do nothing if enemy object is idle, otherwise draw the explosion effect (expanding and collapsing circles); ' - Ajust score (decrease if ground is reached, increase otherwise, as it was intercepted by our SL-AMRAAM). ' DATA: ' - Explosion effect register/value for SOUND. '___5___10___15___20___25___30___35___40___45___50___55___60___65___70___75___80___85___90___95__100__105__110__115__120__125__130__135__140__145__150__155__160__165__170__175__180__185__190__195__200__205__210__215__220__225__230__235__240__245__250__255 9A=80*P+1:LINE(A-1,176)-(A+14,183),2,BF:IFL=PTHENRETURNELSEFORI=0TO2:LINE(A,160)-(A+3,170),3,BF:B=166:FORJ=0TO1:LINE(A,B)-(A+3,B+3),12,B:LINE(A+1,B+1)-(A+2,B+2),10-2*(M(P)>3*J+I),B:B=B+5:NEXT:A=A+5:NEXT:RETURN:DATA16,6,2,12,32,13,0,GAME,,OVER,,YOU,,WIN ' Subroutine: ' - Draw the NASAMS component base, for AN/TPQ-36A radar that is all; ' - Draw six launch rails, filled or empty based on counter in M(). ' DATA: ' - Explosion effect register/value for SOUND; ' - "GAME OVER" and "YOU WIN" messages.
Status | Released |
Author | BASIC 10Liner |
Genre | Action |
Tags | 8-Bit, basic, basic10liner, MSX |
Download
Install instructions
You can try the game in different MSX emulators, e.g. https://webmsx.org/
For WebMSX, copy the BASIC code to clipboard, press [ Alt ]-[ V ] and [ Ctrl ]-[ V ], then press [ F5 ] to start.
Or just open the URL from NASAMS.URL. Glory to Ukraine!
Leave a comment
Log in with itch.io to leave a comment.