Skip to content

Commit 603fd6d

Browse files
committed
Run Xterm.js on ttyS1
1 parent 4ddb437 commit 603fd6d

File tree

9 files changed

+288
-18
lines changed

9 files changed

+288
-18
lines changed

examples/simple/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
<head>
44
<meta charset="utf-8" />
55
<script src="script.js" type="module"></script>
6+
<link rel="stylesheet" href="xterm.css" />
67
</head>
78
<body>
89
<div id="screen"></div>
10+
<div id="serial"></div>
911

1012
<button id="save">Save state</button>
1113
</body>

examples/simple/package-lock.json

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/simple/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12+
"linux-browser-shell": "file:../../",
1213
"vite": "^5.0.12",
13-
"linux-browser-shell": "file:../../"
14+
"xterm": "^5.3.0"
1415
}
1516
}

examples/simple/public/xterm.css

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/**
2+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
3+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4+
* https://github.com/chjj/term.js
5+
* @license MIT
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*
25+
* Originally forked from (with the author's permission):
26+
* Fabrice Bellard's javascript vt100 for jslinux:
27+
* http://bellard.org/jslinux/
28+
* Copyright (c) 2011 Fabrice Bellard
29+
* The original design remains. The terminal itself
30+
* has been extended to include xterm CSI codes, among
31+
* other features.
32+
*/
33+
34+
/**
35+
* Default styles for xterm.js
36+
*/
37+
38+
.xterm {
39+
cursor: text;
40+
position: relative;
41+
user-select: none;
42+
-ms-user-select: none;
43+
-webkit-user-select: none;
44+
}
45+
46+
.xterm.focus,
47+
.xterm:focus {
48+
outline: none;
49+
}
50+
51+
.xterm .xterm-helpers {
52+
position: absolute;
53+
top: 0;
54+
/**
55+
* The z-index of the helpers must be higher than the canvases in order for
56+
* IMEs to appear on top.
57+
*/
58+
z-index: 5;
59+
}
60+
61+
.xterm .xterm-helper-textarea {
62+
padding: 0;
63+
border: 0;
64+
margin: 0;
65+
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
66+
position: absolute;
67+
opacity: 0;
68+
left: -9999em;
69+
top: 0;
70+
width: 0;
71+
height: 0;
72+
z-index: -5;
73+
/** Prevent wrapping so the IME appears against the textarea at the correct position */
74+
white-space: nowrap;
75+
overflow: hidden;
76+
resize: none;
77+
}
78+
79+
.xterm .composition-view {
80+
/* TODO: Composition position got messed up somewhere */
81+
background: #000;
82+
color: #fff;
83+
display: none;
84+
position: absolute;
85+
white-space: nowrap;
86+
z-index: 1;
87+
}
88+
89+
.xterm .composition-view.active {
90+
display: block;
91+
}
92+
93+
.xterm .xterm-viewport {
94+
/* On OS X this is required in order for the scroll bar to appear fully opaque */
95+
background-color: #000;
96+
overflow-y: scroll;
97+
cursor: default;
98+
position: absolute;
99+
right: 0;
100+
left: 0;
101+
top: 0;
102+
bottom: 0;
103+
}
104+
105+
.xterm .xterm-screen {
106+
position: relative;
107+
}
108+
109+
.xterm .xterm-screen canvas {
110+
position: absolute;
111+
left: 0;
112+
top: 0;
113+
}
114+
115+
.xterm .xterm-scroll-area {
116+
visibility: hidden;
117+
}
118+
119+
.xterm-char-measure-element {
120+
display: inline-block;
121+
visibility: hidden;
122+
position: absolute;
123+
top: 0;
124+
left: -9999em;
125+
line-height: normal;
126+
}
127+
128+
.xterm.enable-mouse-events {
129+
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
130+
cursor: default;
131+
}
132+
133+
.xterm.xterm-cursor-pointer,
134+
.xterm .xterm-cursor-pointer {
135+
cursor: pointer;
136+
}
137+
138+
.xterm.column-select.focus {
139+
/* Column selection mode */
140+
cursor: crosshair;
141+
}
142+
143+
.xterm .xterm-accessibility,
144+
.xterm .xterm-message {
145+
position: absolute;
146+
left: 0;
147+
top: 0;
148+
bottom: 0;
149+
right: 0;
150+
z-index: 10;
151+
color: transparent;
152+
pointer-events: none;
153+
}
154+
155+
.xterm .live-region {
156+
position: absolute;
157+
left: -9999px;
158+
width: 1px;
159+
height: 1px;
160+
overflow: hidden;
161+
}
162+
163+
.xterm-dim {
164+
/* Dim should not apply to background, so the opacity of the foreground color is applied
165+
* explicitly in the generated class and reset to 1 here */
166+
opacity: 1 !important;
167+
}
168+
169+
.xterm-underline-1 {
170+
text-decoration: underline;
171+
}
172+
.xterm-underline-2 {
173+
text-decoration: double underline;
174+
}
175+
.xterm-underline-3 {
176+
text-decoration: wavy underline;
177+
}
178+
.xterm-underline-4 {
179+
text-decoration: dotted underline;
180+
}
181+
.xterm-underline-5 {
182+
text-decoration: dashed underline;
183+
}
184+
185+
.xterm-overline {
186+
text-decoration: overline;
187+
}
188+
189+
.xterm-overline.xterm-underline-1 {
190+
text-decoration: overline underline;
191+
}
192+
.xterm-overline.xterm-underline-2 {
193+
text-decoration: overline double underline;
194+
}
195+
.xterm-overline.xterm-underline-3 {
196+
text-decoration: overline wavy underline;
197+
}
198+
.xterm-overline.xterm-underline-4 {
199+
text-decoration: overline dotted underline;
200+
}
201+
.xterm-overline.xterm-underline-5 {
202+
text-decoration: overline dashed underline;
203+
}
204+
205+
.xterm-strikethrough {
206+
text-decoration: line-through;
207+
}
208+
209+
.xterm-screen .xterm-decoration-container .xterm-decoration {
210+
z-index: 6;
211+
position: absolute;
212+
}
213+
214+
.xterm-screen
215+
.xterm-decoration-container
216+
.xterm-decoration.xterm-decoration-top-layer {
217+
z-index: 7;
218+
}
219+
220+
.xterm-decoration-overview-ruler {
221+
z-index: 8;
222+
position: absolute;
223+
top: 0;
224+
right: 0;
225+
pointer-events: none;
226+
}
227+
228+
.xterm-decoration-top {
229+
z-index: 2;
230+
position: relative;
231+
}

examples/simple/script.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import LinuxBrowserShell from "linux-browser-shell"
22

3-
let screenDiv = document.getElementById("screen")
43
const shell = new LinuxBrowserShell(
54
{
65
wasm: "./v86/v86.wasm",
76
bios: "./v86/seabios.bin",
87
vga_bios: "./v86/vgabios.bin",
98
cdrom: "./v86/image.iso",
10-
initial_state: "./v86/initial-state.bin.zst",
9+
//initial_state: "./v86/initial-state.bin.zst",
1110
},
12-
screenDiv,
11+
document.getElementById("screen"),
12+
document.getElementById("serial"),
1313
)
1414
shell.boot()
1515

examples/simple/v86/image.iso

0 Bytes
Binary file not shown.

package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"test": "vitest --browser=chrome"
2828
},
2929
"dependencies": {
30-
"async-mutex": "^0.4.0"
30+
"async-mutex": "^0.4.0",
31+
"xterm": "^5.3.0"
3132
},
3233
"devDependencies": {
3334
"@rollup/plugin-legacy": "^3.0.1",

0 commit comments

Comments
 (0)