CURSOR

This file is part of and CATS Library Tape 6. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Demo

Will teach you how to put other symbols inside the 2068 flashing cursor.

This program demonstrates the effect of POKE 23617 on the input cursor appearance. System variable 23617 (ATTR P) controls the current paper and ink attributes, and by poking different values into it the cursor character displayed during INPUT changes its visual style. The program cycles through seven attribute values — 142, 158, 160, 164, 224, 240, and 254 — reading them from a DATA statement and using an INPUT prompt to pause so the user can observe each cursor variant. The INPUT line uses a suppressed variable trick with an empty string literal and a dummy string variable to hold keystrokes without acting on them meaningfully.


Program Analysis

Program Structure

The program is short and linear, falling into three logical phases:

  1. Lines 1–2: Display an introductory message and wait for a keypress using the IF INKEY$="" THEN GO TO 2 polling idiom.
  2. Lines 3–30: Clear the screen, then loop seven times, each iteration poking a new value into address 23617 and pausing via INPUT so the user can observe the cursor.
  3. Line 40: A DATA statement holding the seven attribute byte values to be demonstrated.

System Variable 23617 (ATTR P)

Address 23617 is the system variable ATTR P, which holds the current permanent paper/ink/bright/flash attribute byte used for PRINT and INPUT operations. Changing it before an INPUT statement causes the cursor displayed during input to take on a different color combination or flash state, which is the visual effect this program illustrates.

The seven values used and their decoded attributes are:

ValueBinaryFlashBrightPaperInk
1421000111010001110
1581001111010011110
1601010000010100000
1641010010010100100
2241110000011100000
2401111000011110000
2541111111011111110

All seven values have the flash bit set (bit 7 = 1), meaning all demonstrated cursors will flash. The selection covers a range of paper and ink color combinations, with the final value 254 giving white paper, yellow ink, bright, and flash.

Key BASIC Idioms

  • Keypress wait: Line 2 uses IF INKEY$="" THEN GO TO 2, a standard busy-loop polling technique to wait for any key before proceeding.
  • READ/DATA loop: Lines 10–30 use FOR/NEXT with READ a to consume successive values from the DATA statement at line 40, a compact way to iterate over a fixed list.
  • INPUT with displayed expression: The prompt INPUT "The value is ";(a);"";a$ uses the (a) form inside an INPUT statement to print the current numeric value of a as part of the prompt, then collects a keypress into the dummy string variable a$. The empty string literal "" between the expression and the variable is syntactically required to separate the displayed items from the input variable.

Notable Techniques

Reusing the variable name a both as the READ target and as the displayed value inside the INPUT prompt is economical. Because (a) is evaluated before the cursor appears, the poked attribute is already in effect when the cursor is drawn, correctly demonstrating the new cursor style. After the user types and presses Enter, a is overwritten by the READ on the next iteration, so the dummy a$ is used to absorb the actual keypress without interfering with the loop variable.

Potential Anomalies

  • After the loop ends, ATTR P (23617) is left set to 254 (white/yellow/bright/flash), which will affect any subsequent PRINT or INPUT output in the same session. The program makes no attempt to restore the original attribute value.
  • The INPUT accepts any string (including multi-character input), but since a$ is simply discarded, this has no adverse effect beyond cosmetics.
  • Line 5 is a REM statement placed between line 3 (CLS) and line 10 (FOR), which is harmless but slightly unusual ordering (the title REM appears after execution has already begun rather than at the top of the program).

Content

Appears On

Capital Area Timex Sinclair User Group’s Library Tape.

Related Products

Related Articles

Related Content

Image Gallery

CURSOR

Source Code

    1 PRINT "This is a demo of POKE 23617,   which changes the symbol seen inthe cursor.": PRINT : PRINT "    Press any key to begin."
    2 IF INKEY$="" THEN GO TO 2
    3 CLS 
    5 REM CURSOR CHANGER
   10 FOR f=1 TO 7: READ a
   20 POKE 23617,a: INPUT "The value is ";(a);"";a$
   30 NEXT f
   40 DATA 142,158,160,164,224,240,254

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

People

No people associated with this content.

Scroll to Top