C-128 Screen Editor Escape and Control Sequences

Started by Blacklord, October 17, 2006, 09:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blacklord

The C-128's screen editor system is much more comprehensive than that
 of previous PET/CBM computers.  Whereas the older screen editors provided
 only minimal operations, the C-128's screen editor has over 30 special
 functions that make editing a program (or text, for that matter) a breeze.
 Through the use of the ESC key in combination with another character, a
 user can execute such complex screen-editing operations as line insertion
 or deletion, partial line or screen erasures, cursor selection, and tab
 settings.  Most of these functions, except where noted, apply to both the
 80- and 40-column text screens.   Screen editor escape sequences save
 programming time for BASIC 7.0 and machine language programmers, too.  The
 escape code --CHR$(27) in BASIC 7.0-- can be included along with another
 character within a string; when the string is printed to the screen, the
 desired editing action occurs.  For example, the simple string CHR$(27) +
 "@" ($1B$40 in hexadecimal) erases the screen, starting at the current
 cursor position.  It is much quicker, and shorter than a BASIC loop like
 FOR I=S TO 2023:  POKE I,0: NEXT.  Such simplifications make the C-128's
 BASIC 7.0 a very effective programming language, because the screen editor
 routines do much of the programmer's work.  C-128 programs therefore don't
 necessarily require the rigor and tedium of machine-code programming.  
 Besides these escape functions, the C-128 screen editors also use several
 control characters that engage special functions.  The descriptions of
 these screen editor codes often refer to logical and physical screen lines.  
 A physical screen line is simply one actual line, 40 or 80 columns,
 depending on which editor is currently being used.  In contrast, a logical
 line refers primarily to lines displayed by the BASIC LIST command.  These
 lines can be either one or two physical lines long in 80-column mode, or
 up to four physical lines long in 40-column mode.  Many editor escape
 sequences operate on logical lines and may actually affect several physical
 lines, especially when dealing with lines of BASIC 7.0 text.  However, text
 printed to the screen can usually be regarded solely in terms of physical
 lines.

                 Editor Escape Sequences

ESC-A    decimal 27,65  hex $1B,$41  :  The ESC-A sequence enables
auto-insert mode.  When auto-insert is enabled, every time a character
is entered in the middle of a screen line all characters are moved to the
right one position.  This mode is disabled by ESC-C.

ESC-B   decimal 27,66  hex $1B,$42 :  The ESC-B sequence sets the bottom of
the current screen window at the current cursor position.  When defining a
screen window using ESC sequences, an ESC-B sequence sets the current cursor
position as the lower right corner of the desired window. If the cursor
position is not in the proper column when an ESC-B is generated, the window
will not be of the proper width.

ESC-C  decimal 27,67  hex $1B,$43 : The ESC-C sequence merely turns off the
auto-insert mode enabled by ESC-A.

ESC-D  decimal 27,68  hex $1B,$44 : The ESC-D sequence deletes the line on
which the cursor is currently positioned.  When a BASIC listing is being
edited, ESC-D keystrokes will delete a complete line of BASIC text from the
screen.  The ESC-D does not delete the line from the program resident in
memory, but merely removes it from the current screen display.

ESC-E  decimal 27,69  hex $1B,$45 : The ESC-E sequence disables cursor
flashing.  The cursor then appears as a solid block.

ESC-F  decimal 27,70  hex $1B,$46 : The ESC-F sequence enables cursor
flashing.

ESC-G decimal 27,71  hex $1B,$47 : The ESC-G sequence allows a "bell" tone
to be generated whenever ESC-G is encountered.  The tone emanates from the
monitor or television, as the C-128 has no internal sound producing device.

ESC-H decimal 27,72  hex $1B,$48 : The ESC-H sequence disables the
production of a bell tone whenever an ESC-G is encountered.

ESC-I decimal 27,73  hex $1B,$49 : The ESC-I sequence inserts a blank line.  
The screen line containing the cursor is blanked, while the text of that
line is copied to the next screen line.

ESC-J decimal 27,74  hex $1B,$4A : The ESC-J sequence moves the cursor to
the start of the current logical screen line.  

ESC-K  decimal 27,75  hex $1B,$4B : The ESC-K sequence moves the cursor to
the end of the current logical screen line.

ESC-L  decimal 27,76  hex $1B,$4C : The ESC-L sequence enables text to be
scrolled off the screen.

ESC-M  decimal 27,77  hex $1B, $4D : The ESC-M sequence prevents text from
scrolling off the screen.  When this non-scroll mode is enabled, a line that
normally "pushes up" the rest of the text screen is instead displayed on
the top screen line.

ESC-N  decimal 27,78  hex $1B,$4E : The ESC-N sequence only applies to the
80-column screen.  It returns the screen to normal, disabling the
reverse-video screen display.

ESC-O  decimal 27,79  hex $1B,$4F : The ESC-O sequence cancels quote mode
(where cursor movements show up as special graphics characters within
strings), insert mode, and reverse-character mode.

ESC-P  decimal 27,80  hex $1B,$50 : The ESC-P sequence erases text from the
current cursor position to the beginning of the logical (not physical)
screen line.

ESC-Q  decimal 27,81  hex $1B,$51 : The ESC-Q sequence erases text from the
current cursor position to the end of the current logical line.

ESC-R  decimal 27,82  hex $1B,$52 : The ESC-R sequence applies only to
80-column screens.  This function "flips" the screen colors, exchanging the
background color for the character color.  ESC-N restores the screen to its
normal color sequence.

ESC-S  decimal 27,83  hex $1B,$53 : The ESC-S sequence applies to 80-column
screens.  This function causes the block cursor to be displayed.  The block
cursor can be changed to an underline cursor by using the ESC-U sequence.

ESC-T  decimal 27,84  hex $1B,$54 : The ESC-T sequence sets the top of the
current screen window at the current cursor position.  When a screen window
is being defined using ESC sequences, an ESC-T sequence defines the current
cursor position as the upper left corner of the desired window.

ESC-U  decimal 27,85  hex $1B,$55 : The ESC-U sequence causes the underline
cursor to be displayed; it applies only to 80-column screen.  The ESC-S
function will switch the cursor to a block.

ESC-V  decimal 27,86  hex $1B,$56 : The ESC-V sequence scrolls the screen up
one line.  Text scrolling off the top line of the screen is not recoverable
by executing the scroll-down function.

ESC-W  decimal 27,87  hex $1B,$57 : The ESC-W sequence scrolls the screen
down one line.  Text scrolling off the bottom of the screen is not
recoverable by executing the scroll-up function.

ESC-X  decimal 27,88  hex $1B,$58 : The ESC-X sequence toggles between
40- and 80-column video output.  It exchanges local screen editor variables
at $E0-$F9 with those saved at $0A40 ; the TAB stop and line-wrap bit maps
at $0354-$0361 are exchanged with those saved at $0A60.

ESC-Y  decimal 27,89  hex $1B,$59 : The ESC-Y sequence sets the default TAB
stops.  Each TAB is eight spaces.

ESC-Z  decimal 27,90  hex $1B,$5A : The ESC-Z sequence clears all TAB stops.  
When the TAB key is pressed  after an ESC-Z sequence has been generated,
one TAB keystroke will move the cursor to the end of the physical screen
line.

              Editor Control Characters

CTRL-B  decimal 2  hex $02 : The CTRL-B character applies only to the
80-column screen and turns on the 8563 underline attribute.  This
underlining can be disabled by a CHR$(130)(hex $82) character.

CTRL-G  decimal 7  hex $07 : The CTRL-G character corresponds to the ASCII
BEL character and produces a bell tone in the monitor's speaker when output
is enabled by the ESC-G sequence.  The bell tone output can be disabled
using the ESC-H sequence.

CTRL-I  decimal 9  hex $09 : The CTRL-I character TABs a preset number of
spaces to the right.  TABing will not overwrite lines of BASIC text with
spaces; each TAB stop can be set or cleared with the CTRL-X character.  
The ESC-Y sequence sets default TAB stops every eight spaces, while the
ESC-Z sequence clears all TAB stops.

CTRL-J  decimal 10  hex $0A : The CTRL-J character corresponds to the ASCII
LF line-feed character; text output occurs on the next screen line after a
CTRL-J character is encountered.

CTRL-K  decimal 11  hex $0B : The CTRL-K character disables character-set
switching using the SHIFT/COMMODORE key combination.  This code replaces
the CHR$(9) code used on previous PET/CBM machines to disable case
switching.

CTRL-L  decimal 12  hex $0C : The CTRL-L character enables character-set
switching using the SHIFT/COMMODORE key combination.  This code replaces
the CHR$(8) code used on previous PET/CBM machines to enable case switching.

CTRL-O  decimal 15  hex $0F : The CTRL-O character enables the
character-flash attribute; it applies solely to the 80-column screen.  This
attribute can be displayed by a CHR$(143)(hex $8F) character.

CTRL-[  decimal 27  hex $1B : The CTRL-[ character is merely the escape
character. This control combination and the escape key both produce the
same PETASCII character.

CHR$(130)  hex $82 : CHR$(130) has no corresponding control-key character.  
It disables the underline atrribute in 80-column mode that was enabled by
CTRL-B.

CHR$(143)  hex $8F : CHR$(143) has no corresponding control-key character.  
It disables the character-flash attribute in 80-column mode that was enabled
by CTRL-O.

Stephane Richard

What a handy list to have around when coding (even on an emulator I might add ;-) ) bnack in teh days of dot matrix printers, I would have typed that in, printed it this list up and wallpapered my office wall with it ;-) hehe

Thanks for putting that up :-).
When God created light, so too was born, the first Shadow!

MystikShadows

istvan

In 80 columns, if you print ESC+E, ESC+F, ESC+S, or ESC+U from within a program the cursor will be enabled and will always appear immediately after any text you print.  (It's a neat effect, it looks like an old-school terminal program).  The only way to turn the cursor back off from within a program is to change VDC register #10, which is for the cursor mode.  This can be accomplished with SYS 52684,224,10 in bank 15.

Stephane Richard

kik yeah, I remember those good old terminal apps...wow, the memories (BBS anyone?  hehe)  Anyone remember AOL back on the 64 Woohoo, now that was something back then hehe.
When God created light, so too was born, the first Shadow!

MystikShadows

Golan Klinger

Quote from: mystikshadowsAnyone remember AOL back on the 64
I don't. Was there an AOL client for the 64? I remember AOL's precursor, Quantum Link. Is that what you're referring to? Q-Link is back online, BTW. :)
Call me Golan; my parents did.

Stephane Richard

lol yeah that's exactly what I was talking about...maybe someone can clear my memory...but I could have swarn I saw AOL atleast once on my 64 (at the time) before the actual windows AOL so to speak.  Anyone else remember that or did I have too much beer that day? ;-)
When God created light, so too was born, the first Shadow!

MystikShadows

nikoniko

Yes, the company did officially change the name to AOL in 1989. I remember receiving some notice by snail mail to the effect of "Quantum Link is now America Online." Thing is, I don't think they ever bothered changing the Quantum Link screens to say "America Online", or if they did I don't remember it at all. Pretty much by 1989 their strategy was pushing hard for the PC market, and Quantum Link began to languish as a result of it. When hardware failed, it wasn't replaced, and so over time the service lost some of its download library and some of its features also stopped working. It was sad to watch because it kind of felt like the Commodore 8 bits were dying along with it, since around the same time C64 software also began to dwindle and then finally disappear from a lot of stores where I lived. To AOL's credit, though, even if they'd stopped caring about Q-Link, they did keep it going (just barely) until 1994. By the end, said one of my friends who was still using Q-Link then, service was so bad that he had been getting it for free for about two years -- every time he complained about something to AOL, they just gave him a free month since that was easier than fixing the dying system.

I was really impressed that hobbyists were able to reverse engineer the network and bring it back to life in the past year, though unfortunately it seems to be down now? (Not 100% sure, so anyone feel free to correct me on that.) I'd really love to see Club Caribe similarly brought back from the dead one of these days... or even better, Habitat, which was the beta version of Caribe and was much more expansive and interesting. I participated in the Habitat beta and loved it. Massively multiplayer online worlds on the Commodore 64/128... amazing! By the way, does anyone have a D64 of Caribe or Habitat? I used to have Caribe, intending to dig into the code one day, but seem to have lost it and can't find another image of it.

adric22

Quote from: adminThe C-128's screen editor system is much more comprehensive than that  of previous PET/CBM computers.
Except the Plus/4 and C16 have all the same commands.  In fact, the Plus/4 BASIC is just about as feature rich as the C128 but it runs twice as fast.

Guest

Quote from: adric22
Quote from: adminThe C-128's screen editor system is much more comprehensive than that  of previous PET/CBM computers.
Except the Plus/4 and C16 have all the same commands.  In fact, the Plus/4 BASIC is just about as feature rich as the C128 but it runs twice as fast.
Only compared to 40-column mode.  In 80-column mode you can run 2mhz with twice the screen real estate as the TED.

adric22

I don't know if you ever noticed or not.  But the 80-column screen is considerably slower than the 40 column screen.  I seem to recall that running 2 Mhz mode was just enough of a boost to make the 80-column screen operate in a comparable fashion to the 40 column.

It really is a shame, though.  The 128 could have definatly been so much better, especially in regards to the 80-column design.  Of course, we've all mentioned that a better designed VIC with 80-column support and RGB output would have been ideal... That way you could have 80 columns on a regular NTSC screen (It'd be a little blurry.. kind of like viewing 80-columns on a composite monitor from an Apple II or Amiga) and businesses could have bought the RGB monitor for crisp images on their business programs.  

But as the 80-column chip was shipped with 16K of RAM and intended for only text to begin with... it was a wasted effort to include it on a C128.  It would have been better off as an enhancement option or something.   Even if it had sprites and all that good stuff, it was too slow for most game applications and since few of us had RGB monitors, most people didn't even see their 128 run 80 columns.

What is worse... they had the option for composite grayscale out of the chip.  Not a bad idea.  The Amiga 500 had a similar setup, you get color from the RGB port or grayscale from the RCA jack.  But very, very few people were aware that the chip even had an option and the cable to display it was very scarce and unheard of.  What is worse is the way they have it display essentially black, white, and one bright shade of gray.  I find it unusable with most applications because of the colors all appearing the same.  If they had done a little better job on the composite output (even if it was grayscale) and actually stuck an RCA jack on the back or something and advertised it, more people would have used the 80-column mode.