The Fast One is a database management program that allows users to add, update, delete, and select records, with options for display/print, totals/averages, and report formatting. The program uses a large REM statement in line 1 to store the bulk of its code as machine code or encoded data, with normal BASIC lines appearing only from line 4000 onward. Lines 4000–4026 handle specific tasks including string division (computing a ratio via VAL and string slicing), file saving with user-supplied names, and a startup credit display with a PAUSE. The GOTO USR R pattern used repeatedly suggests a machine code return address is stored in variable R, dispatching control back into the REM-embedded routine after each BASIC subroutine completes. Line 5000 provides a simple text input that similarly returns to the machine code engine.
Program Analysis
Program Structure
The program is dominated by a single enormous REM statement at line 1. This line contains what appears to be the entire application engine — a machine code routine (or heavily encoded BASIC) embedded in the remark’s character data. The visible BASIC lines begin only at line 4000 and represent small helper stubs that are called out to from the machine code and then return control via GOTO USR R.
The overall architecture is therefore a machine-code-primary design: the REM block holds the program logic, and the sparse high-numbered BASIC lines act as I/O or system-call trampolines.
BASIC Lines and Their Roles
| Line | Purpose |
|---|---|
4000 | Prints the string variable T$ via LPRINT |
4001 | Returns to machine code via GOTO USR R |
4010 | Computes a numeric ratio: extracts two substrings from T$ using hard-coded slice offsets stored as VAL "14", VAL "15", VAL "19", divides them, and stores the result back as a string in T$ |
4011 | Returns to machine code |
4020 | Accepts user text input into S$ |
4021 | Copies S$ into T$ |
4022 | Saves a file using the user-supplied name in S$ |
4023 | Clears the screen |
4024 | Prints a copyright notice |
4025 | Pauses for approximately 200 display frames |
4026 | Returns to machine code |
5000 | Accepts text input into T$ |
5001 | Returns to machine code |
Machine Code Dispatch via USR R
The idiom GOTO USR R is the program’s primary control-flow mechanism back into machine code. The variable R holds the address of the machine code entry point embedded in (or near) the REM statement at line 1. Each BASIC stub ends with this GOTO, so the machine code engine retains overall control and only delegates to BASIC for operations that are more convenient in BASIC (user input, file I/O, screen clearing, printing).
REM as Machine Code Storage
Storing machine code in a REM statement is a well-known technique for this platform. The tokenizer does not interpret the contents of a REM, so arbitrary byte sequences can be embedded there. The program’s REM text, when decoded from the zmakebas token representation, contains a dense mixture of BASIC keyword tokens and raw byte values that together form the actual machine code payload. The decoded token stream visible in the listing (showing keywords such as GOSUB, LPRINT, FAST, SCROLL, GOTO, INPUT, etc.) reflects the tokenized byte values that the Z80 interprets as opcodes and data, not as BASIC instructions.
Key BASIC Idioms
VAL "14",VAL "15",VAL "19"in line 4010 — usingVALon string literals to embed numeric constants saves memory compared to storing them as floating-point numbers in the BASIC line.- String slicing with
T$(TO n)andT$(n TO m)for substring extraction used directly insideVALand arithmetic. SAVE S$at line 4022 uses the runtime contents ofS$as the filename, enabling dynamic file naming under machine code direction.
Application Features (Encoded in REM)
The text content of the REM statement, while not directly executable as BASIC, reveals the database application’s menu structure and feature set through embedded string data. Identifiable features include:
- Add, Update, and Delete Record operations
- Select Report and Select Record operations
- Display/Print and Total/Average functions
- Define Item and Format Report options
- Item type definitions: string, numeric, and “not” (boolean-style) fields
- Navigation prompts: Next, Top, Previous Menu, Main Menu
- Error messages for non-numeric input, undefined items, and full file conditions
- Confirmation prompts (e.g.,
[Y] TO CONFIRM) - Record status indicators including
DELETEDandSELECTED=00000
Notable Techniques
- The entire application logic fits within one
REMline, keeping the visible BASIC listing minimal and protecting the code from casual inspection or editing. - Arithmetic on string slices in line 4010 (
VAL T$(TO 14) / VAL T$(15 TO 19)) suggests the machine code passes encoded numeric data to BASIC viaT$for evaluation, leveraging the BASIC interpreter’s floating-point arithmetic rather than implementing division in Z80 assembly. - The
PAUSE 200at line 4025 provides a timed splash screen display without any additional logic.
Potential Anomalies
- Line 4022 saves to tape every time the input stub at lines 4020–4026 is invoked. Whether this is intentional (a “save database” operation) or could be triggered inappropriately depends entirely on how the machine code controls which stub it calls — this cannot be verified from the BASIC listing alone.
- The copyright message at line 4024 is printed unconditionally after every input/save operation in the 4020 block, suggesting this block may only be reached once (at startup or during a specific save routine).
Content
Source Code
1 REM ACS INKEY$ SCROLL#▘#ACOS #(▘ RNDCOS #[9]#▀40WW 0B 011.00 10[F]#[F]#0000.00 1GA[O]# GOSUB #▄RNDE▗RND FASTE▐RNDTAN GOSUB #▄RND6▐RND LPRINT 6▗RNDTAN LN PRINT RND5GINKEY$ [Y]7#7#C£7ACS #C CLS7ACS #C LOAD / SCROLLLN 2#7▘#▝LN THEN# FOR DIM VAL STR$ FASTLN [V]▝#[Y]#LN [V]▝###=C RUN LN [X]▛# LPRINT SGN AT TAN FASTSTR$ FOR E£RND,, FOR , RETURN#C£# NEW[Z]ACS #><ACS #7C LOAD SGN LPRINT TAN A##ADD A RECOR#UPI#UPDATE RECOR#D##DELETE RECOR#R##SELECT REPOR#S##SELECT RECORD#P[D]#DISPLAY/PRIN#T##TOTAL/AVERAG#I GOSUB #DEFINE ITE#F[C]#FORMAT REPOR#BG#SPARE BYTE#V SCROLL#SAV# COPY FASTE£RND,,Q ▀LN ?INKEY$ " LPRINT TAN LN ABS INKEY$ #?INKEY$ LN ABS INKEY$ # GOTO INKEY$ STOPLN ?INKEY$ ACS #7C CLS STOPTAN ▘# TAN FASTE£RND,,ACS #4▝#▀ LPRINT TAN FAST55 ,, FASTAT LPRINT TAN FASTVAL LN ##▘# # RETURN COPY4▀AT LPRINT TAN VAL -▖LN CLEARINKEY$ Y.+4 SAVE 7F7LN ?INKEY$ ACS #7C CLSAT LN ~~PI/>=▝LN <PIYF▝###E[(]RND7ACS #4"[Y]7COS F7ACS #C CLS/ LIST 5#PITAN (?# FASTSTR$ E0RND,,60RNDE=RND,,6=RNDE,RND,,6,RNDE[(]RND) RETURN COPY;#7# FOR ,, FOR #F#SGN LPRINT TAN U[=]RND#£E0RND▞ ,,)▙ ; GOSUB #▝RND GOSUB # IF [X]PI5[K]PILN <PILN PRINT RND[*]TAN [F][I][L][E]█[F][U][L][L][.]<= COPYVAL LN #PI GOSUB #[~~]RND#XC▘<STR$ E0RNDF FAST[R] GOSUB PI FAST7 GOSUB # FASTAT LPRINT SGN GOSUB [S]SGN U▙RND>AT $COS E[>]RND< GOSUB [K]TAN FASTVAL E[>]RND▘4 ,,INKEY$ [*]F[Y]4▝( IF ACS PLOT #M[=]RND#[,]# STOPLN STEP INKEY$ ACS #7C CLSLN PRINT RND RETURN,S RAND RETURNRNDS▌ RETURN#4 LET [*] PRINT LN ABS INKEY$ LET STOPTAN E[~~]RND FAST▘ "7ACS #C IF /~~ FAST▘ COPY COPY"7ACS #C IF SGN LN #PISTR$ E0RND[R] GOSUB # FAST[R] FOR GOSUB PIAT SGN GOSUB [K]TAN ▘[+]▝LN ▞#DELETED[N] LET TAN Y█LN [?]#C/LN ##LN M#E[~~]RND4(ACS #4▞7ACS #CODE D#LN 2##[Q]#LN CLEARINKEY$ ▀ACS #4BLN #PIC3LN ▞#ITEM NOT DEFINED, [N][L] TO CON#LN STEP INKEY$ LN STOP#4K▘[Q]▝LN ▞#[R]=REPLACE [D]=DELETE [N][L]=LEAV#[R]C[$] RETURNDCM RETURNR4CHR$ FLN S#▘[Q]▝LN NEWINKEY$ [E][N][T][E][R]█[1][-][3][2]█[C][H][A][R] SAVE ▘[▒]<LN CODE RNDLN GOTO PICODE [$]PI▘[Q]▝LN ABS INKEY$ /▖FLN S####Y-VAL FASTE£RND▘#▝,,▞4#7( UNPLOT LPRINT AT TAN ▘[+]▝LN ▞#[G][I][V][E]█[I][T][E][M]█[C][O][D] REM M▙RND[R]TAN 7( UNPLOT LPRINT AT TAN CLEARQ5< FASTSTR$ VAL PRINT ▘▘ CLEAR#5LN ABS INKEY$ LN ~~PI+4 RUN LET AT SGN LPRINT TAN 2/ CLEARQ5<LN ## CLEARQ5~~▘▘ #LN NEW#4# CLEARP540VAL LN ▞#[C][=][C][O][N][T]█[N][L][=][S][T][O] PRINT AT [R]CZ RETURNCCLN / SLOW FASTE£RND,,-4Q-7+4 IF VAL 5▀ ,, FASTAT PLOT █LN CLEARINKEY$ ▀ NEW#LN #PILN THEN#AT LN ~~PIE[~~]RNDACS # LPRINT 4▀LN ?INKEY$ LN ~~PI0ACS #C[4]TAN Y COPYM4INKEY$ LN ?INKEY$ Y#M4INKEY$ TAN .E[(]RND6[~~]RND### FASTVAL ▞:Q07( CLSFFFQ.AT LPRINT TAN # NEWZ RETURN0S▀ RETURNA**[R]TAN VAL STR$ FAST5[+]RNDLN PLOT # LPRINT FAST▘ Y.[Y]C$LN ▛#KU£ACS #4;7/ INPUT 7LN ▛#KGM[5]RNDACS #4,,7LN ▛#K3M[6]RND5[/]RNDY▒[)]S= RETURN▒C?##; FOR LPRINT FAST# NEWZ>7<$4 RUN R LPRINT SGN AT TAN VAL STR$ FAST5[6]RND)[K]RND▘ :, RETURN.C:CHR$ 0▚▟: RETURNAS▀CHR$ ~~£>F.( DIM LPRINT SGN AT TAN FASTSTR$ VAL # NEWZ#,# NEWZ[S]C~~YLS▝YHAT SGN LPRINT TAN ACS #YE4 PLOT <ACS #7C TO / GOTO ▘JPIY75GINKEY$ #ZPIVAL ▞▌Q07( CLSFAT FAST LPRINT FAST#[L]C$"#W# RETURNAS PAUSE Q0F/ POKE LPRINT TAN E[(]RND6[~~]RNDTAN E[~~]RND7ACS #C CLSACS #""ACS #4 POKE 6[~~]RNDTAN LN CONT #""U[N]RND RETURN14▌ACS #4 LET TAN ACS ####TAN 5E# GOSUB #[L]RNDLN AT #▘▞▀LN NEWINKEY$ SELECTED=00000RNDTAN LN LPRINT #▘ LN CONT #C▌ GOSUB #[L]RNDTAN ACS # C LET ▀/ INPUT LN LPRINT #LN )#5[I]#LN <PILN PRINT RND RETURN04)LN CONT #4▖Q█/ RUN 5 6[L]RND/>= RETURNMASN [Q]# RETURN54)▘ LN CONT #4▌Q[▒]▀/ PLOT VAL LPRINT / LPRINT M[N]RND RETURN1C▖ RETURN24#LN M#C[M]LN #PILN STEP INKEY$ 5##LN <PILN PRINT RND PRINT LN ABS INKEY$ LET RETURNMC[;]M[O]RND RETURNAS STEP C7 RETURNLK AND RETURNB43YCMCHR$ #LN CLS#C▞LN L#### FASTLN STOP# LPRINT 4 INPUT ACS THEN/ REM Y4/ STOP▘[Q]▝LN GOTO INKEY$ [G][I][V][E]█[A][R][G][U][M][E][N] RAND ▘[▒]<LN CODE RND▘[Q]▝LN ABS INKEY$ LN GOTO PIC[;]U[O]RND RETURNCTAB GOTO #LN CLS#4[U]LN STOP#4 PLOT GOSUB #[>]RNDLN [(]# RETURNEC▛ACS #7C POKE / SLOWE[~~]RNDACS THEN/<>LN [(]# RETURNE4~~# RETURND""E[~~]RNDACS THENTAN RETURNL4,,# RETURNGC LET RETURNE/ GOTO # RETURNF/ PRINT ASN CLS#ACS [2][*]TAN AITEM=YE#BITEM=N#CSTRING SCA#D=STRIN#ENOT#F#G#H=NUM VALU#INOT#J#K#MPREV MEN# COPY0RESE#1SELECT ADDITIONA#2SELECT SUBSE#5AL#MMAIN MEN# COPYU▙RNDE[~~]RND##PI RETURNHK+# GOSUB #[>]RNDLN CLS#TAB ACS #LN STOP#4 PRINT LN J#/ LIST E[>]RNDLN <#S1▘NOT ▝LN ▞#ARG NOT NVMERIC - [N] LET # STEP #)[7]RND5[+]RND▘: GOSUB [K] FOR FACS PLOT LN CLS#4[U]LN STOP#4 PLOT LN <#USR ##5[+]RNDU[O]RNDCHR$ ▖#LN J#/ LLIST ▘[+]▝LN ▞#[G][I][V][E]█[R][E][P][O][R][T]█[R][E] FOR M[P]RND[R]TAN E[(]RND7ACS #C CLSACS #""ACS #C POKE Y/ FASTLN #PI#5[P]RND[Y] LPRINT COS / FAST PRINT E[(]RNDY COPY7[Y]4 UNPLOT 6[~~]RND LET M▙RND▘▘ LN [>]PI[R]TAN ▘[+]▝LN ##CLLN ##4U6[~~]RNDVAL LN ##AT LN ▞#[D]=DELETE [A]=ALTER [M]=MEN# RETURND4,,LN D#LN ###[Q]# RETURNMC RAND RETURNA4SGN ###Y[4]#EXP #5▙RNDQ/U[P]RNDE[>]RND#7QRNDY▝LN [(]PI/ LLIST E[~~]RND# NEW LIST RETURN█COS ▘[+]▝LN ▞#NO REC[N] LET Y▘[R]TAN LN ##▘[+]▝LN ▞#[Y] TO CONFIR# RETURNY4[5]/[;]LN ~~#4[,]/[7]-0LN ##▘▘ 2>#M[P]RND RETURNRNDCWLN ##4O141▘[+]▝LN ▞#[C]=CONT [N][L]=STO#[R]C1 RETURNCC CONT /INT #VAL LN NOT #▀Y.LN #PI4▀LN ?INKEY$ AT LN ~~PI=/[W]LN ##C▌LN ##4 PLOT #[Q]#STR$ FOR E£RND,, FOR AT , RETURN#COS #ACS INKEY$ C▝ PLOT █ NEW[Z]><ACS #""7( FOR TAN #7#7 FAST5▘ ▘5 #CHR$ 0 RETURN<S▝Y>WXC▀,,/ IF #CHR$ 0 RETURN4S▝Y2#,, FASTAT LPRINT TAN FAST-▘ACS #C▝ LPRINT TAN =7/ PLOT 5[?]RNDOACS #""#E[Q]RNDLN #PI4 LIST TAN LN CONT #""ACS #C SAVE ACS #4 POKE TAN U[7]RND RETURN.K▖LN ~~#TAN VAL LN LPRINT #)##LN ~~#4=U[7]RNDLN NEW#LN [(]# RETURNH4 INPUT FOR GOSUB #[~~]RND/ SCROLL, RETURN COPYC▛ GOSUB #[~~]RND[*]AT TAN PLOT ▘AT TAN 5##)[+]RND▘ ▒STR$ LN [G]#SGN LN RAND #"" PRINT LN [G]# LET TAN 40WW 0B Y.M[?]RNDLN ##""LN NEW#C▌5[0]RNDACS PLOT FAST5[+]RNDU[$]RND▚ RETURNJS▒Y COPYM[:]RND LPRINT / THEN#LN TAB ##7#CHR$ 0# LPRINT LN [8]#/EXP LN ##TAB ##6[Q]RND FOR 5[7]RNDQ 7Q1F FOR Y,LN #PI4▞▘ ▝LN [G]#LN LPRINT #LN CONT #4▖ACS ▚/ RUN LN LPRINT #LN ##▘+▀LN ABS INKEY$ [*]M[$]RNDM[:]RNDE[Q]RNDY.M[?]RNDLN #PI4-LN GOTO #Y3[>]▘▘ S▒C▞ACS Z▀X4 UNPLOT LN THEN#LN ##4;LN #PI FAST5[;]RND#[R]C"LN TAB ##-4 LPRINT LN [8]# FAST LPRINT / LLIST GOSUB #[~~]RNDLN LPRINT #LN CONT #4▖ACS [:]/ RUN GOSUB #[~~]RNDLN *#4AE[~~]RND6[A]RNDLN ##U[:]RNDWC4E[~~]RND6[C]RNDQ["]U[8]RNDCHR$ 05[$]RND▚#LN *#C STEP ▘+▀LN GOTO INKEY$ [E][N] DIM ▘[+]▝LN ▞#[N][L]NEXT [T]TOP +[N]RECS [P]PRINT [M]MEN# RETURNTASN ASN #[R]4,,E[C]RND6[~~]RND# OR # RETURNM4,,E[A]RND6[~~]RND#[Q]# RETURN1SP RETURNAKLCHR$ 0#LN LPRINT #LN CONT #4▒ACS #C RUN ACS ▚/ NEXT E[A]RND6[~~]RNDU[7]RND RETURN0K▀▌C£E[~~]RNDACS LEN LN *#4▝( POKE /[R] RETURNPTAB ##▘[+]▝LN ▞#[A]ALL [D]DATA ONL# RETURNAC▖ RETURND4 LLIST CLEAR#5E£RND7▞<VAL FAST CLEARACS 5#C:▞4[*][Y]4▞7( IF /2 LPRINT FAST▘4 GOSUB #[>]RND GOSUB [K] LPRINT SGN ▘[4]?LN CODE RNDSTR$ ▘5 ,,AT (SGN ### LPRINT / NEXT LN ##5[7]RNDLN PLOT #LN M#ASN SLOW#LN #PI▘#▘LN NEWINKEY$ TOTA#▘#▘LN ?INKEY$ LN LPRINT #LN CONT #4=ACS #C RUN LN STOP#4 PAUSE LN <#USR ##LN ##/ SCROLL5[7]RND▘[$]▘) :LN [8]# GOSUB #[L]RND#[L]CQVAL GOSUB #[>]RND5[7]RND▘: VAL STR$ GOSUB [K] LPRINT AT ,,AT LN AT #▘[E]?LN CODE RNDLN GOTO PI▘INT ▘LN GOTO INKEY$ AVERAGE#▘NOT ▘E[>]RNDLN ?INKEY$ ▘[+]▝LN ▞#[N][L]MEN##[Q]#▘[Q]▝LN NEWINKEY$ [G][I][V][E]█[S][A][V][E]█[N][A][M] REM ▘[O]?LN CODE RNDLN GOTO PIE[>]RND)/#▘= GOSUB [K]▘[Q]▝LN ABS INKEY$ #[Q]#TF# E▝RND▘▙ GOSUB PI GOSUB #0RND GOSUB ###E£RND)▙▘;LN AT ##**#2 [N] LET /#5F#▘▞ #F[Q]4▖▀F/ RUN 5/#)▘=#[B]#LN ~~#TAB [Q]##B#▘[Q]▝LN ▞#NON-NUMERIC [E]EDIT [N][L]IGNOR#[R]COS RETURNE4 AND LPRINT ###E[>]RND▞4ACS [Y]7( CLSAT LPRINT TAN LN [8]#E[~~]RND FASTLN L#LN )#LN 2# LPRINT 6[~~]RND#SQR RNDGTAB SAVE RND:(▞ ( RETURN$4 RAND # RETURNRNDLN [?]#ASN [Q]## POKE # PLOT █# CLEARINKEY$
4000 LPRINT T$
4001 GOTO USR R
4010 LET T$=STR$ (VAL T$( TO VAL "14")/VAL T$(VAL "15" TO VAL "19"))
4011 GOTO USR R
4020 INPUT S$
4021 LET T$=S$
4022 SAVE S$
4023 CLS
4024 PRINT "(C) CAMPBELL SYSTEMS 1982"
4025 PAUSE 200
4026 GOTO USR R
5000 INPUT T$
5001 GOTO USR R
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

