The system variables stored at addresses 23552 to 23755 are used by the computer to keep track of it’s operation. Look in the TS2068 User Manual, “Appendix D, System Variables” for a list and short description. These stored variables offer quite a few programming possibilities. This article will describe an application for two of them.
The variables being discussed are labelled SPOSN, and are located at addresses 23688 and 23689. Together these two variables store the current PRINT position; that is, where the next character on the screen will be printed. The first address contains the column number, while the second address contains the line number. Well, not the screen positions as we understand them. We would get the screen positions by subtracting the PEEKed value in address 23688 from 24 (for column number), and in address 23689 from 32 (for line number).
In my programming I did a Larken CATalogue, followed by a flashing message ‘Press a key for menu’. I wished to remove the message without clearing the rest of the screen.
I could, of course, have simply had the program ‘PRINT AT x,y;” “‘ to wipe out the flashing message. But in this application the message could appear on most any line; depending on the size of the CATalogue display. I made use of the variables mentioned above.
Figure 1. is a listing of a short program to demonstrate the possibilities. Let’s discuss this listing:
LINE 5: We are assigning a random number to each of variables a and b. The numbers produced by the RND function will be a value always less than 1.
LINE 10. The variables a and b are being used to print “george” at random locations on the screen. The ‘a*22’ selects a random screen line from 0 to 22. The ‘b*26’ similarly selects a screen column. (We have used ‘b*26’, rather than ‘b*32’, so that the “george” will be printed on one line, i.e. it won’t be wrapped around onto the second line. If this happened it would require more complex programming to remove the flashing ‘george’, and tend to obscure the model.
Note also the semi-colon at the end of ‘george’. Without this semi-colon the print position stored in the variable would be at the start of the next line, and the ‘covered’ would always appear at the beginning of the next line. Try it and see.
LINE 15 Pauses for a moment so you can see the ‘george’ is present.
LINE 20 Overlays the flashing ‘george’ with the ‘covered’ message. Because of the way the system stores the information we have to subtract the PEEKed values from the screen size values of 24 and 32.
Note the ‘-6’ in the line. This is because what we have in the system variable is the present PRINT position. But we want to start our overlaid word ‘covered’ six positions back, to the start of ‘george’.
LINE 30 Self explanatory.
Figure 1.
5 LET a=RND: LET b=RND
10 PRINT AT INT (a*22),INT (b*26);"george";
15 PAUSE 30
20 PRINT AT 24-(PEEK 23689),32-(PEEK 23688)-6;"covered"
30 PAUSE 30: CLS : GO TO 1
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.