CK Type

Author(s): Stan Lemke
Pub Details: Time Designs Magazine v3 n4 (Volume 3, Issue 4)
Date: May/June 1987
Pages: 13-14

One of the really great things about attending the 1987 TS Computer Fest was meeting and talking to all the great Timex/Sinclair enthusiasts! What’s more, all the people that type-in and use programs presented here in TDM. Several people commented on the difficulty of typing in these programs, and then debugging them. The longer the program, the more difficult the task. As an aid in this endeavor, I’ve created CK TYPE.

CK TYPE will give a short analysis of every line in your BASIC program. It provides the following information: LINE NUMBER, number of BYTES used to create the line, and a CHECKSUM of these bytes. If a program is submitted and the CK TYPE output is provided for the listing, you will be able to type in your copy, run CK TYPE on it, and very quickly know which line(s) might need corrections. (Note: OUTPUT is routed to the screen and to the TS2040 printer with LPRINT, simultaneously.)

The LINE NUMBER lets you check line-by-line the accuracy of your listing. A line is the BASIC program line following a number (1 to 9999), and may be 1 word, or a full screen in length.

Number of BYTES used is dependant on the number of characters you type (including blanks and embedded attributes) and helps you find those missing “spaces”.

CHECKSUM helps you find typing errors such as misspelled variables, errors in data statements, and even transposed characters. It is not “fool-proof”, as compound errors could offset each other, but it sure helps. (Note: CHECKSUM for upper and lower case letters is different, so be sure to use the same case as the listing you are typing!)

Listing “A” gives you the CK TYPE Basic program. Simply type it in as is. If you do not have TIMACHINE (the compiler from NOVELSOFT), then you can delete/skip lines 9987 to 9990 as these are TIMACHINE directives. When you are sure the program is typed correctly, save it to tape with: SAVE “CK TYPE” [ENTER].

The program is then ready to RUN. Type RUN [ENTER]. The output it creates will match listing “B” if you have no errors. The first column from listing “B” is the LINE NUMBER, column 2 is the number of BYTES used to create the line, column 3 is the line CHECKSUM value. Non-TIMACHINE versions would start with the line number 9991. To use this version with other BASIC programs, make sure that your other program does not use lines 9991 to 9999. Then MERGE CK TYPE with your other BASIC program, and RUN 9991 [ENTER].

If you use the TIMACHINE compiler to compile this program, it will produce listing “C” and a machine code routine that will be located at 64888 and be 460 bytes long. SAVE this to tape with SAVE “CK TYPE” CODE 64888, 640 [ENTER]. To use this, LOAD in your BASIC program, LOAD in the machine code program with: LOAD “CK TYPE” CODE 64888,460 [ENTER], and run with RANDOMIZE USR 64888 [ENTER].

Listing “D” is a POKE table to create a machine code version of CK TYPE (if you do not have TIMACHINE). The first column defines the memory location of the number in column 2, column 1 + 1 is the memory location of column 3, column 1 + 2 is the memory location of column 4, etc. You can create your machine code version by poking the appropriate memory locations with the corresponding values: POKE 64888,205 [ENTER]. POKE 64889,58 [ENTER]. POKE 64890,255 [ENTER]….SAVE this to tape with: SAVE “CK TYPE” CODE 64888,460 [ENTER]. To use, LOAD the BASIC program you wish to check, LOAD “CK TYPE” CODE 64999,460 and run with RAMDOMIZE USR 64888 [ENTER].

I hope that CK TYPE is widely used in the TS2068 community as a way of easing the pain associated with typing in program listings! (Editor’s Note: Please pass the word around about CK-TYPE, especially those of you connected with TS user groups and newsletters. Stan has come up with a standard that is common in many other PC magazines. Additional copies of this magazine can be purchased by those interested in CK TYPE for just $3 postage paid each.)

Listing A

9987 REM ! LIST
9988 REM ! LPRINT
9989 REM !INT +START,STOP,BYT,LINE,LENGTH,SUM,ODD,I
9990 REM ! OPEN #
9991 LET start=256*PEEK 23636+PEEK 23635: LET stop=256*PEEK 23628+PEEK 23627: LET byt=start
9992 LET line=0: LET length=0: LET sum=0
9993 LET line=256*PEEK byt+PEEK (byt+1): LET byt=byt+2
9994 LET length=256*PEEK (byt+1)+PEEK byt: LET byt=byt+2
9995 LET odd=1: FOR i=1 TO length: LET sum=sum+(odd+1)*PEEK byt: LET odd=NOT odd: LET byt=byt+1: NEXT i
9996 PRINT line;TAB 6;": ";length;TAB 13;": ";sum
9997 LPRINT line;TAB 6;": ";length;TAB 13;": ";sum
9998 IF byt<stop THEN GO TO 9992
9999 STOP

Listing B

9987  : 4    : 994
9988  : 4    : 962
9989  : 41   : 4728
9990  : 4    : 936
9991  : 96   : 8966
9992  : 43   : 4166
9993  : 53   : 5151
9994  : 55   : 5569
9995  : 89   : 10304
9996  : 46   : 4502
9997  : 46   : 4460
9998  : 22   : 2843
9999  : 2    : 465

Listing C

LINE 9990:  +0
LINE 9990:  64888 #FD78

RT20       65249 #FEE1
RT31       65257 #FEE9
RT47       65263 #FEEF
RT91       65275 #FEFB
RT104      65283 #FF03
RT111      65323 #FF2B
RT123      65331 #FF33
RT124      65338 #FF3A
RT125      65343 #FF3F
start...... POSINT     65348 #FF44
stop....... POSINT     65350 #FF46
byt........ POSINT     65352 #FF48
line....... POSINT     65354 #FF4A
length..... POSINT     65356 #FF4C
sum........ POSINT     65358 #FF4E
odd........ POSINT     65360 #FF50
i.......... POSINT     65362 #FF52

TIME MACHINE ©1986 Cameron Hayne

M/C: 460 BYTES
+ 20 BYTES FOR M/C VARIABLES
(BASIC WAS 557 BYTES)

SAVE "m/c"CODE 64888,460
LOAD "m/c"CODE 64888

Listing D

64888   205   58    255   33    68
64893   255   34    108   92    33
64898   0     1     229   33    84
64903   92    110   38    0     209
64908   205   3     255   229   33
64913   83    92    110   38    0
64918   209   25    34    68    255
64923   33    0     1     229   33
64928   76    92    110   38    0
64933   209   205   3     255   229
64938   33    75    92    110   38
64943   0     209   25    34    70
64948   255   42    68    255   34
64953   72    255   33    0     0
64958   34    74    255   33    0
64963   0     34    76    255   33
64968   0     0     34    78    255
64973   33    0     1     229   42
64978   72    255   110   38    0
64983   209   205   3     255   229
64988   42    72    255   35    110
64993   38    0     209   25    34
64998   74    255   42    72    255
65003   35    35    34    72    255
65008   33    0     1     229   42
65013   72    255   35    110   38
65018   0     209   205   3     255
65023   229   42    72    255   110
65028   38    0     209   25    34
65033   76    255   42    72    255
65038   35    35    34    72    255
65043   33    1     0     34    80
65048   255   33    1     0     34
65053   82    255   229   42    76
65058   255   34    84    255   225
65063   195   89    254   42    78
65068   255   229   42    80    255
65073   35    229   42    72    255
65078   110   38    0     209   205
65083   3     255   209   25    34
65088   78    255   42    80    255
65093   205   251   254   34    80
65098   255   42    72    255   35
65103   34    72    255   42    82
65108   255   35    34    82    255
65113   237   91    84    255   235
65118   167   237   82    210   42
65123   254   42    74    255   205
65128   233   254   33    6     0
65133   205   51    255   205   239
65138   254   2     0     58    32
65143   42    76    255   205   233
65148   254   33    13    0     205
65153   51    255   205   239   254
65158   2     0     58    32    42
65163   78    255   205   233   254
65168   62    13    215   205   63
65173   255   42    74    255   205
65178   233   254   33    6     0
65183   205   51    255   205   239
65188   254   2     0     58    32
65193   42    76    255   205   233
65198   254   33    13    0     205
65203   51    255   205   239   254
65208   2     0     58    32    42
65213   78    255   205   233   254
65218   62    13    215   205   58
65223   255   42    72    255   237
65228   91    70    255   205   225
65233   254   124   181   194   187
65238   253   33    22    43    217
65243   201   33    22    43    217
65248   201   175   237   82    103
65253   111   208   44    201   205
65258   43    255   195   161   49
65263   225   78    35    70    35
65268   84    93    9     229   195
65273   219   33    125   180   33
65278   0     0     192   44    201
65283   62    32    187   56    13
65288   122   167   32    9     67
65293   235   108   184   200   25
65298   16    253   201   77    68
65303   33    0     0     62    15
65308   203   35    203   18    48
65313   1     9     41    61    32
65318   245   178   240   9     201
65323   175   95    85    76    71
65328   195   116   46    62    23
65333   215   125   215   215   201
65338   62    2     195   48    18
65343   62    3     195   48    18

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