My MSX Basic tips and tricks part 3. Yes, I know more than just a few tricks.
Problem: How to generate GFX on an MSX-1, without showing how it's generated?
Solution: Using DEFUSR=&H41 and DEFUSR=&H44 commands
Example:
100 SCREEN 0
110 PRINT "This screen will be switched OFF"
120 PRINT "and switched ON after printing texts"
130 FOR T=1 TO 1600:NEXT T
140 DEFUSR=&H41: A=USR(0)
150 FOR T=1 TO 160
160 PRINT "ON on ";
110 PRINT "This screen will be switched OFF"
120 PRINT "and switched ON after printing texts"
130 FOR T=1 TO 1600:NEXT T
140 DEFUSR=&H41: A=USR(0)
150 FOR T=1 TO 160
160 PRINT "ON on ";
170 NEXT T
180 DEFUSR=&H44:A=USR(0)
190 IF INKEY$="" THEN 190
200 CLS:END
180 DEFUSR=&H44:A=USR(0)
190 IF INKEY$="" THEN 190
200 CLS:END
The lines 150 t/m 170 are just to generate some text to show what had been hidden.
Line 180 switched the screen ON and you see the generated texts for the first time.
Then another trick in line 190, this is the easiest way to wait until the user pressed a key.
However, SHIFT, CTRL, GRAPH, CODE and other special keys will not work.
The DEFUSR trick works in any SCREEN, but in the SCREEN 4 and higher (on MSX-2
and higher) you can use the SET PAGE command to display a nice waiting screen while generating other GFX on other pages. On SCREEN 0,1,2,3 you don't have pages and this DEFUSR trick works very well.
No comments:
Post a Comment