TS-2068 Data Input

Publication

Pub Details

Date

Pages

BASIC Terms

See all articles from Update April 1989

A utility for: data base generation, keyboard reading, character concatenation, screen display, full editing

This is an audacious attack upon the most famous weaknesses of the TS-2068, slow data input and poor screen editing. The result is a INPUT SECTION of programming that can be used for many purposes. Programmers have overcome the problems mentioned by developing their own independently running Machine Code in RAM. Such softwares as Mscript, Tasword, and ProFile, do a nice job of Display Control and Data generation, but at great cost of FREE memory. These code utilities are proprietary. Even if their use were free, they would lack the flexibility for user applications.

Generally, there has been a tendency by programmers to NOT use the inherent abilities of the TS-2068 for DATA MANAGEMENT. The “TS-2068’s way” is to control data in the variable area of memory. Most programmers develop an independent control system for data, using machine code to place the data into high RAM, edit the data, etc. While this may be somewhat faster, and more efficient for ‘some’ functions, it is redundant and FREE Memory is reduced by the amount of code used.

We TS-2068 users have never had a flexible, easy to use utility for “Input Data Control”. Look back all you want into Sync, Syntax, and existing magazines. The cupboard is bare.

TS-2068 DATA INPUT is a utility that does all of the functions listed in the above title. Moreover, these functions are done “the TS-2068 way”, using the Variable file. This allows easy flexibility for using the utility in almost any Basic Program to enhance typing input and editing.

DATA INPUT takes advantage of the ROM routine “K-STATE” for fast keyboard reading. The display management is done using Systems Variable SPOSEN, which stores the X,Y coordinates of the “next print position” in two addresses. Then each key touched is printed to screen and concatenated to a typing buffer. The typing buffer is the simple string “U$”.

We will now take a look at the “Nucleus” of the Data Input utility, which are two routines in Basic.

The SPOSEN ROUTINE: The purpose is to display the last 148 characters of U$ to screen and to establish tracking variables. A=vert print position. B=horiz print position. A1=LEN U$ in the beginning and will be changed to track the cursor so that A1=the U$ chr number to the left of the cursor. The SPOSN routine needs to be used only once upon entry of the PEEK K-STATE typing input routine.

  SPOSEN
100 IF LEN U$<= 148 THEN PRINT AT 0,0;U$;
102 IF LEN U$>148 THEN PRINT AT 0,0;U$(LEN U$-148 TO);
104 LET A=24-PEEK 23689: LET B=33-PEEK 23688: IF B=32 THEN LET B=0: LET A=A+1
106 LET A1=LEN U$

Lines 100 and 102 in the above routine is for a 32 column screen. Replace “LET A=24-” with “48”, and “LET B=65-” for an implemented 64 column screen.

Next, the PEEK K-STATE routine to read the keyboard. K-STATE is first POKED to its active status. Then the ROM routine reads the keyboard until a key is touched, then the Character code is assigned to var “c”. If the CHR code is less than 32 the key read loop is escaped from to line 158 (EDIT). If not, the character is concatenated to U$, printed on screen, a Cursor is printed, and the SPOSEN vars are incremented. GO TO 150 gets the next character.

  K-STATE Routine
150 POKE 23611,220
151 IF PEEK 23611<221 THEN GO TO 151
152 LET C=PEEK 23560: IF C<32 THEN GO TO 158
153 LET U$=U$+CHR$ C:PRINT AT A,B;CHR$ C;"_";
154 LET B=B+1:LET A1=A1+1: IF B=32 THEN LET B=0:LET A=A+1
155 GO TO 150
158 STOP:REM See the program TS-2068 DATA INPUT for the complete, ready to use, utility.

While the above two routines are fairly fast, and I have used them for years in the Smart Text software, a typing speed greater than about 40 words per minute can over-ride the input. The K-STATE loop is slowed by the basic programming to concatenate, the LETS, and the IF THEN escape. So, I ask Mr. Don Lamen, SINCUS, to provide a Machine Code clone of these two basic utilities. The next 4 pages comprise Don’s MC utility and its documentation. Don’s MC utility “Concat” does everything that the SPOSEN and K-STATE Basic utilities do; using only 196 bytes of code. So, we put the code in the printer buff area, starting at address 23296. This left me the task of developing a FULL EDIT function to begin at basic line 158. After Don’s code is explained, the whole BASIC utility “TS-2068 Data Input” will be listed and commented upon. Once Don’s code is installed in the Print Buff, just one Basic line is needed to replace all of the lines of programming of the SPOSN and PEEK K-STATE routines. That line will be <150 RANDOMIZE USR 23334>


** CONCATENATION **

Dear Bill,

Here is the machine code routine that I came up with in response to your letter of Nov. 30, 1988.

On the B side of this tape is a Demo program containing the actual machine code routine, support sub-routines and supporting BASIC lines. I have put several STOPs in the BASIC to allow you to follow the various steps.

This text file consists of five parts as follows:

  1. The BASIC support.
  2. The Machine Code Entry Points.
  3. The Assembly Listing.
  4. A HEX Dump of the Machine Code.
  5. A DEC Dump of the Machine Code.

BASIC Support

   1 REM * CONCATENATION *   V 1.0
by Don Lamen, SINCUS 12-14-88

2 REM ** DO NOT USE PRINTER **

3 REM * For a Demo GO TO 998 **

150 REM ** CONCATENATE **
151 RANDOMIZE USR 23399
152 STOP
153 REM
157 REM * EDIT AND/OR PRINT VARIABLES *
158 STOP: LET A = PEEK 23299: LET B = PEEK 23298: LET C = PEEK 23300: LET A1 = PEEK 23296 + 256 * PEEK 23297: STOP
159 PRINT ''"A (LIN): ";A'"B (COL): ";B'"C (CHR): ";C;" ("; CHR$ C;")"''"A1 ( LEN U$): ";A1: STOP
160 GO TO 151
996 REM
997 REM ** INITIALIZE U$ **
998 LET U$ = ""
999 REM ** CLS AND PRINT LAST 148 CHRS. **
1000 RANDOMIZE USR 23334
1001 STOP
1002 LOAD "Concat" CODE
1003 LIST

Machine Code Entry Points

(23296) 5B00      VAR1  ; LEN U$
(23298) 5B02      VAR2  ; (SPOSN)  LO: COL / HI: LIN
(23300) 5B04      VAR3  ; CHAR. CODE

Assembly Listing

                09                  ADD HL, BC     ; End of U$
                A7                  AND A          ; RES Carry Flag
                ED52                SBC HL, DE     ; Go back 148
                EB                  EX DE, HL      ; DE -> 1st Char.
                44                  LD B, H          to be printed.
                4D                  LD C, L        ; 148 bytes
(23367) 5B47    CDDB21     PRINT:   CALL 21DB, PR-STRING
                ED4B885C            LD BC, (SPOSN)
                3E18                LD A, 18       ; 24 dec.
                90                  SUB B
                47                  LD B, A
                3E21                LD A, 21       ; 33 dec.
                91                  SUB C
                4F                  LD C, A
                FE20                CP 20          ; New line?
                2003                JR NZ, STORE
                0E00                LD C, 00       ;
                04                  INC B
(23389) 5B5D    ED43025B   STORE:   LD (VAR2),BC   ; Store Param.
                CD185B              CALL 5B18, PR-AT
                3E5F                LD A, 5F       ; Cursor
                D7                  RST 10         ; Print Cursor

                                          65 bytes


ENTRY POINT 2: (CONCATENATE)

(23399) 5B67    3A3B5C     CONCAT:  LD A, (FLAGS)
                FEDD                CP DD          ; 221 dec.?
                38F9                JR C, CONCAT   ; Wait for Key
                3A085C              LD A, (LAST K)
                5F                  LD E, A        ; Save Char. in E
                3EDC                LD A, DC       ; 220 dec.
                323B5C              LD (FLAGS), A
                7B                  LD A, E        ; Char.
                FE20                CP 20          ; Is it < 32 dec.
                300A                JR NC, CONT    ; No! It is OK
                219E00              LD HL, 009E    ; If < 32 dec. GO
                                                     TO Line 158 in
                                                     BASIC.
(23423) 5B7F    CDD616              CALL 16D6, LINE-ADDR
                22555C              LD (NXTLIN), HL
                C9                  RET
(23430) 5B86    32045B     CONT:    LD (VAR3), A   ; Save Char.
                CD055B              CALL 5B05, FIND-U$
                23                  INC HL
                4E                  LD C, (HL)
                34                  INC (HL)
                23                  INC HL
                46                  LD B, (HL)
                2001                JR NZ, ADVAN
                34                  INC (HL)
                09         ADVAN:   ADD HL, BC     ; HL -> Last Char
                CDB812              CALL 12B8, ONE-SPACE
(23448) 5B98    3A045B              LD A, (VAR3)   ; Get Char.
                23                  INC HL
                23                  INC HL
                77                  LD (HL), A     ; Add it to U$
(23454) 5B9E    ED4B025B   PR-2:    LD BC, (VAR2)
                CD185B              CALL 5B18, PR-AT
                3A045B              LD A, (VAR3)   ; Get Char.
                D7                  RST 10         ; Print it to the
                                                     Screen.
                3E5F                LD A, 5F       ; Cursor
                D7                  RST 10         ; Print Cursor
(23468) 5BAC    2A025B              LD HL, (VAR2)
                2C                  INC L
                7D                  LD A, L
                FE20                CP 20          ; Is it 32 dec.?
                2003                JR NZ, UPDATE
                2E00                LD L, 00
                24                  INC H
(23480) 5BB8    22025B     UPDATE:  LD (VAR2), HL  ; 'AT' Parameter
                2A005B              LD HL, (VAR1)  ; LEN U$
                23                  INC HL
(23487) 5BBF    22005B              LD (VAR1), HL
(23490) 5BC2    18A3                JR CONCAT
                                          93 bytes
                          ______________________________
                          TOTAL NUMBER OF BYTES = 196

Hex Dump

CONCAT                                                    CHECKSUM

(23296)   00  00  00  00  00  2A  4B  5C                      D1
(23304)   7E  FE  55  C8  CD  20  17  EB                      88
(23312)   18  F6  CD  A6  08  01  00  00                      8A
(23320)   21  3B  5C  CB  8E  21  3C  5C                      CA
(23328)   CB  86  CD  B2  05  C9  CD  12                      7D
(23336)   5B  CD  05  5B  23  4E  23  46                      62
(23344)   ED  43  00  5B  23  EB  21  94                      4E
(23352)   00  A7  ED  42  09  30  08  EB                      02
(23360)   09  A7  ED  52  EB  44  4D  CD                      38
(23368)   DB  21  ED  4B  88  5C  3E  18                      6E
(23376)   90  47  3E  21  91  4F  FE  20                      34
(23384)   20  03  0E  00  04  ED  43  02                      67
(23392)   5B  CD  18  5B  3E  5F  D7  3A                      49
(23400)   3B  5C  FE  DD  38  F9  3A  08                      E5
(23408)   5C  5F  3E  DC  32  3B  5C  7B                      19
(23416)   FE  20  30  0A  21  9E  00  CD                      E4
(23424)   D6  16  22  55  5C  C9  32  04                      BE
(23432)   5B  CD  05  5B  23  4E  34  23                      50
(23440)   46  20  01  34  09  CD  B8  12                      3B
(23448)   3A  04  5B  23  23  77  ED  4B                      8E
(23456)   02  5B  CD  18  5B  3A  04  5B                      36
(23464)   D7  3E  5F  D7  2A  02  5B  2C                      FE
(23472)   7D  FE  20  20  03  2E  00  24                      10
(23480)   22  02  5B  2A  00  5B  23  22                      49
(23488)   00  5B  18  A3                                      16

Total BYTES = 196

Dec-Dump

CONCAT                                        CHECKSUM

(23296)     0     0     0     0     0              0
(23301)    42    75    92   126   254            589
(23306)    85   200   205    32    23            545
(23311)   235    24   246   205   166            876
(23316)     8     1     0     0    33             42
(23321)    59    92   203   142    33            529
(23326)    60    92   203   134   205            694
(23331)   178     5   201   205    18            607
(23336)    91   205     5    91    35            427
(23341)    78    35    70   237    67            487
(23346)     0    91    35   235    33            394
(23351)   148     0   167   237    66            618
(23356)     9    48     8   235     9            309
(23361)   167   237    82   235    68            789
(23366)    77   205   219    33   237            771
(23371)    75   136    92    62    24            389
(23376)   144    71    62    33   145            455
(23381)    79   254    32    32     3            400
(23386)    14     0     4   237    67            322
(23391)     2    91   205    24    91            413
(23396)    62    95   215    58    59            489
(23401)    92   254   221    56   249            872
(23406)    58     8    92    95    62            315
(23411)   220    50    59    92   123            544
(23416)   254    32    48    10    33            377
(23421)   158     0   205   214    22            599
(23426)    34    85    92   201    50            462
(23431)     4    91   205     5    91            396
(23436)    35    78    52    35    70            270
(23441)    32     1    52     9   205            299
(23446)   184    18    58     4    91            355
(23451)    35    35   119   237    75            501
(23456)     2    91   205    24    91            413
(23461)    58     4    91   215    62            430
(23466)    95   215    42     2    91            445
(23471)    44   125   254    32    32            487
(23476)     3    46     0    36    34            119
(23481)     2    91    42     0    91            226
(23486)    35    34     0    91    24            184
(23491)   163                                    163

Total number of bytes = 196

TS-2068 Data Input, Typing Input To Screen With Full Edit

The listing below is set with the author’s handwritten annotations in the right-hand margin; those are given as a separate table after the listing.

100 REM * TS-2068 DATA INPUT *
Donated to Public Domain by---
UPDATE Magazine and Don Lamen, SINCUS.

140 INK 7: PAPER 0: BORDER 0: CLS : RANDOMIZE USR 100: OPEN #4,"dd": RANDOMIZE USR 100: LOAD "concat.C1"CODE : RANDOMIZE USR 100: OPEN #3,"lp": RANDOMIZE USR 100: POKE 16096,0: RANDOMIZE USR 100: POKE 16092,0: LPRINT : LET u$=""

150 RANDOMIZE USR 23334
158 LET a=PEEK 23299: LET b=PEEK 23298: LET c=PEEK 23560: LET a1=PEEK 23296+256*PEEK 23297
159 IF c<>12 THEN GO TO 230
160 LET b=b-1: LET a1=a1-1: IF b=-1 THEN LET b=31: LET a=a-1: IF a=-1 THEN LET a=0
162 LET u$=u$( TO a1)+u$(a1+2 TO )
164 IF LEN u$<a1-b+1-a*32+404 THEN PRINT AT a,0;u$(a1-b+1 TO );
166 IF LEN u$>a1-b+1-a*32+403 THEN PRINT AT a,0;u$(a1-b+1 TO 404);
167 RANDOMIZE USR 23334
230 GO TO (c>31)*300+(c=7)*390+(c=8)*290+(c=9)*275+(c=10)*265+(c=11)*255+(c=12)*370+(c=13)*150+(c=14)*2926+(c<7)*2926
235 POKE 23611,220
238 IF PEEK 23611<221 THEN GO TO 238
240 LET c=PEEK 23560: POKE 23611,220
250 GO TO 230
255 LET a=a-1: LET a1=a1-32: IF a<0 THEN LET a=0: IF a1<b THEN LET a1=b
256 IF LEN u$<a1-b+1+404-a*32 THEN PRINT AT 0,0;u$(a1-b+1-a*32 TO );
257 IF LEN u$>a1-b+1+403-a*32 THEN PRINT AT 0,0;u$(a1-b+1-a*32 TO a1-b+1+404-a*32);
258 PRINT AT a,b; INVERSE 1; OVER 1;"_";: GO TO 235
265 LET a=a+1: LET a1=a1+32: IF a1+128>LEN u$ THEN PRINT AT a+2,0; FLASH 1;"To edit here Touch ENTER ": PAUSE 0: RANDOMIZE USR 23334
266 IF a>11 THEN LET a=12: PRINT AT 0,0;u$(a1-b+1-384 TO a1-b+96);
270 PRINT AT a,b; INVERSE 1; OVER 1;"_";: GO TO 235
275 LET a1=a1+1: LET b=b+1: IF b=32 THEN LET b=0: LET a=a+1: IF a>21 THEN LET a=a-1: LET b=31: LET a1=a1-1
280 IF A1>LEN U$ THEN LET A1=A1-1: LET B=B-1: IF B=-1 THEN LET B=31: LET A=A-1
285 PRINT AT a,b; OVER 1;"_";: GO TO 235
290 LET b=b-1: LET a1=a1-1: IF b=-1 THEN LET b=31: LET a=a-1: IF a=-1 THEN LET b=0: LET a=0: LET a1=a1+1
295 PRINT AT a,b; OVER 1;"_";: GO TO 235
300 LET u$=u$( TO a1)+CHR$ c+u$(a1+1 TO ): LET b=b+1: LET a1=a1+1: IF b=32 THEN LET b=0: LET a=a+1
301 IF LEN u$<a1-b+1+VAL "404"-a*32 THEN PRINT AT a,0;u$(a1-b+1 TO );
302 IF LEN u$>a1-b+1+403-a*32 THEN PRINT AT a,0;u$(a1-b+1 TO a1-b+1+404-a*32);
305 PRINT AT a,b; INVERSE 1; OVER 1;"_";: GO TO 235
370 LET b=b-1: LET a1=a1-1: IF b=-1 THEN LET b=31: LET a=a-1: IF a=-1 THEN LET a=0
372 PRINT AT a,b;" ";: LET u$=u$( TO a1)+u$(a1+2 TO )
374 IF LEN u$<a1-b+1-a*32+404 THEN PRINT AT a,0;u$(a1-b+1 TO );
376 IF LEN u$>a1-b+1-a*32+403 THEN PRINT AT a,0;u$(a1-b+1 TO 404);
378 PRINT AT a,b; OVER 1;"_";: GO TO 235
390 PRINT AT 19,0; INVERSE 1;"BLOCK INSERT"; INVERSE 0;" Type String, ENTER": INPUT z$: CLS : LET u$=u$( TO a1)+z$+u$(a1+1 TO ): RANDOMIZE USR 23334

The author’s marginal notes

Written by hand beside the listing, each with a leader line to the program line it annotates.

LineNote as written
140INITIALIZE LKDOS – LOAD CODE – INITIALIZE LKDOS Version 3 PRINTER POKE NO LINE FEED – POKE AERCO or Oliger INTERFACE – INITIALIZE u$ – The Typing buffer
150Turbo Typing — Run CODE Til BREAK out To Line 158
158get BASIC VARS From CODE
159IF NOT DELETE Chr 12
160IF Delete Chr 12
167BACK TO Turbo SPeed TyPing After Delete Last chr.
23010-IF THEN BRanches in Boolean Logic
235PEEK K STATE To Read Keyboard in BASIC
255CURSOR UP ↑ ARROW Action
265CURSOR Down ↓ ARROW action
275MOVE CURSOR RighT WiTh Right → ARROW KEY
290MOVE CURSOR LEFT WiTh LeFT ← ARROW KEY
300INSERT TyPing IN MiDST OF TexT
370INTERIOR DELETE IN MidST oF TexT
390BLOCK INSERT WiTh EdiT KEY aT The CURSOR POSITION.

TS-2068 Data Input

“DATA INPUT” provides a fast TURBO typing speed and data presentation on screen. The typed characters are collected in “U$” and called “the typing buffer”. The data length of the typing buffer is un-restricted. Any “un-printable” character entry, such as the arrow keys or EDIT will escape TURBO mode and enter the EDIT mode. If just a single character DELETE is done with the DELETE key, TURBO is re-entered. Otherwise, after EDITING, touch the ENTER key to re-enter TURBO mode.

Each time that TURBO is re-entered, the last 148 characters of the typing buffer (U$) is presented, giving 4 1/2 lines of text for orientation. The Arrow keys move the cursor up through the screen text for interior EDITING. UP ARROW will pull down earlier typed lines of text all the way to the first data line for editing.

The TURBO mode uses Don’s code by RANDOMIZE USR 23334 at line 150. During EDIT mode the second “PEEK K-STATE” (in BASIC) is used at line 235. The edit mode is slowed by the large number of IF THEN Conditionals in line 230. There are 10 IF THEN logicals expressed in Boolean for its faster CPU evaluation. Though the K-STATE loop is slower than the same loop in Machine Code, the EDIT mode does not need such speed.

For fast lengthy INSERTS within the text, a touch of EDIT provides BLOCK INSERT. Block insert uses the standard TS-2068 INPUT at screen bottom. This allows the INSERT of a string of typed characters, or one may erase the Quotes and enter a simple string or character array cell to BLOCK TRANSFER segments of other data bases. Example: To BLOCK INSERT data contained in “H$(3)” character array, just run the cursor up to the place to insert, then touch EDIT. Then erase the input quotes and enter H$(3). The BLOCK INSERT mode also allows the entry of graphics characters, which would not be possible to enter in any other mode.

In line 230, one of the conditionals is for the use of CAPS and SYM SHIFT together to ESCAPE and GO TO line 2926, which is not present. This line number is the QUICKIE MENU of the Smart Text Software. For Aerco FD-68 and LKDOS Smart Text owners, this DATA INPUT utility may be used to replace all program lines of Smart Text from 150 through 399. Oliger DOS owners need to re-locate the code to either high RAM or to the unused SYSCON addresses. For other uses, the line number for ESCAPE may be changed from 2926 to the appropriate program line number.

Line number 140 is given only to allow the utility to work as stand alone. This line may be omitted when DATA INPUT is used with another program that initializes a DOS with a printer driver. Somewhere early in the program the “concat.C1″CODE must be loaded. This code is SAVED at address 23296 <SAVE “concat.C1″CODE 23296,196> and is 196 bytes in length. This is in the TS-2040 Print Buffer area.7

The code in the print buff will be wiped out by the command LPRINT if there is no Centronics Printer Driver code resident in the system. However, after printing data with the TS-2040, the code may be re-loaded by <LOAD “concat.C1″CODE>. Then <GO TO 150>. The only requirement for the code is that U$ must either be initialized or already contain data. <LET U$=””> will do it.


Appendix: the missing section of the assembly listing

This section is not in the magazine. It is a reconstruction, disassembled from the article’s own hex and decimal dumps, and it is set apart here so that nothing in it is mistaken for what the page printed.

The article’s assembly listing begins at address 23360, part-way through a routine, and never prints the 64 bytes from 23296 to 23359. Those bytes hold the three variables, three subroutines, and the whole of ENTRY POINT 1 — the entry point that 150 RANDOMIZE USR 23334 actually calls. Two of the omitted subroutines are called by name from the listing that is printed, so a reader following the printed code reaches CALL 5B05, FIND-U$ and CALL 5B18, PR-AT with nowhere to look them up.

The bytes survive intact in the hex dump and the decimal dump, which agree with each other throughout, so the code below is recoverable with certainty. The label names FIND-U$ and PR-AT are the article’s own, taken from the CALL comments in the printed listing. Three ROM addresses are called here that the article never names — 1720, 08A6 and 05B2 — and they are left unnamed rather than guessed at, since these are TS-2068 ROM entry points and do not carry their Spectrum names.

(23296) 5B00    0000       VAR1:    DEFW 0000      ; LEN U$
(23298) 5B02    0000       VAR2:    DEFW 0000      ; (SPOSN) LO: COL / HI: LIN
(23300) 5B04    00         VAR3:    DEFB 00        ; CHAR. CODE

(23301) 5B05    2A4B5C     FIND-U$: LD HL,(5C4B)   ; VARS - start of variables
(23304) 5B08    7E                  LD A,(HL)      ; variable's name byte
(23305) 5B09    FE55                CP 55          ; 85 - a string named "u"
(23307) 5B0B    C8                  RET Z          ; found it; HL -> name byte
(23308) 5B0C    CD2017              CALL 1720      ; step past this variable
(23311) 5B0F    EB                  EX DE, HL
(23312) 5B10    18F6                JR 5B08        ; and keep looking

(23314) 5B12    CDA608              CALL 08A6      ; clear the screen
(23317) 5B15    010000              LD BC,0000     ; print position 0,0
                                                   ; falls through into PR-AT

(23320) 5B18    213B5C     PR-AT:   LD HL,5C3B     ; FLAGS
(23323) 5B1B    CB8E                RES 1,(HL)
(23325) 5B1D    213C5C              LD HL,5C3C
(23328) 5B20    CB86                RES 0,(HL)
(23330) 5B22    CDB205              CALL 05B2      ; set print position from BC
(23333) 5B25    C9                  RET


ENTRY POINT 1: (CLS AND PRINT LAST 148 CHRS.)

(23334) 5B26    CD125B              CALL 5B12      ; CLS and home the cursor
(23337) 5B29    CD055B              CALL 5B05      ; FIND-U$
(23340) 5B2C    23                  INC HL
(23341) 5B2D    4E                  LD C, (HL)     ; LEN U$, low byte
(23342) 5B2E    23                  INC HL
(23343) 5B2F    46                  LD B, (HL)     ; LEN U$, high byte
(23344) 5B30    ED43005B            LD (VAR1), BC  ; store LEN U$
(23348) 5B34    23                  INC HL         ; HL -> 1st character
(23349) 5B35    EB                  EX DE, HL      ; DE -> 1st character
(23350) 5B36    219400              LD HL,0094     ; 148
(23353) 5B39    A7                  AND A
(23354) 5B3A    ED42                SBC HL, BC     ; carry set if LEN U$ > 148
(23356) 5B3C    09                  ADD HL, BC     ; restore HL = 148
(23357) 5B3D    3008                JR NC, PRINT   ; LEN <= 148: print all of it
(23359) 5B3F    EB                  EX DE, HL      ; LEN > 148: HL -> 1st char,
                                                   ;            DE = 148

                    [ the printed listing resumes here, at 23360 ]

Two things corroborate the reconstruction beyond the byte-level agreement of the two dumps. The comparison at 5B09 is against 85, which is exactly the name byte the TS-2068 writes for a string variable called u, confirming that this routine is the FIND-U$ the printed listing calls. And the arithmetic from 23334 to 23366 reproduces the SPOSEN routine on page 12 exactly: where LEN U$ is 148 or less it hands the whole string to PR-STRING, matching line 100, and where it is greater it hands over the last 148 characters, matching line 102. Both branches were checked against those two BASIC lines for every length from 0 to 300 and agree at every one, including at the 148 boundary where the branch is decided.

The section lengths the article states also fall out exactly. ENTRY POINT 1 runs from 23334 to 23398, which is the 65 bytes printed beneath it; ENTRY POINT 2 runs from 23399 to 23491, which is 93; and the variables and shared subroutines occupy the remaining 38. Together, 196.

Products

 

Media

 

Image Gallery

Source Code

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

Scroll to Top