From 8c0448909e09869a57da903ec4b4d036c2d0e421 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 25 Aug 2023 17:52:52 -0600 Subject: [PATCH] UI for floppy insertion/ejection --- debug.html | 11 +---------- index.html | 13 +------------ src/browser/main.js | 26 ++++++++++++++++++++++++++ src/browser/starter.js | 2 +- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/debug.html b/debug.html index cb310ab148..5d0f61f8b1 100644 --- a/debug.html +++ b/debug.html @@ -262,6 +262,7 @@

Debugger

+ @@ -278,16 +279,6 @@

Debugger


- - - -

diff --git a/index.html b/index.html
index 14bf1fbf98..7ca036d816 100644
--- a/index.html
+++ b/index.html
@@ -185,6 +185,7 @@ 

Setup

+ @@ -201,18 +202,6 @@

Setup


- - - - -
- diff --git a/src/browser/main.js b/src/browser/main.js index 9a6a5abf47..acda9b4d8e 100644 --- a/src/browser/main.js +++ b/src/browser/main.js @@ -1704,6 +1704,32 @@ }; } + $("change_fda_image").value = settings.fda ? "Eject floppy image" : "Insert floppy image"; + $("change_fda_image").onclick = function() + { + if(emulator.v86.cpu.devices.fdc.fda_image) + { + emulator.eject_fda(); + $("change_fda_image").value = "Insert floppy image"; + } + else + { + const file_input = document.createElement("input"); + file_input.type = "file"; + file_input.onchange = async function(e) + { + const file = file_input.files[0]; + if(file) + { + await emulator.set_fda({ buffer: file }); + $("change_fda_image").value = "Eject floppy image"; + } + }; + file_input.click(); + } + $("change_fda_image").blur(); + }; + $("memory_dump").onclick = function() { const mem8 = emulator.v86.cpu.mem8; diff --git a/src/browser/starter.js b/src/browser/starter.js index 8dae60219f..51fddf2f13 100644 --- a/src/browser/starter.js +++ b/src/browser/starter.js @@ -994,7 +994,7 @@ V86Starter.prototype.set_fda = async function(file) { this.v86.cpu.devices.fdc.set_fda(image); }; - image.load(); + await image.load(); } };