[Coco] Navigating around a 32 column screen.

Allen Huffman alsplace at pobox.com
Fri Jan 27 11:52:53 EST 2023


> On Jan 27, 2023, at 10:48 AM, coco--- via Coco <coco at maltedmedia.com> wrote:
> 
> To All
> 
> Wanted to know if there is a way to reposition the text cursor to anywhere
> on a 32  column screen also is there a way to poke arbitrary text to a
> specific spot on the screen and is there anything in RS-DOS that is the
> equivalent of inkey in basic09 ?
> 
> I have an idea for a hex editor and to avoid it being one line at I time
> these capabilities would be required. Haven't done much Disk Basic
> programing lately.

Two approaches:

1) POKE to the screen memory (1024-1536). Some character POKE values will not match CHR$() PRINT values.

2) PRINT@ to a screen location (0-511). You cannot PRINT@ to the bottom right of the screen as it will make everything scroll, and anything you PRINT@ to the bottom line needs a semicolon at the end to avoid scrolling the entire line, as well.

INKEY$ works — directly or through a variable.

100 IF INKEY$=“” THEN 100

100 A$=INKEY$:IF A$=“” THEN 100
110 IF A$=“K” THEN…
120 IF A$=“L” THEN…

More advanced, is using INSTR() to locate a character in a string, and use that position for ON GOTO.

100 A$=INKEY$:IF A$=“” THEN 100
110 A=INSTR(A$,”ABCDEF”):ON A GOTO 200,300,400,500,600,700
…
200 ‘A
300 ‘B
400 ‘C
…etc…

You could also do ON GOSUB and then RETURN from the routines rather than having to GOTO back, if speed is important.




More information about the Coco mailing list