worker.js 586 B

123456789101112131415161718192021222324252627282930
  1. importScripts("../build/libv86.js");
  2. var emulator = new V86({
  3. wasm_path: "../build/v86.wasm",
  4. memory_size: 32 * 1024 * 1024,
  5. vga_memory_size: 2 * 1024 * 1024,
  6. bios: {
  7. url: "../bios/seabios.bin",
  8. },
  9. vga_bios: {
  10. url: "../bios/vgabios.bin",
  11. },
  12. cdrom: {
  13. url: "../images/linux4.iso",
  14. },
  15. autostart: true,
  16. });
  17. emulator.add_listener("serial0-output-byte", function(byte)
  18. {
  19. var chr = String.fromCharCode(byte);
  20. this.postMessage(chr);
  21. }.bind(this));
  22. this.onmessage = function(e)
  23. {
  24. emulator.serial0_send(e.data);
  25. };