From 591cae0b86dfba5e69cf58e53f7ea277ef340d2d Mon Sep 17 00:00:00 2001 From: Willem Date: Wed, 8 Jan 2025 18:28:00 +0100 Subject: [PATCH] Started with raw version of VT-NX01 for DEC terminator terminals --- .../o2o/fc18/zero33/FCDotDEC1604DashP7.java | 97 +++++++++---------- .../fc18/zero33/FCDotDEC1604DashP7Test.java | 25 +++-- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java index 4d19046..52ce5bf 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java @@ -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) * - * 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 * @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. __ESC_BELOW, - /// VT-MSX4: char ? = Next argument separator - MSX4_ARGU_NEXT, - /// VT-MSX4: char ! = Argument end indicator - MSX4_ARGU_END, + /// VT-NX01 = __ESC6 ? = Next argument separator + VT_NX01_NEXT, + /// VT-NX01 = __ESC6 ! = End of P7 sequence started from NX01_A2Amp to execute the VT command. + /// NOTE: Escape sequences below A have no end of sequence behavior defined. + VT_NX01_EXECUTE, UNDEFINED__TAG_CURLY_LEFT, UNDEFINED__TAG_CURLY_RIGHT, @@ -91,33 +92,33 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner UNDEFINED__BAR_UNDER, UNDEFINED__BAR_V_LEFT, UNDEFINED__BAR_V_RIGHT, - UNDEFINED___AT, + UNDEFINED__AT, - /// VT-52 = ESC A = Cursor up - MSX_CURSOR_UP, - /// VT-52 = ESC B = Cursor down - MSX_CURSOR_DOWN, - /// VT-52 = ESC C = Cursor right - MSX_CURSOR_RIGHT, - /// VT-52 = ESC D = Cursor left - MSX_CURSOR_LEFT, - /// VT-52 = ESC E = Clear screen - MSX_CLEAR_SCREEN, + /// VT-NX01 = __ESC6 A + ?num + VT_NX01_EXECUTE = Cursor one or X up + NX_CURSOR_UP, + /// VT-NX01 = __ESC6 B + ?num + VT_NX01_EXECUTE = Cursor one or X down + NX_CURSOR_DOWN, + /// VT-NX01 = __ESC6 B + ?num + VT_NX01_EXECUTE = Cursor one or X right + NX_CURSOR_RIGHT, + /// VT-NX01 = __ESC6 D + ?num + VT_NX01_EXECUTE = Cursor one or X left + NX_CURSOR_LEFT, + /// VT-NX01 = __ESC6 E + ?num + VT_NX01_EXECUTE = Clear full or X lines from cursor to above and start of line with cursor + 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, - /// VT-52 = ESC H = Cursor home - MSX_CURSOR_HOME, + UNDEFINED__NX08_H, /// VT-52 = ESC I = Cursor up and insert - MSX_CURSOR_UPSERT, - /// VT-52 = ESC J = Clear to end of screen - MSX_CLEAR_EOS, - /// VT-52 = ESC K = Clear to end of line - MSX_CLEAR_EOL, + OLD_MSX_CURSOR_UPSERT, + /// VT-NX01 = __ESC6 J + ?num + VT_NX01_EXECUTE = Clear one or X lines or to end of screen, from cursor position without cursor + VT_CLEAR_DOWN, + /// VT-NX01 = __ESC6 K + ?num + VT_NX01_EXECUTE = Clear one or X chars to right, from cursor position without cursor + VT_CLEAR_RIGHT, /// VT-52 = ESC L = Insert line - MSX_INSERT_LINE, + OLD_MSX_INSERT_LINE, /// VT-52 = ESC M = Delete line - MSX_DELETE_LINE, + OLD_MSX_DELETE_LINE, UNDEFINED__NX14_N, UNDEFINED__NX15_O, UNDEFINED__NX16_P, @@ -129,21 +130,29 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner UNDEFINED__NX22_V, UNDEFINED__NX23_W, 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 - // C0 char H = BS = Backspace FIXME: UNDEFINED__NX26_Z + // ANSI CSI has dynamic termination; + // - ESC [ + // - any number (including none) of "parameter bytes" in the range 0x30–0x3F (ASCII 0–9:;<=>?), + // - any number of "intermediate bytes" in the range 0x20–0x2F (ASCII space and !"#$%&'()*+,-./), + // - finally by a single "final byte" in the range 0x40–0x7E (ASCII @A–Z[\]^_`a–z{|}~) + // + // C0 char G = BEL = Bell, 0x07 + // C0 char H = BS = Backspace // C0 char I = HT = Tab // C0 char J = LF = Line Feed // C0 char L = FF = Form Feed // C0 char M = CR = Carriage Return - // // C1 char [ = CSI = Control Sequence Introducer // C1 char ] = OSC = Operating System Command // C1 char ^ = PM = Privacy Message @@ -153,24 +162,6 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner // C1 char O = SS3 = Single Shift Three // C1 char P = DCS = Device Control 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 0x30–0x3F (ASCII 0–9:;<=>?), - // - any number of "intermediate bytes" in the range 0x20–0x2F (ASCII space and !"#$%&'()*+,-./), - // - finally by a single "final byte" in the range 0x40–0x7E (ASCII @A–Z[\]^_`a–z{|}~) - // - // 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 diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java index c1dbed8..7edace2 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java @@ -40,30 +40,39 @@ import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10; public class FCDotDEC1604DashP7Test { @Test - public void testValues() throws Exception { + public void testSize() throws Exception { Assertions.assertEquals(64, FCDotDEC1604DashP7.length()); - Assertions.assertEquals(FCDotCDC1604DashP6.NX12_L.ordinal(), FCDotDEC1604DashP7.MSX_INSERT_LINE.ordinal()); } @Test - public void baklavaSequence() throws Exception { - int[] seq = FCDotDEC1604DashP7.MSX_CURSOR_GOTO.baklavaPoints(); + public void testBaklavaSequence() throws Exception { + int[] seq = FCDotDEC1604DashP7.NX_CURSOR_GOTO.baklavaPoints(); Assertions.assertEquals(2, seq.length); Assertions.assertEquals(FCDotCDC1604DashP6.__ESC6.ordinal(), seq[0]); Assertions.assertEquals(FCDotCDC1604DashP6.NX25_Y.ordinal(), seq[1]); + Assertions.assertEquals(FCDotDEC1604DashP7.NX_BELL.ordinal(), FCDotCDC1604DashP6.NX27_AMPERSAND.ordinal()); } @Test public void testCusorGoto() throws Exception { List cdc = new ArrayList<>(); - cdc.add(FCDotDEC1604DashP7.MSX_CURSOR_GOTO); + cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO); cdc.addAll(FCDotPIE9CDash10.toDecimals(123)); - cdc.add(FCDotDEC1604DashP7.MSX4_ARGU_NEXT); + cdc.add(FCDotDEC1604DashP7.VT_NX01_NEXT); 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("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); } + + @Test + public void testClearTop5Lines() throws Exception { + List 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)); + } } -