BASIC to Text

Developer(s): Michael Carver
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Utility

Converts a BASIC program in memory into an ASCII text file that can be saved and loaded into a word processor such as MSCRIPT, or uploaded by modem. The BASIC loader sets CLEAR 64899, loads the 592-byte machine code file bs2txt.C1 at 64900, and prints the procedure. First load the BASIC program to be converted. Then enter RANDOMIZE USR 64909, then RANDOMIZE USR 65042: PAUSE 0, and save the result as the screen instructs. A final step suggests using CONVRT.B1 to turn the file into a Tasword Two file.

The loader’s banner reads “TS-2068 BASIC>Text LOADER PROGRAM”. The program is by Michael Carver, whose article “BASIC2text …. Extending the use of MTERM II” appeared in Time Designs, November/December 1986. A related article, “Convert BASIC into Text”, appeared in Nite-Times News in July/August 1990. The same loader was found on three Larken disks.

Program Analysis

Loader

The BASIC part is a short loader. Line 20 sets the colours and reserves memory, line 30 loads the code, and lines 40–120 print the procedure before a STOP. Line 9993 is a REM’d save line for the code file, kept as a note of its address and length.

Machine code

The 592 bytes at 64900 have two entry points, 64909 and 65042. The code’s own messages say “BASIC has been moved.” and “PRESS ANY KEY TO CLEAR MEMORY.”, and give a save instruction beginning SAVE "name" CODE 28416,. Line 0 of the loader is a REM holding what appears to be a copy of the same code, since its embedded messages match. The code has not been disassembled for this description.

Notable Techniques

  • The code sits above CLEAR 64899, out of the way of the BASIC program that is loaded afterwards to be converted.
  • A line 0 REM, which cannot be edited from the keyboard, carries a copy of the machine code inside the BASIC file.

Potential Issues

  • GO TO 9998 in line 130 follows a STOP and runs only if the user types CONTINUE.
  • The instructions name CONVRT.B1, but no file by that name was on the disk. The nearest match is Kurt Casby’s Unloader, CNVRT.BV, which converts MTERM and MSCRIPT files to Tasword.

This copy came from a Larken disk and was converted to load from tape. The RANDOMIZE USR 100 disk prefixes and the LOGICALL menu load were removed, and the code file is unchanged. It was tested in ZEsarUX: the loader screen, and a small test program converted to the “BASIC has been moved” message.

Related Articles

Program to remove non-ASCII control codes and expand tokens to full ASCII equivalents so that programs may be uploaded to...
This program converts a TS2068 BASIC program in memory to an MSCRIPT text file. When you have to generate a...

Image Gallery

Source Code

    0 REM GO SUB KS\*K\ GO SUB B## RESTORE STR$ GO SUB C.' CLEAR GO SUB [SIN \ GO SUB S': CLEAR *K\ GO SUB LN S : CLEAR CLEAR : STEP FLASH ! STEP VAL { RETURN COPY  SAVE z RETURN COPY  NEXT STEP VAL { RETURN COPY ( SAVE o GO SUB SSIN \ STEP BASIC has been moved. PRESS ANY KEY TO CLEAR MEMORY.*SIN \":' CLEAR ! . CLEAR 6* : CLEAR V#^### RESTORE RESTORE STR$ *': CLEAR CODE GO SUB B ERASE VAL$ RETURN LLIST RETURN 7 STEP FLASH !*:' CLEAR o GO SUB R+' STEP i RETURN STEP i RETURN STEP i RETURN STEP i RETURN STEP i RETURN > CLEAR STEP 0CODE < GO SUB R8 RANDOMIZE AND / BEEP <>To save BASIC as text file:SAVE "name" CODE 28416, FOR  CONTINUE STEP ACS COPY d STEP ACS COPY STEP ACS COPY } RETURN  ( AND 0 STEP <> COPY LLIST ~# RESTORE RETURN " PRINT : . CLEAR INPUT 2 . CLEAR LET RETURN ( LLIST GO SUB J RESTORE INVERSE RETURN  0 BEEP RETURN {0* PRINT : . CLEAR THEN ::2 . CLEAR LET RETURN TO COPY RETURN : TO COPY STEP <> COPY RETURN  LN LLIST NOT  RETURN PRINT : . CLEAR THEN h2 . CLEAR LET <> RETURN   0 RETURN |( RETURN ~(! . CLEAR THEN F NOT THEN V IN VERIFY STEP w COPY STEP n COPY .  RETURN a0> TAB RETURN RND0 VERIFY ORND RETURN REM  PRINT : . CLEAR THEN BEEP 2 . CLEAR LET VERIFY RND STEP w COPY STEP n COPY NOT STEP RETURN : . CLEAR THEN CAT 2 . CLEAR <> PRINT STEP |8: . CLEAR THEN O > STEP RND COPY NEW * STEP RND COPY 0 PRINT MOVE RETURN H( RETURN '  CIRCLE z RETURN CIRCLE > MERGE INK STEP <> COPY INK MOVE <>{ RETURN COPY  GO SUB B<0 CLS =( GO SUB RETURN  ( AND 0 RESTORE *:' CLEAR w#":' CLEAR LLIST <>HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
   10 REM ***********************         * TS-2068  BASIC>Text *         *   LOADER PROGRAM    *         ***********************
   20 INK 9: PAPER 1: BORDER 1: CLEAR 64899
   30 RANDOMIZE USR 100: LOAD "bs2txt.C1"CODE 64900,592
   40 PRINT "This program converts a BASIC";TAB 0;"program listing into an ASCII";TAB 0;"text file that can be saved and";TAB 0;"loaded into a word processor."
   50 PRINT "** BASIC TO TEXT PROCEDURES **"
   60 PRINT "1. CLEAR 64899"
   70 PRINT "2. LOAD BASIC program."
   80 PRINT "3. LOAD bs2txt.C1 code"
   90 PRINT "4. Enter: RANDOMIZE USR 64909"
  100 PRINT "5. Enter: RANDOMIZE USR 65042:     PAUSE 0"
  110 PRINT "6. SAVE per the instruction."
  120 PRINT "7. USE CONVRT.B1 to convert file   to Tasword Two."
  130 STOP : GO TO 9998
 9992 RANDOMIZE USR 100: SAVE "BS2TXT.B1" LINE 1
 9993 REM RANDOMIZE USR 100: SAVE "bs2txt.C1"CODE 64900,592
 9998 RANDOMIZE USR 100: LOAD "L.B1"

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.