Write Your Own B.B.S.

Another fine product © 2019 to 2022
by Modern Pascal Solutions, LLC.

Site Tools


Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
terminal

Glitch Terminal

We also offer a Full ANSI implementation terminal, originally based upon the fTelnet project on github from Rick Parrish. While fTelnet itself is an amazing product, it was not complete. At the time that I forked the code fTelnet did not understand all of the standard ANSI color codes, also it did not support all of the game fonts and sounds we wanted to incorporate.

Sample ANSI 16 Color Chart:

Sample ANSI 24-bit Color Chart:

Sample ANSI 256 Color Chart:

ANSI Sequences

CSI is a standard term used in terminal specifications, it means:

ESC [ 0x1B0x9B Control Sequence Introducer

Pn is how we represent a numeric parameter in the following specifications.
Pt is how we represent a text parameter in the following specifications.
Ps is how we represent a space character in the parameters in the following specifications.
Pc is how we represent an individual character parameter in the follow specifications.

Uppercase Command Letter

CSI Pn A Move the cursor UP. Defaults to 1
If the cursor is at the top of the display the command is ignored.
If the Pn would move the cursor above the top of the display,
the cursor stops on the top line.

This is sent from a terminal to the BBS when the UP arrow is pressed.
This is also sent from the terminal with mouse wheel scroll up.
CSI Pn B Move the cursor DOWN. Defaults to 1
If the cursor is at the bottom of the display the command is ignored.
If the Pn would move the cursor below the last line of the display,
the cursor stops on the bottom line.

This is sent from a terminal to the BBS when the DOWN arrow is pressed.
This is also sent from the terminal with mouse wheel scroll down.
CSI Pn C Move the cursor RIGHT Defaults to 1
If the cursor is at the right margin of the display the command is ignored.
If the Pn would move the cursor beyond the right margin,
the cursor stops on the last character for this line.

This is sent from a terminal to the BBS when the RIGHT arrow is pressed.
CSI Pn D Move the cursor LEFT
CSI Pn ; Pn Ps D Change Display Font
CSI Pn E Move the cursor DOWN and HOME
CSI Pn F Move the cursor UP and HOME
This is sent from a terminal to the BBS when the END key is pressed.
CSI Pn G Move the cursor to X
CSI Pn ; Pn H Move the cursor to X/Y
This is sent from a terminal to the BBS when the HOME key is pressed.
CSI Pn I Cursor Forward Tabulation
CSI Pn J Clear the Screen
CSI Pn K Clear the current Line
CSI Pn L Insert Line(s)
CSI Pn M Delete Line(s) or ANSI Music
CSI Pn N Different ANSI Music
CSI Pn O ?
CSI Pn P Delete Character(s)
CSI Pn ; Pn ; Pn Q In RIP Mode, change Font
CSI Pn R ?
CSI Pn S Scroll Screen UP
CSI Pn T Scroll Screen DOWN
CSI Pn U Clear Screen with Default Attribute
CSI Pn V ?
CSI Pn W I use the unused W command for my WRO Protocol
CSI Pn X Replace the next Pn characters with Space Gray on Black
CSI Pn Y Emoji Sequence
CSI Pn Z Cursor Backward Tabulation

Lowercase Command Letter

CSI Pn a ?
CSI Pn b Repeat last character Pn times
CSI Pn c Terminal Query
CSI Pn d ?
CSI Pn e ?
CSI Pn ; Pn f Goto X/Y Like CSI Pn H
CSI Pn g Tabulation Clear. Default is 0
If Pn is 0 forget current tab position.
If Pn is 3 then forget all tab positions.
CSI Pn h Set Mode
If Pn is 4 then Insert On
CSI ? Pn h Restore Terminal Mode(s)
CSI Pn i ?
CSI Pn j ?
CSI Pn k ?
CSI Pn l Set Terminal Mode(s)
CSI Pn m Set Video Mode(s)
CSI Pn n Device Status Report
CSI Pn o ?
CSI Pn p ?
CSI Pn q ?
CSI Pn ; Pn r Set Scroll Region.
The first Pn is TOP line and next Pn is BOTTOM line.
CSI Pn s Save Current Cursor X/Y Position
CSI Pn ; Pn ; Pn ; Pn t Terminal Settings
If 1st Pn is 0 then set 24bit Background Color.
If 1st Pn is 1 then set 24bit Foreground Color.
If 1st Pn is 8 then resize Window in Rows ; Columns.
CSI Pn u Move cursor to Saved X/Y Position
See CSI Pn s
CSI Pn v ?
CSI Pn w ?
CSI Pn x ?
CSI Pn y ?
CSI Pn z ?

Character Command Letter

CSI Pn @ Insert Pn Characters, Defaults to 1
All characters to the right of the cursor are pushed to the right.
The character at the right margin is destroyed, it does not push to the next line.
This is sent from a terminal to the BBS when the INS key is pressed.
CSI Pn ; Pn ^ Modify Text Cursor Size and Color.
If the first parameter is 0 (zero) you are setting color.
The cursor code expects ANSI-256 color code.

If the first parameter is 1 you are setting size.
0=None, 1 to 100 are supported. 100=BLOCK.
CSI Pn *r Force an Emulated Baud Rate.
0=unlimited, 1=300, 2=600, 3=1200, 4=2400, 5=4800, 6=9600, 7=19200,
8=38400, 9=57600, 10=76800, 11=115200
CSI Pn ` Move cursor to column on current row, Defaults to 1
Same as CSI Pn G

Common Sequences

ANSI Detection

When a BBS checks to see if a terminal supports ANSI, it is common to send from the BBS to the terminal one of the following sequences.

CSI 6 n Where is your terminal cursor currently?
This is a very basic way to say “Hey! Do you support ANSI?”
The terminal will respond with CSI ROW ; COL R
CSI 255 B
CSI 255 C
CSI 6 n
Tells the terminal to move the cursor 255 rows down
(which stops at the bottom of the screen).
Tells the terminal to move the cursor 255 columns to the right
(which stops at the right margin of the screen).
Then ask where is your terminal cursor currently?
This will reply back CSI 80 ; 25 R for an 80×25 DOS Terminal.

Unicode Detection

Since we can get a reply “Where is the cursor?” when testing for ANSI support. I realized why not send Clear Screen, followed by 3 Unicode Characters, followed by CSI 6 n. Once I proved this worked with 4 different terminals that support Unicode, and the reverse logic works for all terminals that do not understand Unicode, I shared my logic with other BBS authors.

CSI 2 J
3 Unicode
CSI 6 n
The Unicode Characters used are 3 characters each (9 characters total)
A terminal will return either CSI 1 ; 4 R if it understood,
or CSI 1 ; 10 R or CSI 1 ; 13 R if it did not understand.
Not rocket science ~ however, something everyone overlooked
for the past two (2) decades.

Mouse Sequences

Okay, out of the main terminals for connecting to your BBS ~ mouse tracking seems to be implemented differently (if at all). NetRunner and xTerm both seem to support sending mouse clients when they receive CSI ? 1000 h. SyncTerm requires a proceeding CSI = 255 h (DOORWAY mode on), however, it does not send CLICK on 0x00 } as you drag your mouse.

xTerm Specification

CSI M Ps Pc Pc Mouse Down Event
Pc is 32+X or Y. So 1+32 = !. So 1,1 is sent as !!
Mouse sequences are sent in X/Y not your standard Row/Col like other
ANSI commands.
CSI M # Pc Pc Mouse Up Event
Pc is 32+X or Y. So 1+32 = !. So 1,1 is sent as !!
Mouse sequences are sent in X/Y not your standard Row/Col like other
ANSI commands.

NOTE A Single click will return both sequences CSI M !! and CSI M#!!. If you drag your mouse to a different position, then the CSI M# will contain a different X or Y character.

NetRunner Specification

CSI M 0 Pc Pc Mouse Click Event
Pc is 40+X or Y. So 1+40 = ). So 1,1 is sent as 0))
Mouse sequences are sent in X/Y not your standard Row/Col like other
ANSI commands.

NOTE NetRunner sends only the starting click ~ so no support for drag.

Glitch Extensions

To improve UX (User Experience), after researching every specification I could find, I ended up having to add Legacy/X BBS ANSI extensions:

CSI Pn O Where Pn is the ASCII number of the character you wish to flood fill
the background with. The command is the letter O (not zero).
Example:
CSI[176O produces your standard #176 background like RASETUP.

Of course, this lends itself to be useful for desktop applications with popup windows, and dropdown menus. So, to improve the performance of showing something then returning back to the text or image behind it. I added the V command sequence for save to Video Buffer, and the R command sequence for restore from Video Buffer.

CSI Pn1;Pn2;Pn3;Pn4 V Pn1 is the starting left column.
Pn2 is the starting top row.
Pn3 is the ending column,
Pn4 is the ending row.
Example:
CSI[1;1;80;5V stores the top 5 rows to the video buffer.
CSI Pn1;Pn2;Pn3;Pn4 R Pn1 is the starting left column.
Pn2 is the starting top row.
Pn3 is the ending column,
Pn4 is the ending row.
Example:
CSI[1;1;80;5R restores the top 5 rows from the video buffer.

Of course, this also means you can copy a region to the video buffer, then stamp it at different positions on the screen, to emulate animation (character movement for example).

terminal.txt · Last modified: 06/04/2023 09:16 by 127.0.0.1