TIMER substitute for Color BASIC

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

TIMER substitute for Color BASIC

Post by zephyr »

The following routine can be used to add a TIMER substitute to a CoCo with Color BASIC only. This routine is useful for randomising the RND() function.

Code: Select all

10 POKE243,190:POKE244,0:POKE245,254:POKE246,48:POKE247,1:POKE248,191
20 POKE249,0:POKE250,254:POKE251,126:POKE252,169:POKE253,179
30 X=65283:POKE X,PEEK(X)AND254:POKE269,0:POKE270,243:POKE X,PEEK(X)OR1
Use the following instead of X=RND(-TIMER) to randomise the RND() function.

Code: Select all

X=RND(-(PEEK(254)*256+PEEK(255)))
Last edited by zephyr on Wed Jan 23, 2013 11:08 am, edited 1 time in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: TIMER substitute for Color BASIC

Post by zephyr »

Here is a more sophisticated routine which emulates ECB's TIMER via the USR() function.

e.g.

"PRINT USR(A$)" is the same as "PRINT TIMER".
"T=USR(A$)" is the same as "T=TIMER".
"A=USR(32767)" is the same as "TIMER=32767".
"X=RND(-USR(A$))" is the same as "X=RND(-TIMER)".

Code: Select all

10 'TIMER FUNCTION V1.0
20 'FOR TANDY COLOR BASIC
30 'BY STEVE EVANS
40 '2ND APRIL, 2012
50 '
60 IF PEEK(32768)+PEEK(32769)=157 THEN END
70 CLEAR200,PEEK(116)*256+PEEK(117)-88
80 START=PEEK(116)*256+PEEK(117)-87
90 CH=0:FOR I=0 TO 88:READ A:CH=CH+A:POKE START+I,A:NEXT
100 IF CH=8514 THEN EXEC START ELSE PRINT"ERROR IN DATA LINES."
110 END
120 '
130 'PRINT TIMER > PRINT USR(A$)
140 'T=TIMER > T=USR(A$)
150 'TIMER=32767 > A=USR(32767)
160 '
170 DATA 26,80,48,141,0,74,188,1,13,39,23,252,1,13,191,1,13,237,7,48,141,0,14
180 DATA 191,1,19,182,255,3,138,1,183,255,3,28,175,57,150,6,38,18,134,40,158,166
190 DATA 48,31,161,132,38,250,159,166,189,183,61,159,118,57,158,118,159,82,15,80,15
200 DATA 81,15,6,15,99,15,84,198,160,215,79,126,186,28,158,118,48,1,159,118,126,169,179
Attachments
USRTIMERv10.zip
(1.98 KiB) Downloaded 171 times
Post Reply