--- title: "The Fast One" id: 58461 type: "computer_media" slug: "the-fast-one" url: "http://localhost/computer_media/the-fast-one/" markdown_url: "http://localhost/computer_media/the-fast-one.md" published_at: "2024-11-17T22:20:21+00:00" modified_at: "2026-04-04T20:17:46+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/11/TFO.jpeg" excerpt: "A REM-based machine code database manager with add, delete, select, and report features hiding almost entirely inside a single program line." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Campbell Systems" slug: "campbell-systems" taxonomy: "post_tag" url: "http://localhost/tag/campbell-systems/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "Mindware" slug: "mindware" taxonomy: "post_tag" url: "http://localhost/tag/mindware/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Database" slug: "database" taxonomy: "genre" url: "http://localhost/type/database/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/The%20Fast%20One%20%281982%29%28Mindware%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1982" producer_company: - id: 10719 title: "Campbell Systems" type: "company" url: "http://localhost/company/campbell-systems/" images: - url: "http://localhost/wp-content/uploads/2024/11/TFO.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/Tape-16.jpg" related_products: - id: 14318 title: "Fast One, The" type: "product" url: "http://localhost/product/fast-one/" media_type_tags: "Database" --- # The Fast One 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 — using `VAL` on 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)` and `T$(n TO m)` for substring extraction used directly inside `VAL` and arithmetic. - `SAVE S$` at line 4022 uses the runtime contents of `S$` 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 `DELETED` and `SELECTED=00000` ### Notable Techniques - The entire application logic fits within one `REM` line, 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 via `T$` for evaluation, leveraging the BASIC interpreter’s floating-point arithmetic rather than implementing division in Z80 assembly. - The `PAUSE 200` at 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). ## 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 #>=▝LN 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 ▘[▒]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 = 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 ]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]>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▞]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 ```