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

CCP should reload on Ctrl-C #17

Closed
skx opened this issue Jun 20, 2024 · 2 comments
Closed

CCP should reload on Ctrl-C #17

skx opened this issue Jun 20, 2024 · 2 comments

Comments

@skx
Copy link
Contributor

skx commented Jun 20, 2024

The documentation for Function 10: Read Console Buffer says, in the keybinding section:

  • CTRL-C reboots when at the beginning of line

That's something I've been used to pressing at the CCP prompt, because it can trigger the execution of a $$$.SUB file (and also allowed you to swap disks back in the day)

However your emulator doesn't reload - while #13 is open you could see the difference in "running" vs "restart" by watching the change of user-number, or drive, and of course until #16 is resolved SUBMIT is a non-issue too.

You catch Ctrl-C for your "exit emulation" so I guess this might need some reworking. I did the same thing for a long time, but eventually patched in a HALT, EXIT, and QUIT command to the CCP - they just run HALT instructions which is enough for my emulator to terminate.

I also defaulted to requiring two CtrlCs in a row to trigger the reboot, but later relented and made this configurable at run-time, via a bios extension and/or CLI flag.

I guess this is a minor issue as reloads happen after control returns from child processes, but I admit I've become very familiar with pressing the key as a matter of habit nowadays.

@skx
Copy link
Contributor Author

skx commented Jun 22, 2024

FWIW I did change the code to restart, and that was trivial:

--- a/src/bios.rs
+++ b/src/bios.rs
@@ -70,14 +70,13 @@ impl Bios {
     }
 
     pub fn stop(&self) -> bool {
-        self.ctrl_c_count > 1
+        self.ctrl_c_count > 0
     }
 
     pub fn execute(&mut self, reg: &mut Registers, call_trace: bool) -> ExecutionResult {
         if self.stop() {
-            // Stop with two control-c
             self.ctrl_c_count = 0;
-            return ExecutionResult::StopConfirm;
+            return ExecutionResult::WarmBoot;
         }

The real question isn't so much how to do the reboot, but how you want to handle things.

If you want to continue using Ctrl-C to exit the emulator then the use of of that character is ruled out - if you can use another character, or require "SPACE Ctrl-C Ctrl-C Y" (which might be too wordy to be memorable) then things get easier.

@ivanizag
Copy link
Owner

I was just writing a fix for that. I thought initially that this feature would be on the CCP code, but it is really on BDOS: https://github.com/brouhaha/cpm22/blob/main/bdos.asm#L573

I'll do a fix on BDOS instead of in the BIOS.

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

No branches or pull requests

2 participants