How to get 1 bit cursor
1. Using js-dos api#
To run bundle you just need a one line of code:
Dos(document.getElementById("jsdos")).run("some.jsdos");
Dos receives HTMLDivElement and uses it to create the player UI. To run jsdos bundle just use its method run specifying the url of jsdos bundle.
To use js-dos you need to add js-dos.js script, and js-dos.css style (releases). Also you need to specify path prefix of js-dos installation:
<script src="<path>/js-dos.js"></script>
<link href="<path>/js-dos.css" rel="stylesheet">
// ...
<script>
emulators.pathPrefix = "<path>/";
Dos(<element>).run(<bundleUrl>);
Complete example:
examples/dos.html
Run
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body, #jsdos {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="/v7/build/releases/latest/js-dos/js-dos.js"></script>
<link href="/v7/build/releases/latest/js-dos/js-dos.css" rel="stylesheet">
</head>
<body>
<div id="jsdos" />
<script>
emulators.pathPrefix = "/v7/build/releases/latest/js-dos/";
Dos(document.getElementById("jsdos"))
.run("https://doszone-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/2X/2/24b00b14f118580763440ecaddcc948f8cb94f14.jsdos");
</script>
</body>
</html>
INFO
By default, js-dos will load wasm modules relatively from current path, you should specify variable pathPrefix if you want to load them from different place:
emulators.pathPrefix = "<some-path>/";
2. Using emulators-ui (without js-dos services)#
js-dos v7 is based emulators and emulators-ui packages. It provide additinal services over this two packages, if you don't need them, then you can you need to use emulators and emulators-ui packages instead.
To change code above to use emulators and emulators-ui just change scripts imports to:
<script src="emulators/emulators.js"></script>
<script src="emulators-ui/emulators-ui.js"></script>
<link rel="stylesheet" href="emulators-ui/emulators-ui.css">
Complete example:
examples/ui-dos.html
RunCopy
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body, #jsdos {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="/v7/build/releases/latest/emulators/emulators.js"></script>
<script src="/v7/build/releases/latest/emulators-ui/emulators-ui.js"></script>
<link rel="stylesheet" href="/v7/build/releases/latest/emulators-ui/emulators-ui.css">
</head>
<body>
<div id="jsdos" />
<script>
emulators.pathPrefix = "/v7/build/releases/latest/js-dos/";
Dos(document.getElementById("jsdos"))
.run("https://doszone-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/2X/2/24b00b14f118580763440ecaddcc948f8cb94f14.jsdos")
</script>
</body>
</html>
3. Using emulators#
In case you don't want to use the browser API of js-dos project, you can use just the emulators package. Read the guide to how we use emulators to estimate js-dos performance.