Skip to content

Commit

Permalink
Added multiple options to webemulator.
Browse files Browse the repository at this point in the history
Now the webemulator is able to handle the following options:
* ram = amount of memory in steps of 8K (8-2048)
* cpu = c816 or c02
* mhz = speed in MHz, minimum 1
* keymap = same list of keymaps supported as normal emualtor
* longpwron = Boot emulator into RAM diagnostics
* widescreen = enable widescreen if true
* capture = capture keyboard and mouse if true
All of the above options are available on the address/url or in the manifest file.
On the address line longpwron, widescreen & capture do not need values to be enabled.
In the manifest file, they must be set to true.
Options in manifest file take precedens over options on address line.
  • Loading branch information
JimmyDansbo committed Oct 7, 2024
1 parent 555c953 commit ff34c49
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion webassembly/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,36 @@ var manifest_link = url.searchParams.get("manifest");
var ram_val = url.searchParams.get("ram");
var cpu_val = url.searchParams.get("cpu");
var mhz_val = url.searchParams.get("mhz");
var lang_val = url.searchParams.get("keymap");
var diag = url.searchParams.get("longpwron");
var wide = url.searchParams.get("widescreen");
var capture = url.searchParams.get("capture");

var emuArguments = ['-keymap', lang, '-rtc'];

if (ram_val) {
emuArguments.push('-ram', ram_val);
}
if (cpu_val) {
if (cpu_val == 'c816')
if (cpu_val == 'c816') {
emuArguments.push('-c816');
}
}
if (mhz_val) {
emuArguments.push('-mhz', mhz_val);
}
if (lang_val) {
emuArguments.push('-keymap', lang_val);
}
if (diag != null) {
emuArguments.push('-longpwron');
}
if (wide != null) {
emuArguments.push('-widescreen');
}
if (capture != null) {
emuArguments.push('-capture');
}

if (manifest_link) {
openFs();
Expand Down Expand Up @@ -310,6 +327,36 @@ function extractManifestFromBuffer(zip) {
console.log("Parsed manifest from zip:")
console.log(manifestObject);

if (manifestObject.ram) {
console.log('Found RAM amount: '+manifestObject.ram);
emuArguments.push('-ram', manifestObject.ram);
}
if (manifestObject.cpu) {
console.log('Found CPU type: '+manifestObject.cpu);
if (manifestObject.cpu == 'c816')
emuArguments.push('-c816');
}
if (manifestObject.mhz) {
console.log('Found mhz variable: '+manifestObject.mhz);
emuArguments.push('-mhz', manifestObject.mhz);
}
if (manifestObject.keymap) {
console.log('Found keymap variable: '+manifestObject.keymap);
emuArguments.push('-keymap', manifestObject.keymap);
}
if (manifestObject.longpwron) {
console.log('Found longpwron variable');
emuArguments.push('-longpwron');
}
if (manifestObject.widescreen) {
console.log('Found widescreen variable');
emuArguments.push('-widescreen');
}
if (manifestObject.capture) {
console.log('Found capture variable');
emuArguments.push('-capture');
}

const promises = [];
if (manifestObject.resources) {
console.log('Found resources section in manifest.');
Expand Down

0 comments on commit ff34c49

Please sign in to comment.