Mixed Game Bag III is a collection of three arcade-style games — Blitz, Freeway Crossing, and Rats/Snake — packed into a single program listing with each game stored as a separate SAVE block. Each game uses machine code routines called via USR to handle the core gameplay logic, with BASIC handling display, scoring, and input. The Blitz game generates randomized city skylines using block graphic characters and string slicing, while Freeway Crossing uses SCROLL for vertical screen movement and tracks a high score across sessions using a variable. The Snake/Rats game boots directly into machine code via RAND USR, with BASIC only managing the play-again loop.
Program Analysis
Program Structure
The listing contains three independent games, each with its own line 1 REM block containing embedded machine code or data, its own SAVE statement, and its own entry point. The three games are:
- Blitz — a city-bombing game (lines 50–2020)
- Freeway Crossing — a road-crossing game (lines 1–1100, second program block)
- Rats / Snake — a snake-style game (lines 3–520, third block; lines 9–30, fourth block)
Each game’s line 1 REM statement serves as a machine code store, a well-known technique for embedding binary routines in BASIC programs without using separate memory areas.
Machine Code Usage
All three games rely heavily on USR calls into machine code stored in the REM lines:
- Blitz calls
USR VAL "17105"at line 300 to run the main game loop, andUSR VAL "16514"is polled indirectly viaPEEKin Freeway Crossing. - Freeway Crossing uses
USR 16514at line 38 to detect collisions, branching to line 500 on a nonzero return. - The Rats/Snake game at line 10 calls
RAND USR 16562, handing almost all control to machine code; BASIC only manages the play-again prompt. - The
POKE VAL "16753",Uin Blitz (line 80) andPOKE VAL "17209",Uin Rats (line 82) write a user-supplied speed value directly into the machine code routine, providing a difficulty control.
Using VAL "number" inside POKE and USR is a memory-saving idiom: storing the number as a string in a VAL expression avoids the five-byte floating-point constant that would otherwise be embedded in the BASIC line.
Blitz — Key Techniques
The city skyline in Blitz is generated procedurally at lines 100–160. The outer FOR U loop iterates across columns; for each column a random height Z is computed, and an inner FOR Y loop prints block graphic characters to build the building. Line 125–126 construct the bomb/explosion sprite string A$ by slicing a master string of block graphic characters using SGN PI + RND * CODE "£" as the index, producing varied visual effects.
- Line 152 conditionally prints a solid block (
"███") using theAND RND<RNDidiom — when the condition is false,ANDreturns the empty string, printing nothing. - Line 153 similarly prints a partial explosion graphic with probability controlled by
RND<VAL ".3". - Line 810 uses
PEEK VAL "16515"andPEEK 16514to read the bomb’s screen coordinates back from system variables updated by the machine code routine. - Score display at line 820 uses
CODE "?"(which equals 63, a column position) as a literal constant, avoiding a stored numeric value.
Freeway Crossing — Key Techniques
The player character is drawn using conditional string expressions at line 42. Three separate AND conditions select between different graphic characters (▞, ▌, ▐) depending on the fractional part of G and the current key pressed, animating a walking figure. The variable G is incremented by 0.5 each cycle; G=INT G tests whether G is a whole number, toggling the animation frame.
- Traffic is generated at line 105 with
W=1+RND*12+(15 AND (G=INT G)), placing cars at random horizontal positions with a lane offset on alternate frames. - Two
SCROLLcalls at lines 120–122 advance the road by two lines per tick, increasing apparent speed. - The high score
Mpersists across rounds within a single run, stored as a plain variable and compared at line 260. - Line 255 has an anomaly:
PRINT AT R+CODE "▝",P;"▟";AT P,P;"** CONGRATULATIONS **"— the secondAT P,Puses the horizontal position variable as both row and column, which may place the text incorrectly for most values ofP. - Line 290 uses
GOTO PI— since PI ≈ 3.14159, this rounds to line 3, which does not exist; control falls through to the next available line. This is intentional flow control.
Rats / Snake — Key Techniques
This game is the most machine-code-centric of the three. The BASIC wrapper is minimal: RAND USR 16562 at line 10 launches the game, and lines 12–15 handle the play-again prompt on return. Lines 90 and 130 draw the top and bottom border rows using repeated bracket and tilde graphic characters printed in a single PRINT statement, constructing the maze walls before handing off to machine code.
- The
PRINT AT CODE "+",SGN PIat line 130 usesCODE "+"(= 43) for the row number andSGN PI(= 1) for the column — both are constant expressions evaluated at runtime, saving storage versus numeric literals. - Line 510 prints either “YOU WIN” or “I WIN” using two
ANDconditionals on the USR return valueU, a compact alternative to anIF/ELSEstructure. RUNat line 520 (without a line number) restarts the entire program from the beginning, resetting all variables — used here as a clean game-restart mechanism.
Common Idioms Across All Three Games
| Idiom | Purpose |
|---|---|
CODE "x" as numeric constant | Saves 4 bytes vs. a stored floating-point number |
VAL "number" in USR/POKE/GOTO | Avoids 5-byte FP constant in BASIC line |
SGN PI for the value 1 | Compact constant expression |
INT RND for the value 0 | Always evaluates to 0 since RND ∈ [0,1) |
string AND condition | Conditional print without IF statement |
| Machine code in REM line 1 | Stores binary routines in addressable BASIC memory |
Content
Image Gallery
Source Code
10 REM ▛ ▘ Q L PP,)▐PP ▘ ▘ # 5[>]RND)▙RND▘,, GOSUB [K]TAN 5▙RNDO# RETURN4S£Q 7O5[,,]RNDP▘▘▘TAN ▘ TAN LN [V]▝Y LOAD [X]4C[W]C0Y TO [W]44U▜RND[R]C▖ RETURN▌S-5▄RNDO# RETURN<S$▘ CONT ▀TAN 5▄RND# RETURN▝S▘P GOSUB #▙RNDLN PRINT ▒E:RND##[R]C£ RETURN▙C▒ RETURN#C▖▘ TAN )5 ;#[R]C▒ RETURN▙C▖ RETURN#4 GOTO 7#[R]C▒ RETURN▄C▖ RETURN#4 TO 7#[R]C▖ RETURN#4CHR$ /▀█▙▄ GOSUB #▙RNDLN PRINT ▒)PINKEY$ ▘▘ LN #" GOSUB #▙RND▖LN PRINT ▒)OINKEY$ ▘▀ LN #"LN [V]▝# RETURN CLEAR4(# RETURN LOAD 4"U▜RND[R]4▌5▜RNDQ▘:▛VAL LN [V]▝AT £4 SAVE LN NOT PI ▘,,,,TAN GOSUB #▙RNDLN PRINT ▒)▙INKEY$ ▘▘ LN #" GOSUB #▙RND▖LN PRINT ▒)▙INKEY$ ▘▀ LN #"▘,,,,TAN 5▜RNDO# RETURN▝4:U▙RNDM[$]RNDU▄RNDWWM[:]RND5▜RNDY▒[Y]K▘#/▛▀▀▄▚▚▌▐5ASN INKEY$ - U▜RND#;#M[?]RND GOSUB #[$]RNDLN PRINT ▒)▙INKEY$ ▘▘ LN #"5[$]RNDU▜RND RETURN▒K▘O# RETURN4S▘O# RETURN4S▖Q 7O5[:]RNDU▜RND RETURN▌S▘O# RETURN+S▖[J]M▜RND▘,,,,TAN GOSUB #[$]RNDLN PRINT ▒E:RND#[R]C▖ RETURN#4▖▘▖▖TAN ▘,,,,TAN E:RNDQ▒Q [J]M▜RND5▗RNDOTAN )[?]RND▘▘ LN #"TAN LN [C]RND#[L]C▖#[L]PITAN U[,,]RND[R]4▖#[5]PITAN LN AT RND# RETURN▀COS #[L]4▖#[5]PITAN U▜RND[R]CODE [,,]PILN ▐INKEY$ #[A]PILN [E]INKEY$ U▜RND[R]COS LN 8PIY▖[S]C▖LN YPITAN LN #PITAN GOSUB #▗RNDTAN U▄RND RETURN< AND #PI# SLOWRNDE£RND)▛ ;P# RETURN.TAB #PIQ9FP# RETURN.TAB #PIQ 7Q #[5]PILN [0]RND##PIE£RND GOSUB #ORND# NEW▘#;# RETURN["]"")5 GOSUB ##[R]""Q["]TAN "▝ REM
50 SAVE "BLIT[Z]"
60 PRINT "SPEED ? (1 TO 255)"
70 INPUT U
80 POKE VAL "16753",U
90 CLS
100 FOR U=SGN PI TO CODE "="
110 PRINT AT U,CODE "3";" "
120 LET Z=VAL "1.33"*U+(RND<RND)
125 LET A$="▛▜▒█[▒][~~][,,]["][:]["][-][=][=]"(SGN PI+RND*CODE "£")
126 LET A$=A$+"▒█[▒][~~][,,]["][:][-][=]["][O]"(SGN PI+RND*CODE "~~")+A$
131 FOR Y=INT RND TO RND*RND*CODE "?"
140 PRINT AT CODE "="-Y,Z;A$
150 NEXT Y
152 PRINT AT CODE "="-Y,Z;"███" AND RND<RND
153 PRINT AT CODE "="-Y,Z;"▟█▖" AND RND<VAL ".3"
160 NEXT U
170 PRINT AT INT RND,INT RND;"FUEL:50"
300 LET U=USR VAL "17105"
810 IF U<>VAL "1E3" THEN PRINT AT PEEK VAL "16515"+SGN PI,PEEK 16514;"▒,,~~"
820 PRINT AT INT RND,CODE "?";"SCORE ";U
2010 PAUSE CODE " COPY"
2020 GOTO CODE "W"
1 REM ▘▘ E:RND)5 # RETURN#C▝[R]"";# RETURN#C▝[R]"";# RETURN#C▝[R]"": TAN PPPPP
2 LET M=INT RND
5 PAUSE CODE " COPY"
9 LET P=CODE "3"
10 CLS
11 FOR G=INT RND TO CODE "+"
12 PRINT AT G,P;" "
13 NEXT G
15 LET F=CODE "▖"
20 LET G=SGN PI
34 LET R=CODE "?"
36 PRINT AT 20,31;" ";AT 21,31;" ";AT R,P;
38 LET D=USR 16514
41 IF D THEN GOTO VAL "500"
42 PRINT "Q";AT R+1,P;"[,,]";AT R+2,P;"▞" AND G=INT G AND INKEY$ <>"6" AND INKEY$ <>"7";"▌" AND G=INT G AND (INKEY$ ="6" OR INKEY$ ="7");"▐" AND G<>INT G
68 LET S=R
69 LET Q=P
70 IF NOT P THEN GOTO CODE " IF "
75 LET G=G+.5
105 LET W=1+RND*12+(15 AND (G=INT G))
110 PRINT AT 19,W;"▐▒▌";AT 20,W;"▖[O]▗";AT 21,W;"▛[▒]▜"
111 LET P=P+(INKEY$ ="8" AND P<31)-(INKEY$ ="5" AND P>0)
112 LET R=R+(INKEY$ ="6" AND R<17)-(INKEY$ ="7" AND R>0)
115 PRINT AT S,Q;" ";AT S+1,Q;" ";AT S+2,Q;" "
120 SCROLL
122 SCROLL
130 GOTO 36
250 LET V=(100-INT G) AND G<100
255 PRINT AT R+CODE "▝",P;"▟";AT P,P;"** CONGRATULATIONS ** "
260 IF V>M THEN LET M=V
262 PRINT "█[S][C][O][R][E][:]";V;" "
264 PRINT " "
270 PRINT "█[H][I][G][H]█[S][C][O][R][E][:]";M;" "
290 GOTO PI
500 SCROLL
501 PRINT AT R,P;"▒[S]";TAB P;"[▒][P]";TAB P;"▒[L]";TAB P;"▗[A]";TAB P;"▖[T]";AT INT RND,INT RND;
510 LET V=INT RND
520 GOTO VAL "262"
990 SAVE "CROS[S]"
992 PRINT AT CODE "~~",INT RND;"█[F][R][E][E][W][A][Y]█[C][R][O][S][S][I][N][G]█"
1000 LET M=INT RND
1010 LET P=CODE "3"
1100 GOTO VAL "11"
1 REM E:RND#▞ TAN O[J]M[~~]RNDWM[,,]RND 7# RETURN COS FFY COPYM[,,]RND# RETURN COS 7)5 [J]M[,,]RNDXM[~~]RND[R] GOSUB ## RETURN COS [J]WM[~~]RND;;# RETURN COS [J]M["]RND▘ TAN ;>3#>=8(?▘3 VAL LN PRINT ▒# LPRINT PI REM UEXP RND5[,,]RND▚MEXP RNDUINT RND5[~~]RND▚MINT RNDLN RAND RNDTAN E£RND7- UEXP RND#;)5 GOSUB #UINT RNDW#;( CLEAR##TAN LN LPRINT RND6SQR RND RETURN ""Q▒TAN P# ▌[0] REM 1UEXP RND5[,,]RND[-]MEXP RNDUINT RND5[~~]RND[-]MINT RNDLN RAND RND#[$]RND1111Y=MINT RNDLN RAND RND[R]COS Y▘MINT RND▘ ▘TAN Y2MEXP RNDLN RAND RND[R]COS Y▘MEXP RND▘ ▘TAN Y▘MEXP RNDLN RAND RND[R]COS Y2MEXP RND▘ ▘TAN Y▘MINT RNDLN RAND RND[R]COS Y=MINT RND▘ ▘TAN 1█11ESQR RND# RETURN[,,]ASN #INKEY$ RETURN[(]ASN #INKEY$ RETURN[~~]ASN #INKEY$ ##INKEY$ LN [-]INKEY$ # RETURN▘COS Q▒TAN 1LN ##LN [7]#TAN [)][(]1# ▞[6] REM 2UORND NEW▘C▝Y COPY#U[,,]RND[R]C,,[J]M[,,]RND#M[~~]RNDTAN M[~~]RND#M[,,]RNDTAN 22222225ABS RND#[R]COS O#UORND#- 5▘ #▞▒ACS ZK▘;( RAND # RETURN▘SQR #COS INKEY$ 222222LN =INKEY$ #[L]""LN LIST INKEY$ ▘ TAN 22ESQR RND#▘▘▘ RETURN[,,]COS RETURN[~~]COS RETURN[(]COS RETURN[)]COS ▘ TAN 22UPEEK RND RETURN64(USTR$ RNDWMSTR$ RND RETURN+**Y▘MSTR$ RNDTAN USTR$ RNDXMSTR$ RND""Y=MSTR$ RNDTAN 22LN CHR$ RND#[R]INKEY$ LN [V]▝▘ # RETURN TO 4># RETURN RUN 4▌:5TAN RETURN LOAD "":6TAN RETURN LOAD 4,,# RETURN LOAD "":7TAN RETURN RUN ""# RETURN LOAD "":8TAN 3LN #PI#[R]C▀MPEEK RNDUPEEK RND▞ #TAN UPEEK RND RETURN84(UUSR RNDWMUSR RND RETURN3**Y▘MUSR RNDTAN RETURN54:UUSR RNDXMUSR RND""Y2MUSR RNDTAN #RNDPI)[Y]INKEY$ ▘▝ LN #"AT ▖# RETURN+ AND OR RNDTAN 4E£RND7- UUSR RND#;)5 GOSUB #USTR$ RNDW#;( CLEAR##TAN LN [8]PILN [P]PILN POKE PI[R]""Q█TAN 4LN Q#LN ?#C▖▘ TAN LN /PI##[R]C GOTO ▘▘▘TAN ▞▝:▞VAL LN [V]▝AT £4 SAVE ( POKE TAN 45ABS RNDQ[Z]7Q87Q?7Q?LN COS INKEY$ TAN ▘ COPYLN ##CY▘ ▘LN ##CQ▘ COPY LN ##CI▘▘ LN ##CA▘ TAN EEXP RND FAST#[,,]##█#6EXP RNDVAL LN RAND RNDAT LPRINT 6EXP RND RETURN[,,]COS RETURN[~~]COS RETURN[(]COS RETURN[)]TAN GOSUB #[,,]RNDTAN LN 2##[L]COS LN BPI#[L]4£LN CINKEY$ #[L]C*LN E#/ REM LN [G]INKEY$ #[L]C STEP LN WINKEY$ #[L]4 OR ▘▘▘TAN LN ###[L]4 SCROLL/ NEXT
2 GOTO EXP PI
3 SAVE "RAT[S]"
60 PRINT ,," SPEED? (1 TO 250)"
80 INPUT U
82 POKE VAL "17209",U
85 CLS
90 PRINT "[(][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,][,,]"
130 PRINT AT CODE "+",SGN PI;"[~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][~~][)]"
500 LET U=USR VAL "16999"
510 PRINT AT INT RND,INT RND;"YOU" AND U;"I" AND NOT U;" WIN "
520 RUN
1 REM ▜RND########################################(6 >"[<]:(▞+VAL $LN PRINT ▒AT Y█NOT ( PRINT $4 LIST LN PRINT ▒Y0NOT NOT NOT Y COPYM[L]RND5[E]RND6▙RNDE£RND)1 ; FOR 5▜RND▞=#7#7 FAST##)) ;## LPRINT ( LIST E[K]RNDY▘[W]K▒▘# GOSUB PI6[K]RND#VAL LN [V]▝AT ( RAND ACS #C###8C#LN [X]▛#5[G]RNDCHR$ 5S# RETURN▖K#▞ #,,#- E▜RND:)[B] GOSUB PI;# RETURN█CA RETURN▒C6 RETURN▞C2 RETURN[$]C▝/# FASTE£RND777# RETURN94~~Y[-]M[L]RNDQ0F/ LET O LPRINT FASTE▙RND#7#Y█>)[F]RND##FF▘A GOSUB [S] LPRINT 6▜RNDE▜RND FAST5▜RND77Y▒ GOSUB #▙RND[B] FAST GOSUB PI LPRINT PRINT #7#7 LET C▀>/ LIST Y▞> LPRINT QO▘#▘E£RND,,FY[$] GOSUB [T]7 LLIST DIM INKEY$ )) ;# RETURN█C~~ RETURN▒CD RETURN▞C;/▝Q[$][B] GOSUB #Q█ FASTVAL ▘▜RNDE▙RND[B] GOSUB PIAT LPRINT COS /LN FASTE▙RNDFF6▙RND LPRINT /<>[B] GOSUB #/[W]E▜RNDUORND***[H] RETURN S< NEW?E£RND)▌ ;#▞ ,,# RETURN▞Q[$]COS # POKE RND
9 CLS
10 RAND USR 16562
11 CLS
12 PRINT "GO AGAIN ? Y/N"
13 INPUT Y$
14 IF Y$="N" THEN STOP
15 GOTO 9
20 SAVE "SNAK[E]"
30 GOTO 9
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.