Menu

#33 PAUSE command

v1.0_(example)
closed-fixed
nobody
pause (1)
5
2016-07-24
2016-03-19
No

Hello!

Just run next program:

print "Hey!"
pause 60
print "Never mind."

Break program, delete PAUSE line and run.

print "Hey!"
print "Never mind."

You see... any program you run for next 60 seconds will not run because the previous PAUSE command still runing in background. You must restart BASIC-256 to fix it.

One more thing. PAUSE command should end immediately on keypress and not wait for the specified time to pass in that case. Also "PAUSE 0" command should wait unlimited time until pressing a key.

Respectfully,
Florin Oprea

Discussion

  • Jim Reneau

    Jim Reneau - 2016-03-23

    I do see the bug and it is with the sleep object not being reset on a stop. I will fix that soon.

    On the pause 0 idea. The sleep object does not have an easy connection to the QT event handler for the text output area to catch the keystroke. I will look at that but do not expect that to be easy.

    Here is a subroutine that has that behavior.

    subroutine wait()
    while key=0
    pause .1
    end while
    end subroutine

    print "press any key"
    call wait
    print "done"

     
  • Florin Oprea

    Florin Oprea - 2016-07-02

    Hi,

    Below is the solution for this bug.
    Change this section in Interpreter.cpp.
    Also, you can delete function void Sleeper::sleepSeconds(double s) from Sleeper.cpp and Sleeper.h.

                case OP_PAUSE: {
                    double val = stack->popfloat();
                    long int ms = val * 1000L;
                    while (ms > 0L && status!=R_STOPPED) {
                        if(ms > 100L){
                            ms -= 100L;
                            sleeper->sleepMS(100L);
                        }else{
                            sleeper->sleepMS(ms);
                            break;
                        }
                    }
                }
    

    Respectfully,
    Florin Oprea

     
  • Jim Reneau

    Jim Reneau - 2016-07-24
    • status: open --> closed-fixed
     
  • Jim Reneau

    Jim Reneau - 2016-07-24

    ixed in 1.99.99.47

     

Log in to post a comment.