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

Investigate real time clock, does it pause when text boxes are shown. #5

Open
sonneveld opened this issue May 13, 2022 · 1 comment

Comments

@sonneveld
Copy link
Owner

sonneveld commented May 13, 2022

Double check if NAGI should pause real time clock when text boxes are shown, or if it's handled per game.

The clock_state normally affects the behaviour of the timer but it is not modified in many places. Was the original interpreter relying on disabling interrupts to pause the timer?

@AGKorson
Copy link

For MSDOS interpreter - In the timer interrupt function (it's a custom INT set up when AGI starts that runs 20 times per second), AGI updates a running 'tick count', using two 16bit values. This tick counter is used to manage checks for input (keyboard/joystick timing), counting cycles for the shake.screen command and the print window delay (when using v21).

The clock_state value is also checked in each clock interrupt cycle. If it is false (0) then the game's internal clock (v11 - v14) is updated; every 20 ticks it increments v11 (seconds), adjusting others as needed. clock_state is set to true (1) in the pause(), restore.game() and save.game() commands. Those are the only places where the internal clock is paused.

The timer interrupt ALWAYS runs; it is never disabled. It's the clock_state value that determines when to advance the game clock.

You can't really 'pause' the internal clock in logics code; v11-v14 will always update automatically (unless pause/restore/save commands are active). You can create the effect of a pause by watching for changes, then forcing them back to whatever time you want them to be.

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