` COMPUTE! ISSUE 50 / JULY 1984 / PAGE 6`

 The Commodore Internal Clock I am trying to write my own game program. I have already programmed my screen display, but I would also like to include an onscreen timer. None of my references mention how I can get a simple TIME REMAINING: XXX SECONDS display on the screen. I have tried loops that subtract 1 from 1000 and print the results on the screen, but so far they either scroll the game display off the screen, or clear the screen. Please help. Mark Adkins Try this BASIC line: ```PRINTTI\$ ``` This will print a six-digit number to the screen. The format is HHMMSS where HH = hours, MM = minutes, and SS = seconds. Unless you have reset the timer yourself, the six digits you see will reflect how much time has elapsed since you turned on your computer. To set the timer, use the same HHMMSS format in this manner: ```TI\$ = "HHMMSS" ``` For example, TI\$ = "123335" would set the clock to 12:33 and 35 seconds. Now enter TI\$ = "000000" and PRINTTI\$ to see the value changed. Setting TI\$ with any value between 000000 and 235959 will start the clock running with that value. Enter and RUN the following short BASIC program and you'll be able to watch the clock as it's running: ```20 PRINT "{HOME}" TI\$: GOTO20 ``` Using the TI\$ function to create a timer can be done with an IF-THEN statement. For example, if you desire a 10-second timer, set TI\$ to 0, then check for the ten-second limit with: IF TI\$ = "000010" THEN… (action desired). Remember that TI\$ returns a string, and its lowest value is seconds. The TI command is much like the TI\$ command except it returns values in seconds and fractions of seconds. Enter ```PRINTTI/60 ``` The numeric value returned here is seconds in the format XX.XXXXXXX. Programming a timer with the TI command is much the same as with TI\$. The TI value is set with the TI\$ command. For example, to set TI at 60 seconds, you would enter: TI\$ = "000100" (one minute). To program the same 10-second timer, you would set TI\$ to zero then check the TI variable with IF TI/60 = > 10 THEN (action desired). The problem of the scrolling screen display can be solved with cursor controls within the PRINT statement. For example, you can use the home (upper left corner of the screen) position as a starting point. Each time you want to print your score, timer, etc., simply use the cursor controls to move to that line, print the display, then move back home.