-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Download Text Mode buffer #1181
Comments
V86 emulates a VGA graphics card. In VGA text mode, applications can use predefined font bitmaps from the VGA BIOS, or they can upload their own font bitmaps into VGA RAM. See here and scroll down to see a couple of screenshots made in text mode with user-defined fonts. So if the guest application uploads its own font bitmaps in VGA text mode it is generally impossible to copy precisely unless you take a screenshot. In the text mode you use (which uses the browser's fonts instead of the VGA fonts) such font bitmaps can also not be displayed, that is why graphical text mode was added recently. In theory you'd be free to define your own font bitmap and accompanying 8-bit code page (preferably using glyphs in your font bitmap that are defined somewhere in the Unicode standard). But there are internationally standardized 8-bit codepages to make this interoperable. Predefined VGA BIOS fonts typically match the widely used code page CP437 (DOS Latin US). Other encodings (like the European CP850) come with their own font bitmaps as part of the operating system. I have a collection of standardized code page mappings for V86 here, it is still work-in-progress but it works. The screen's current text bytes are lineary stored in VGA RAM and can easily be copied into the browser's clipboard. But since text in VGA RAM is 8-bit encoded you need to apply the codepage-to-Unicode mapping here in order to properly copy text out of the VM. To illustrate, here an example screenshot while I had the FreeDOS text editor open with a German poem (note the diacritics and special characters), code page is CP850, graphical text mode: And here is the Unicode text I copied from the same screen to clipboard using the proper Unicode mapping (all diacritics and graphical characters are mapped correctly):
Further reading: So to summarize, it is kinda work-in-progress and the building blocks are there, it only needs to be properly integrated. If you want you can try your image in my V86 embedding (built around V86 at the core), there you can switch between the two text modes, select a code page and are able to copy to clipboard (through the menu). You can also copy from clipboard, but that's a whole different story. |
So, I am making my own mini textual bootloader OS.
Problem is, I'm making a sort of Command Prompt to test my assembly skills.
How it works, is when built, it launches a https://copy.sh/v86/?profile=custom&fda.url=... type of link. (I read the source,
fda.url
is the URL for the floppy image for which I use a Base64 Data URL)I'm currently testing what ASCII value do the keys I input print out. For normal letters or numbers, this is self-explanatory. However, for something like the Enter key, Meta (⊞ for Windows and ⌘ for Mac) key, Ctrl key, Escape, so on, this isn't so explainable. So, I tested the Enter key first. It moved my cursor a bit, which is weird, and probably some compilation-to-WASM bug, granted, but I wanted to see what ASCII value does Enter give off. Turns out, I won't know until I can download the textual output the emulator has, including the special characters that seem to move the cursor around.
So that's why I'm requesting a way to download the buffer from Text Mode as a .TXT (or a .BIN (possibly)).
It would be much more useful than just for devs like me. What if someone painted amazing ASCII art in their emulator, only for a bummer to appear as you can only screenshot for now? Sure, saving as an image is more convenient, but at least add a dropdown to either save as an image or a text file.
And of course, make it only enabled only when Text Mode, Graphics can't be downloaded as text (unless the
▄
and/or▀
chars with a bit of ANSI colors)Thanks for reading, I hope you all like my suggestion to further improve your awesome WASM emulator, and I really like the whole idea of compiling binaries to WASM.
The text was updated successfully, but these errors were encountered: