Skip to content
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

Emulator filing system trap opcodes #15

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Emulator filing system trap opcodes #15

wants to merge 12 commits into from

Conversation

chrisn
Copy link
Collaborator

@chrisn chrisn commented Apr 15, 2017

This pull request supersedes #14 by fixing the line endings and restoring changes on master that were overwritten.

I've also moved the documentation changes to the update-documentation branch (see #11).

@chrisn
Copy link
Collaborator Author

chrisn commented Apr 15, 2017

@jgharston Please take a look. This is missing some changes to the resource file beebem.rc to add menu items for the emulator trap commands which weren't part of your pull request (ID_EMTACN, ID_EMTWSS, and ID_EMTBAS).

@jgharston
Copy link
Contributor

jgharston commented Apr 20, 2017 via email

@mungre
Copy link
Collaborator

mungre commented May 15, 2017

I've put a version of beebem.rc relative to this pull request here: https://github.com/mungre/beebem-windows/commits/emulator_traps

I'll get write access here and then add it here.

@chrisn
Copy link
Collaborator Author

chrisn commented May 15, 2017

@mungre I've just granted you write access. If you add the .rc file changes to this branch I can test and merge to master.

@mungre
Copy link
Collaborator

mungre commented May 15, 2017

@chrisn Thank you, there's a new commit.

@chrisn
Copy link
Collaborator Author

chrisn commented May 15, 2017

Thanks! I'll try this out now...

@chrisn
Copy link
Collaborator Author

chrisn commented May 15, 2017

I'm not sure how to use this feature, any suggestions? It might be helpful to add some info to the HTML documentation.

@mungre
Copy link
Collaborator

mungre commented May 15, 2017

Load the VDFS05 sideways rom, enable "WFS/VDFS traps", run *VDFS and then *. You get a list of files in the current directory on the PC! And you can load and save them. It's very impressive. "*DIR \" takes you to the root. "*DIR :D" changes drive. Though it's easy to forget you're no longer in a sandbox. I managed to overwrite one of my BASIC files with garbage.

I don't know what the other two options on the menu do.

@chrisn
Copy link
Collaborator Author

chrisn commented May 16, 2017

Some related discussion of a similar feature in B-Em: stardot/b-em#24

@mungre
Copy link
Collaborator

mungre commented May 18, 2017

I found a bug: *DELETE succeeds but still raises the error "Bad command".

There are some points about security here: http://stardot.org.uk/forums/viewtopic.php?t=11654 This implementation does write .INF files.

jgh has documented the opcodes at the bottom of this: http://mdfs.net/Docs/Comp/6502/OpList

@chrisn
Copy link
Collaborator Author

chrisn commented May 19, 2017

A couple of thoughts: The B-Em issue discusses a different approach. I think both emulators should be consistent, so that software works as expected in both when this feature is enabled. Also, I tend to agree with comments about sandboxing in the stardot thread.

@mungre
Copy link
Collaborator

mungre commented May 19, 2017

You can access host files using VDFS in a consistent manner on both emulators. Providing a consistent low-level interface would only encourage people to code to it. That said, jgh has implemented an existing trap mechanism so presumably there is already some software somewhere that uses it. But possibly only the equivalent of VDFS in the original emulators.

Anyway, I don't feel strongly about consistency in the low-level interface.

The sandboxing is a concern. I am reminded of this and more seriously this.

Some random thoughts: at the moment VDFS just uses the process current directory so it changes directory every time you access one of the file dialogs. This is a pain. It needs at least a VDFS root directory and a VDFS current directory. The UI could be drag-and-drop (as suggested in the original post) or a directory selection dialog. Should it default to a new folder User\Documents\BeebEm\VDFS? Should a new root be saved automatically? I think not. Should it be saved by "Save Preferences"? I think it should. What about if "Autosave All Prefs" is selected? Probably. A command-line option to set the root would be enormously useful for development. This could also enable the traps. Otherwise people will get bored of setting them manually and leave them enabled.

@chrisn
Copy link
Collaborator Author

chrisn commented Jul 4, 2017

A user-configurable root directory sounds like the right approach. I'm happy to work on it, time allowing.

@mungre I could also take a look at the *DELETE bug, unless you're already working on a fix?

@jgharston Would you be willing to write some HTML documentation?

@mungre
Copy link
Collaborator

mungre commented Jul 5, 2017

@chrisn I've been meaning to look at this but other stuff keeps happening. Anyway, I've pushed a fix for the *DELETE bug.

@chrisn
Copy link
Collaborator Author

chrisn commented Jul 7, 2017

@mungre I have a similar issue with "stuff" :-) Thanks for the fix!

Src/host.cpp Outdated
int host_quit(int dorts) {

#ifdef WIN32
ShowWindow(GETHWND, SW_MINIMIZE);
Copy link
Collaborator Author

@chrisn chrisn Aug 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note sure that code running in the emulator should be able to do this.

@jgharston
Copy link
Contributor

jgharston commented Aug 13, 2017 via email

@chrisn
Copy link
Collaborator Author

chrisn commented Aug 13, 2017

My comment was in reference specifically to minimising the application window: ShowWindow(GETHWND, SW_MINIMIZE);

@jgharston
Copy link
Contributor

jgharston commented Aug 14, 2017 via email

@SteveFosdick
Copy link

A bit late to the party here but just picking up on Chris's link to a feature request on B-Em above (stardot/b-em#24).

On the question of the exact mechanism by which a trap is made from the emulated BBC to the emulator, or indeed standardisation of "opcodes" for those traps, I also agree with the point already raised that this is not an API that user programs should be written to. In an implementation of something like VDFS there are cases where at least some of the code for a particular operation could be written in 6502 assembler and put in the service ROM or written in C/C++ and run on the host, i.e. the exact function of the traps may not be to provide some function that is useful to user programs directly but to compliment code in the service ROM.

For filing operations the API user programs should work to is the OS API within the emulated BBC micro, i.e. OSFILE, OSFIND, OSARGS, OSBGET, OSBPUT, OSGBPB etc.

In the event the trap mechanism is extended to cover non-filing operations that may be common to multiple emulators it would be better to standardise either OS commands (.e.g. *QUIT etc) or OSWORD calls.

@chrisn chrisn force-pushed the jgh/bugfixes branch 3 times, most recently from e197e0e to 8837b1c Compare November 25, 2017 17:00
@chrisn chrisn changed the title Emulator filing system trap opcodes, plus various bugfixes Emulator filing system trap opcodes Nov 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants