js-dos 8.xx Help

Run without bundle

As explained in other topics, the bundle is a preferred way to run DOS program. Bundle can contain much more configuration that DOSBox excepts, for example, mobile controls, resources, etc.

Provide dosbox.conf directly

js-dos can work without a bundle, but at least it needs a DOSBox config file to start. You can create js-dos player by providing config using javascript:

Dos(document.getElementById("app"), { dosboxConf: ` [autoexec] mount c . c: `, onEvent: (event, ci) => { if (event === "ci-ready") { // ci: [[[CommandIterface|command-interface.html]]] is ready } }, });

Additionally, you can provide jsdos.json configuration, for example, here we start js-dos with one virtual button.

Dos(document.getElementById("app"), { dosboxConf: ` [autoexec] mount c . c: `, jsdosConf: { "layersConfig": { "version": 2, "layers": [ { "grid": "honeycomb", "title": "Layer#0", "controls": [ { "row": 0, "column": 0, "symbol": "↑", "type": "Key", "mapTo": [ 265 ] } ] } ] } }, });

Having config allows you to start DOSBox / DOSBox-X, but it is not very useful without a program to run. To init FS before emulation starts, you need to use initFs property. It's a sequence of files, in the following format:

initFs: [ { path: string, contents: Uint8Array }, ... ],

Where path is a full path to file, contents is a body of file.

Using the following snippet you will create two files:

  • 1.txt with contents "123"

  • 2.txt in directory D with contents "345"

Dos(document.getElementById("app"), { dosboxConf: ` [autoexec] mount c . c: `, initFs: [ { path: "1.txt", contents: new TextEncoder().encode("123") }, { path: "D/2.txt", contents: new TextEncoder().encode("345") }, ], onEvent: (event, ci) => { if (event === "ci-ready") { // ci: [[[CommandIterface|command-interface.html]]] is ready } }, });

Now when you run it, you can check your files with TYPE command:

Init fs
Last modified: 18 ноября 2024