vtac-terminal 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aaron Wright
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ VT-AC
2
+ =====
3
+
4
+ ```
5
+ ___ ___ _______ _______ _______
6
+ | Y | |______| _ | _ |
7
+ |. | |.| | |______|. 1 |. 1___|
8
+ |. | `-|. |-' |. _ |. |___
9
+ |: 1 | |: | |: | |: 1 |
10
+ \:.. ./ |::.| |::.|:. |::.. . |
11
+ `---' `---' `--- ---`-------'
12
+ ```
13
+
14
+ A fantasy ASCII terminal emulator.
15
+
16
+ ## Features
17
+
18
+ - Emulates a simple ASCII terminal with 40 columns and 30 rows or 8x8 pixel blocks.
19
+ - Controllable via serial port using only standard ASCII data.
20
+ - 320 x 240 native pixel display area.
21
+ - Uses a classic 8x8 pixel font (IBM PC BIOS / Code Page 437) for character rendering.
22
+ - Text or graphics mode support.
23
+ - 256 colors available (RGB332).
24
+ - Set foreground and background colors for each 8x8 pixel block or 8x1 pixel row.
25
+ - Connects via serial port for real-time data communication with Arduino, Raspberry Pi, [6502 computer](https://github.com/acwright/6502), or anything with a serial port!
26
+ - Or you can load binary data files directly into the terminal to be parsed and displayed.
27
+ - Supports configurable baud rate, parity, data bits, and stop bits.
28
+ - Fullscreen mode for immersive terminal experience.
29
+ - Adjustable scaling for better visibility.
30
+
31
+ ## Quick Start
32
+ 1. Install VT-AC globally via NPM:
33
+ ```
34
+ npm install -g vtac-terminal
35
+ ```
36
+ 2. Connect a serial device (e.g., Arduino) to your computer.
37
+ 3. Open VT-AC terminal emulator with the appropriate path to the serial port:
38
+ ```
39
+ vtac -p /dev/ttyUSB0
40
+ ```
41
+ 4. Start sending ASCII data from your serial device to see it displayed in the VT-AC terminal!
42
+
43
+ ## Character Set
44
+
45
+ ![VT-AC Character Set](https://github.com/acwright/VT-AC/blob/main/images/characters.png?raw=true)
46
+
47
+ ## Palette
48
+
49
+ ![VT-AC Palette](https://github.com/acwright/VT-AC/blob/main/images/palette.png?raw=true)
50
+
51
+ ## Instruction Set
52
+
53
+ The VT-AC terminal supports a simple instruction set using standard ASCII values to control its behavior. Below is a summary of the supported instructions:
54
+
55
+ | Instruction | # of Bytes | Command | Description |
56
+ |-------------|------------|------------------|-------------------------------------------------------------------------------------|
57
+ | `0x00` | 1 | NULL | No operation |
58
+ | `0x01` | 1 | HOME | Move cursor to home position (0,0) |
59
+ | `0x02` | 2 | Cursor Character | 2nd byte is character to use, or `$00` to turn off (Default=`$00`) |
60
+ | `0x03` | 1 | Cursor Mode | Toggle cursor mode between solid/blinking (Default=solid) |
61
+ | `0x04` | 1 | Reset | Reset terminal (text mode, clear screen, cursor home-off-solid, bg=`$00`, fg=`$FF`) |
62
+ | `0x05` | 1 | N/A | Reserved for future use |
63
+ | `0x06` | 1 | N/A | Reserved for future use |
64
+ | `0x07` | 1 | BELL | Play bell sound |
65
+ | `0x08` | 1 | BS | Backspace |
66
+ | `0x09` | 1 | TAB | Move cursor to next tab stop |
67
+ | `0x0A` | 1 | LF | Line feed (move cursor down, same column) |
68
+ | `0x0B` | 1 | Screen Mode | Toggle screen mode between text/graphics modes (Default=text) |
69
+ | `0x0C` | 1 | Clear Screen | Clear the screen |
70
+ | `0x0D` | 1 | CR | Carriage return (move cursor to start of line) |
71
+ | `0x0E` | 2 | Set Column | 2nd byte is column 0 (`$00`) to 39 (`$27`) (Default=`$00`) |
72
+ | `0x0F` | 2 | Set Row | 2nd byte is row 0 (`$00`) to 29 (`$1D`) (Default=`$00`) |
73
+ | `0x10` | 1 | Delete to SoL | Delete to start of line |
74
+ | `0x11` | 1 | Delete to EoL | Delete to end of line |
75
+ | `0x12` | 1 | Delete to SoS | Delete to start of screen |
76
+ | `0x13` | 1 | Delete to EoS | Delete to end of screen |
77
+ | `0x14` | 1 | Scroll Left | Scroll screen to the left replacing vacated columns with spaces |
78
+ | `0x15` | 1 | Scroll Right | Scroll screen to the right replacing vacated columns with spaces |
79
+ | `0x16` | 1 | Scroll Up | Scroll screen up replacing vacated rows with blank lines |
80
+ | `0x17` | 1 | Scroll Down | Scroll screen down replacing vacated rows with blank lines |
81
+ | `0x18` | 2 | Foreground Color | 2nd byte is foreground color 0 (`$00`) to 255 (`$FF`) (Default=`$FF`) |
82
+ | `0x19` | 2 | Background Color | 2nd byte is background color 0 (`$00`) to 255 (`$FF`) (Default=`$00`) |
83
+ | `0x1A` | 2 | Data Next | 2nd byte data not command - Allows 0 (`$00`) to 31 (`$1F`), and 127 (`$7F`) as data |
84
+ | `0x1B` | 1 | ESC | Reserved for future escape code implementation |
85
+ | `0x1C` | 1 | Cursor Left | Move the cursor to the left |
86
+ | `0x1D` | 1 | Cursor Right | Move the cursor to the right |
87
+ | `0x1E` | 1 | Cursor Up | Move the cursor up |
88
+ | `0x1F` | 1 | Cursor Down | Move the cursor down |
89
+ | `0x20` | 1 | ASCII | Standard ASCII Characters |
90
+ | * | 1 | ASCII | Standard ASCII Characters |
91
+ | `0x7E` | 1 | ASCII | Standard ASCII Characters |
92
+ | `0x7F` | 1 | DELETE | Delete at cursor position |
93
+ | `0x80` | 1 | ASCII | Extended ASCII Characters |
94
+ | * | 1 | ASCII | Extended ASCII Characters |
95
+ | `0xFF` | 1 | ASCII | Extended ASCII Characters |
96
+
97
+ ## Text Mode
98
+
99
+ In text mode, each byte sent to the terminal is interpreted and rendered as characters using the standard 8x8 pixel font.
100
+ Each character cell can have its own foreground and background color by first setting the foreground and background colors before sending the next byte to be displayed.
101
+ The terminal supports basic text operations such as cursor movement, line feed, carriage return, and clearing the screen.
102
+
103
+ The cursor can be controlled using the provided instructions, allowing it to be positioned using row and column commands, turned on or off, and set to solid or blinking mode.
104
+
105
+ In text mode, in order to display characters with ASCII values from 0 (`$00`) to 31 (``$1F``) or 127 (`$7F`), the "Data Next" instruction must first be sent to indicate that the next byte should be treated as data rather than a command.
106
+
107
+ ## Graphics Mode
108
+
109
+ The terminal can be switched into graphics mode to display pixel-based graphics. Data is then interpreted as the next byte row (0-7) in the 8x8 pixel block at the cursor position (column, row).
110
+ After sending 8 bytes, the cursor automatically moves to the next column. After reaching the end of the row, it wraps to the beginning of the next row.
111
+ After reaching the end of the screen, it wraps back to the top-left corner. If the cursor is moved manually using the set row and set column instructions, the next byte will be rendered at the top row of that position.
112
+ In this way, the cursor can be positioned and then a continuous stream of bytes can be sent to the terminal to render pixel data.
113
+
114
+ Each byte that is sent can be individually colored using the foreground and background colors, enabling the creation of simple graphics and images.
115
+
116
+ In graphics mode, in order to send pixel data with ASCII values from 0 (`$00`) to 31 (``$1F``) or 127 (`$7F`), the "Data Next" instruction must first be sent to indicate that the next byte should be treated as pixel data rather than a command.
117
+
118
+ ## Installation
119
+
120
+ ### From NPM
121
+
122
+ ```
123
+ npm install -g vtac-terminal
124
+ ```
125
+
126
+ ### From Source
127
+
128
+ 1. Clone the repository:
129
+ ```
130
+ git clone https://github.com/acwright/VT-AC.git
131
+ cd VT-AC
132
+ ```
133
+
134
+ 2. Install dependencies:
135
+ ```
136
+ npm install
137
+ ```
138
+
139
+ 3. Build the project:
140
+ ```
141
+ npm run build
142
+ ```
143
+
144
+ 4. (Optional) Link globally:
145
+ ```
146
+ npm link
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ ### Basic Usage
152
+
153
+ Open the VT-AC terminal emulator with a path to the serial port (9600 baud, no parity, 8 data bits, 1 stop bit by default):
154
+
155
+ ```
156
+ vtac -p /dev/ttyUSB0
157
+ ```
158
+
159
+ ### Fullscreen Mode
160
+
161
+ ```
162
+ vtac -p /dev/ttyUSB0 -f
163
+ ```
164
+
165
+ ### With Scaling
166
+
167
+ ```
168
+ vtac -p /dev/ttyUSB0 -s 4
169
+ ```
170
+
171
+ ### Load Data File
172
+
173
+ VT-AC can load binary data files directly into the terminal before launch for parsing and display:
174
+
175
+ ```
176
+ vtac -l /path/to/data.bin
177
+ ```
178
+
179
+ ### Connect to Serial Port
180
+
181
+ ```
182
+ vtac -p /dev/ttyUSB0 -b 115200 -a none -d 8 -t 1
183
+ ```
184
+
185
+ ### Command Line Options
186
+
187
+ - `-v, --version` - Output the current version
188
+ - `-h, --help` - Display help information
189
+ - `-p, --path <path>` - Path to the serial port (e.g., /dev/ttyUSB0)
190
+ - `-b, --baudrate <baudrate>` - Baud rate (default: "9600")
191
+ - `-a, --parity <parity>` - Parity (default: "none")
192
+ - `-d, --databits <databits>` - Data bits (default: "8")
193
+ - `-t, --stopbits <stopbits>` - Stop bits (default: "1")
194
+ - `-f, --fullscreen` - Enable fullscreen mode (default: false)
195
+ - `-s, --scale <scale>` - Scale (default: "2")
196
+ - `-l, --load <load>` - Path to data file to load (e.g. /path/to/data.bin)
197
+
198
+ ## Development
199
+
200
+ ### Run in Development Mode
201
+
202
+ ```
203
+ npm run build
204
+ node ./dist/index.js -p /dev/ttyUSB0
205
+ ```
206
+
207
+ ### Release Build
208
+
209
+ ```
210
+ git tag vX.Y.Z
211
+ git push origin main --tags
212
+ npm publish
213
+ ```
214
+
215
+ ### Project Structure
216
+
217
+ ```
218
+ VT-AC/
219
+ ├── src/
220
+ │ ├── index.ts # CLI entry point
221
+ │ └── VT-AC/
222
+ │ └── VT-AC.ts # Core logic
223
+ ├── dist/ # Compiled JavaScript
224
+ ├── package.json
225
+ ├── tsconfig.json
226
+ └── README.md
227
+ ```
228
+
229
+ ## Contributing
230
+
231
+ Contributions are welcome! Please open an issue or submit a pull request on GitHub.
232
+
233
+ ## TODO
234
+
235
+ - Implement escape sequences for extended control and ANSI support.
236
+ - Add support for additional character sets.
237
+ - 80 column mode.
238
+ - VT-100 terminal emulation.
239
+
240
+ ## License
241
+
242
+ MIT: [https://github.com/acwright/VT-AC/blob/main/LICENSE](https://github.com/acwright/VT-AC/blob/main/LICENSE)
243
+
244
+ ## Credits
245
+
246
+ - Inspired By: [http://searle.x10host.com/MonitorKeyboard/index.html](http://searle.x10host.com/MonitorKeyboard/index.html)
247
+ - Font Set: [https://github.com/susam/pcface/tree/main/out/oldschool-bios-8x8](https://github.com/susam/pcface/tree/main/out/oldschool-bios-8x8)
248
+