Screen Handling CHR$() functions

Popular in previous forums place your programming snippets here
Post Reply
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

Screen Handling CHR$() functions

Post by Martin »

Hi All

Recently revisited the CHR$() functions (manual extract below) particularly in relation to screen handling.

CHR$(26)
This works well on an LZ, by printing the variable then clearing anything else off the line.

Code: Select all

AT 1,2 : PRINT variable;CHR$(26);
AT :PRINT
But what about adding the AT and PRINT into a user defined function.

AP:(1,3,"some text")

Code: Select all

AP:(x%,y%,txt$)
AT x%,y% :Print txt$;
RETURN
CM/XP CHR$(26) function
ON a CM/XP you can simulate the CHR$(26) clear to the end of a line function, by.

BL:(2,"some text")

Code: Select all

BL:(y%,txt$)
AT 1,y% :PRINT txt$+REPT(" ",16-LEN(tst$));
RETURN

Always sincere
Martin

----------------------------------------------------------------------------------------------------
Manual Extract
Control characters For the screen, the numbers 8 to 26 have special uses. They do not produce a visible character, but may be used in conjunction with the PRINT command produce the effects listed below. For example, on an LZ, the instruction PRINT CHR$(22) clears the 3rd line of the screen.

CHR$(8) Moves the cursor 1 character to the left.
CHR$(9) Moves the cursor to the next tab position. (Position 0 and 10 on the screen.)
CHR$(10) Moves the cursor to the next line.
CHR$(11) Moves the cursor to the top left "home" position of the display.
CHR$(12) Clears the display (equivalent to CLS).
CHR$(13) Moves the cursor to the left of the current line.
CHR$(14) Clears the top line of the display, and moves cursor to start of line.
CHR$(15) Clears the second line of the display, and moves cursor to start of line.
CHR$(16) Sounds the Organiser's buzzer.
---- Introduced with Model LZ/LZ64 --------------------------------------------------------
CHR$(17) Refreshes the 1st and 2nd line.
CHR$(18) Refreshes the 1st line.
CHR$(19) Refreshes the 2nd line.
CHR$(20) Refreshes the 3rd line.
CHR$(21) Refreshes the 4th line.
CHR$(22) Clears the 3rd line of the display, and moves cursor to start of line.
CHR$(23) Clears the 4th line of the display, and moves cursor to start of line.
CHR$(24) Prints dashes, like the ones above a multi-line menu, on the 2nd line. (uses UDG 2.)
CHR$(25) Prints dots, like the ones above a one-line menu, on the 3rd line. (uses UDG 2.)
CHR$(26) Clears to the end of line.

CHR$(27) to CHR$(31) are reserved.
Daren
Posts: 58
Joined: Tue Jan 03, 2023 10:03 pm

Re: Screen Handling CHR$() functions

Post by Daren »

Funny enough just last week I was reading about these in the programming manual, very handy functions which I have yet to use but have a few ideas for now. I will post some things in the thread once I have done something.
Post Reply