Translate

Saturday, May 26, 2018

Some Basics 4 MSX Basic ( part 5 )

Some Basics 4 MSX Basic ( part 5 )

Problem: 
Sometimes you cant start the next program automaticly, for example the Wordstore+ Basic replayer. Why ? Cause the replayer removes the entire Basic program that started the replayer.

Example:

10 PRINT Play the WS+ sample"
20 BLOAD "sample.ws",R
30 A=USR(0)
40 END

It wil not work. After the BLOAD the whole Basic program is gone.

Solution: 
An easy methode is, let the user press a key to start the next part of the program.
 Example:  

10 ' Some Basics 4 MSX Basic 5
20 SCREEN 0
30 PRINT "Press ENTER to run this program again"
40 PRINT:PRINT "run"
50 LOCATE 0,CSRLIN-2
60 END 

The trick is in line 50. The CSRLIN has the value of the current Y coordinate on the text-screen. We extract 2 from the current Y coordinate, so the cursor will be on the first character of the word "run" and we end the program. 

If the user press ENTER, it will start then same program again.
Of course instead of "run" you can use "BLOAD"sample.ws",R".

It's not very fancy, but I used this trick  a couple of times, 
cause I didn't had a better solution.

No comments:

Post a Comment