Started with raw version of VT-NX01 for DEC terminator terminals

This commit is contained in:
Willem Cazander 2025-01-08 18:28:00 +01:00
parent d3441a683c
commit 591cae0b86
2 changed files with 61 additions and 61 deletions

View file

@ -34,7 +34,7 @@ import org.x4o.o2o.fc18.FourCornerX18CakePoints;
* *
* A 8 or 18 or 144 bit computer uses this direct as the second 64 part page. (thus number 64 to 127) * A 8 or 18 or 144 bit computer uses this direct as the second 64 part page. (thus number 64 to 127)
* *
* NOTE: MSX is VT-52 see https://www.msx.org/wiki/MSX_Characters_and_Control_Codes#Escape_codes * NOTE: Old MSX is VT-52 see https://www.msx.org/wiki/MSX_Characters_and_Control_Codes#Escape_codes new MSX4 is VT-NX01
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Dec 24, 2024 * @version 1.0 Dec 24, 2024
@ -57,10 +57,11 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
/// NOTE: Other lower case chars in escape sequence needs to be encoded normally via __PIE68 and NX26_Z chars. /// NOTE: Other lower case chars in escape sequence needs to be encoded normally via __PIE68 and NX26_Z chars.
__ESC_BELOW, __ESC_BELOW,
/// VT-MSX4: char ? = Next argument separator /// VT-NX01 = __ESC6 ? = Next argument separator
MSX4_ARGU_NEXT, VT_NX01_NEXT,
/// VT-MSX4: char ! = Argument end indicator /// VT-NX01 = __ESC6 ! = End of P7 sequence started from NX01_A2Amp to execute the VT command.
MSX4_ARGU_END, /// NOTE: Escape sequences below A have no end of sequence behavior defined.
VT_NX01_EXECUTE,
UNDEFINED__TAG_CURLY_LEFT, UNDEFINED__TAG_CURLY_LEFT,
UNDEFINED__TAG_CURLY_RIGHT, UNDEFINED__TAG_CURLY_RIGHT,
@ -91,33 +92,33 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
UNDEFINED__BAR_UNDER, UNDEFINED__BAR_UNDER,
UNDEFINED__BAR_V_LEFT, UNDEFINED__BAR_V_LEFT,
UNDEFINED__BAR_V_RIGHT, UNDEFINED__BAR_V_RIGHT,
UNDEFINED___AT, UNDEFINED__AT,
/// VT-52 = ESC A = Cursor up /// VT-NX01 = __ESC6 A + ?num + VT_NX01_EXECUTE = Cursor one or X up
MSX_CURSOR_UP, NX_CURSOR_UP,
/// VT-52 = ESC B = Cursor down /// VT-NX01 = __ESC6 B + ?num + VT_NX01_EXECUTE = Cursor one or X down
MSX_CURSOR_DOWN, NX_CURSOR_DOWN,
/// VT-52 = ESC C = Cursor right /// VT-NX01 = __ESC6 B + ?num + VT_NX01_EXECUTE = Cursor one or X right
MSX_CURSOR_RIGHT, NX_CURSOR_RIGHT,
/// VT-52 = ESC D = Cursor left /// VT-NX01 = __ESC6 D + ?num + VT_NX01_EXECUTE = Cursor one or X left
MSX_CURSOR_LEFT, NX_CURSOR_LEFT,
/// VT-52 = ESC E = Clear screen /// VT-NX01 = __ESC6 E + ?num + VT_NX01_EXECUTE = Clear full or X lines from cursor to above and start of line with cursor
MSX_CLEAR_SCREEN, NX_CLEAR_TOP,
/// VT-NX01 = __ESC6 F + ?num + VT_NX01_EXECUTE = Clear one or X chars to left with cursor (backspace)
NX_CLEAR_LEFT,
UNDEFINED__NX06_F,
UNDEFINED__NX07_G, UNDEFINED__NX07_G,
/// VT-52 = ESC H = Cursor home UNDEFINED__NX08_H,
MSX_CURSOR_HOME,
/// VT-52 = ESC I = Cursor up and insert /// VT-52 = ESC I = Cursor up and insert
MSX_CURSOR_UPSERT, OLD_MSX_CURSOR_UPSERT,
/// VT-52 = ESC J = Clear to end of screen /// VT-NX01 = __ESC6 J + ?num + VT_NX01_EXECUTE = Clear one or X lines or to end of screen, from cursor position without cursor
MSX_CLEAR_EOS, VT_CLEAR_DOWN,
/// VT-52 = ESC K = Clear to end of line /// VT-NX01 = __ESC6 K + ?num + VT_NX01_EXECUTE = Clear one or X chars to right, from cursor position without cursor
MSX_CLEAR_EOL, VT_CLEAR_RIGHT,
/// VT-52 = ESC L = Insert line /// VT-52 = ESC L = Insert line
MSX_INSERT_LINE, OLD_MSX_INSERT_LINE,
/// VT-52 = ESC M = Delete line /// VT-52 = ESC M = Delete line
MSX_DELETE_LINE, OLD_MSX_DELETE_LINE,
UNDEFINED__NX14_N, UNDEFINED__NX14_N,
UNDEFINED__NX15_O, UNDEFINED__NX15_O,
UNDEFINED__NX16_P, UNDEFINED__NX16_P,
@ -129,21 +130,29 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
UNDEFINED__NX22_V, UNDEFINED__NX22_V,
UNDEFINED__NX23_W, UNDEFINED__NX23_W,
UNDEFINED__NX24_X, UNDEFINED__NX24_X,
/// VT-52 = ESC Y = Set cursor position
/// OLD is (char - 32) as int
/// NEW is __PIE68NXX10_J + MSX4_ARGU_NEXT + __PIE68NXX10_J + MSX4_ARGU_END
MSX_CURSOR_GOTO,
UNDEFINED__NX26_Z,
UNDEFINED__NX27_AMPERSAND,
/// VT-NX01 = __ESC6 Y + ?x + ?(VT_NX01_NEXT + y) + VT_NX01_EXECUTE = Set cursor to X and Y position or only X or home
NX_CURSOR_GOTO,
UNDEFINED__NX26_Z,
/// VT-NX01 = __ESC6 & + ?num/s + VT_NX01_EXECUTE = Ring the bells per second, one is one ring and two is two rings in one time unit
NX_BELL,
// MSX is simple VT-52 for reference;
// //
// C0 char G = BEL = Bell, 0x07 FIXME: UNDEFINED__NX27_AMPERSAND // ANSI CSI has dynamic termination;
// C0 char H = BS = Backspace FIXME: UNDEFINED__NX26_Z // - ESC [
// - any number (including none) of "parameter bytes" in the range 0x300x3F (ASCII 09:;<=>?),
// - any number of "intermediate bytes" in the range 0x200x2F (ASCII space and !"#$%&'()*+,-./),
// - finally by a single "final byte" in the range 0x400x7E (ASCII @AZ[\]^_`az{|}~)
//
// C0 char G = BEL = Bell, 0x07
// C0 char H = BS = Backspace
// C0 char I = HT = Tab // C0 char I = HT = Tab
// C0 char J = LF = Line Feed // C0 char J = LF = Line Feed
// C0 char L = FF = Form Feed // C0 char L = FF = Form Feed
// C0 char M = CR = Carriage Return // C0 char M = CR = Carriage Return
//
// C1 char [ = CSI = Control Sequence Introducer // C1 char [ = CSI = Control Sequence Introducer
// C1 char ] = OSC = Operating System Command // C1 char ] = OSC = Operating System Command
// C1 char ^ = PM = Privacy Message // C1 char ^ = PM = Privacy Message
@ -153,24 +162,6 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
// C1 char O = SS3 = Single Shift Three // C1 char O = SS3 = Single Shift Three
// C1 char P = DCS = Device Control String // C1 char P = DCS = Device Control String
// C1 char X = SOS = Start Of String // C1 char X = SOS = Start Of String
//
//
// Example VT52 see https://en.wikipedia.org/wiki/ANSI_escape_code
// - ESC [
// - any number (including none) of "parameter bytes" in the range 0x300x3F (ASCII 09:;<=>?),
// - any number of "intermediate bytes" in the range 0x200x2F (ASCII space and !"#$%&'()*+,-./),
// - finally by a single "final byte" in the range 0x400x7E (ASCII @AZ[\]^_`az{|}~)
//
// Try reading ISO/IEC 2022, see "XTerm Control Sequences" for what is old and what is used;
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
//
// Moves cursor up. (test)
// On 8 bit ansi system this takes ESC+[+1+A = 4 bytes/32bit to move 1 up
// with terminator codes;
// On 6 bit P6DEC system with takes __ESC+TAG_SQUARE_LEFT+__PIE+NX09_I+NX01_A
// On 18 bit P6DEC system with takes TAG_ANSI_UPPER+__PIE+NX09_I+NX01_A
//
// TODO: full new impl+cleanup of ANSI-NG for 6 bit real computer terminals !?!
; ;
static final private FCDotDEC1604DashP7[] VALUES = values(); // values() is slow method static final private FCDotDEC1604DashP7[] VALUES = values(); // values() is slow method

View file

@ -40,30 +40,39 @@ import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10;
public class FCDotDEC1604DashP7Test { public class FCDotDEC1604DashP7Test {
@Test @Test
public void testValues() throws Exception { public void testSize() throws Exception {
Assertions.assertEquals(64, FCDotDEC1604DashP7.length()); Assertions.assertEquals(64, FCDotDEC1604DashP7.length());
Assertions.assertEquals(FCDotCDC1604DashP6.NX12_L.ordinal(), FCDotDEC1604DashP7.MSX_INSERT_LINE.ordinal());
} }
@Test @Test
public void baklavaSequence() throws Exception { public void testBaklavaSequence() throws Exception {
int[] seq = FCDotDEC1604DashP7.MSX_CURSOR_GOTO.baklavaPoints(); int[] seq = FCDotDEC1604DashP7.NX_CURSOR_GOTO.baklavaPoints();
Assertions.assertEquals(2, seq.length); Assertions.assertEquals(2, seq.length);
Assertions.assertEquals(FCDotCDC1604DashP6.__ESC6.ordinal(), seq[0]); Assertions.assertEquals(FCDotCDC1604DashP6.__ESC6.ordinal(), seq[0]);
Assertions.assertEquals(FCDotCDC1604DashP6.NX25_Y.ordinal(), seq[1]); Assertions.assertEquals(FCDotCDC1604DashP6.NX25_Y.ordinal(), seq[1]);
Assertions.assertEquals(FCDotDEC1604DashP7.NX_BELL.ordinal(), FCDotCDC1604DashP6.NX27_AMPERSAND.ordinal());
} }
@Test @Test
public void testCusorGoto() throws Exception { public void testCusorGoto() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>(); List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
cdc.add(FCDotDEC1604DashP7.MSX_CURSOR_GOTO); cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO);
cdc.addAll(FCDotPIE9CDash10.toDecimals(123)); cdc.addAll(FCDotPIE9CDash10.toDecimals(123));
cdc.add(FCDotDEC1604DashP7.MSX4_ARGU_NEXT); cdc.add(FCDotDEC1604DashP7.VT_NX01_NEXT);
cdc.addAll(FCDotPIE9CDash10.toDecimals(456)); cdc.addAll(FCDotPIE9CDash10.toDecimals(456));
cdc.add(FCDotDEC1604DashP7.MSX4_ARGU_END); cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
Assertions.assertEquals("␃Y␁JB␁JC␁JD␃?␁JE␁JF␁JG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); Assertions.assertEquals("␃Y␁JB␁JC␁JD␃?␁JE␁JF␁JG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
} }
@Test
public void testClearTop5Lines() throws Exception {
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
cdc.add(FCDotDEC1604DashP7.NX_CLEAR_TOP);
cdc.addAll(FCDotPIE9CDash10.toDecimals(5));
cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
Assertions.assertEquals("␃E␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
}
} }