[ Go to Stephen's Entry Page ]
[ TI99/4a Articles index |    TI Book front page |    TI Resources Page |   PC99 Programs ||    TI*MES 39 ||    TI*MES 41 ]
contact - please use subject="pc99 page" to avoid spam trap!

========================

This web page contains the text of articles for owners of the TI-99/4a from Issue 40 TI*MES (Spring 1993). It is of use to users of the TI-99/4a emulators.
This is one of those issues where I sent in my copy to the editor and the magazine was edited by somebody else, who did not have my copy, and inserted a great deal of material from US newsgroup magazines. There were 74 pages with content, which included six pages of a game in tiny print; six pages of 9900 source code for disk i/o access; seven pages on educational modules from a US user group (with an American terminology and culture); and 11 pages of Tips from the Tigercub. Below is a selection of the remaining material...
A disk library update that I submitted for this issue finally appeared in the Winter issue, having been omitted from the Spring, Summer and Autumn issues! Completely missing were around 60 pages I had written for the three issues.
This was a difficult time for me and for the group- my mother was dying, my blind diabetic father also required care, we had to find a new place for them to live, sell the old house... not too much time to deal with the TI Group falling apart. I had to miss the very important 1993 AGM alas, a great pity but it was quite impossible.
Disk Library Updates I submitted for this and later issues were finally included in TI*MES Issue 48 - two years onwards.

Items from TI*MES Issue 40 Spring 1993

From the chairmans chair

Well another issue has arrived with you. We must apologise for the slightly late issue this quarter. Unfortunately Alan Baily our Editor has been very ill in Hospital. However with lots of rest and help and some good reading in this book he will most likely be back with us doing the fantastic job that he does. It is no mean feat taking on and collating this little lot. I should know I have just completed this issue on Alans behalf. So from all of us Get Well Soon!!

Last time we looked at Joystick and Randomize routines, this time we will look at the Coincidence of Sprites. TI EXTENDED does have a little routine for doing this called CALL COINC. This takes two Sprites, allows a tolerance and then returns a variable. If the variable is -1 then a coincidence, 0 if not.

You can also do Sprites with Dot Row Dot Column positions with the same tolerance and numeric variable. Last but not least the CALL COINC ALL with numeric variable. Great but not very flexible is it. Now there is a formula that is very useful to the TI programer. Its called the 49 formula. This little baby is expressed as (TO-FROM)*0.49. The TO and FROM being numeric variables.

To demonstrate the 49 Formula here is a little program thats puts a sprite on the screen at a random position and spots it by its placement variables then shoots another to hit it. As can be seen the whole program runs without CALL COINC. Try doing this with COINC and you will find it almost impossible to detect the sprite to a 100%, this program does!!!

100 CALL CLEAR :: CALL SCREE
N(2) :: CALL CHAR(46,"0000001
818") :: CALL SPRITE(#2,94,16
,180,1,0,5)
110 FOR N=0 TO 25 :: RANDOMI
ZE :: CALL PEEK(-31808,Y,X) :
: CALL SPRITE(#3,65+N,16,Y/2
+1,X+1) : : CALL SOUND(-60,660
,8)
120 CALL POSITION(#3,Y,X,#2
R,C) :: CALL SPRITE(#1,46,16,
R,C,(Y-R)*.49, (X-C)*.49) :: C
ALL SOUND(476,-3,14)
130 CALL SOUND(120,110,6) ::
CALL DELSPRITE(#1) :: CALL PA
TTERN(#3,35) :: CALL SOUND(10
0,220,6):: NEXT N :: GOTO 11
0

[2015 note- line 130 as printed read CALL DELSPRITE(3!0 :: . There was no correction in later issues so I have made a best guess as to what was intended. Line 110 also contained an error and again best guess has been used above!]

Very neat is'nt it. I will now go through the program with you, however I will not explain the simple call Clears and screens etc:
100 sets up Sprite (#2) setting off a ^ symbol across the screen at a velocity speed of 5 from dot row 180 dot col 1.
110 then starts a for next loop and starts the Call Peek RND routine. (described last magazine) . It then puts Sprite #3 at a random location with some sound, and cycles through the alphabet by adding to ASCII char 65 the loop value of N.

120 then gets the position of #3 and #2.
Sprite #1 is then launched with the Formula 49, with added Sound.
130 then with call sound statements slows the routine for correct timing then loops to the next letter (For Next Loop remember). After the loop is done then it starts back at 110 and does it all again.

As you can see not a CALL COINC in sight. What you have been able to do is some very complex maths with the minimum of memory and with speed to boot. You can also use this 49 formula in chase the sprite type situations. Try this:
100 CALL CLEAR :: CALL SCREE
N(5):: CALL MAGNIFY(2):: CAL
L SPRITE(#1,77,16,100,100,#2
,71,16,30,30)
11O RANDOMIZE :: CALL PEEK(
31808,Y,X) :: CALL SOUND(60, 1
000-Y*3,4) :: CALL LOCATE(#1
Y/2+1,X+1)
120 CALL POSITION(#2,R,C,#1,
Y,X) :: CALL MOTION(#2, (Y-R*
0.49, (X-C)* .49) :: CALL SOUND(
300,880-Y*3,15) :: GOTO 110

As you can see the line 100 is the setup and starts Sprites #2 and #1. Line 110 does our friend the randomize, adds a bit of sound then locates Sprite #1 with the row col variables from the RND peek with Y/2+1,X+1.
Line 120 then finds the position of Sprite #2 and #1 then Formula 49 is then used in the Call Motion routine on Sprite #2, then a little sound with the value of Y altering the frequency.
The sound call also acts as a delay. If you want to speed things up try the value -60 in the call sound statement in line 110. Then we jump back to 110 and do it all again.

You ask your self, how does one get to the Formula 49 in the first place. Well its simple when you know how. The .49 in fact is a limit control on your sprites. The highest legal velocity for any sprite is 125 (see your manual). You also know that sprites can go from 1 to 256 in both dot row and column however after dot row 193 your sprite is off your screen so you normally use 192-193 as a restraint. (see page 173 of Manual) So anything above that will bloop.

So the formula that places one sprite, at a given location, in motion towards another location is (DOT ROW To, Minus DOT ROW From)*.49,(DOT COLUMN To Minus DOT COLUMN From)*.49, so if we look at this you can keep your sprites in a set area on your screen. Say you want to keep you sprites in the area dot row 17 through to say 185 and dot columns 17 through 185 then you can adjust the formula 49 to another value like this:-
(185-17=168, 127/168=.7559
therefore .75*168=126
So the .49 now =.75
With this simple formula in the Call Motion statement the greater the distance the higher the velocity will be. Try adding this new formula to the above program to see it work.

Just to add a little fun to the program we will now put into the routine a joystick control .
Replace the following lines with these.
110 CALL JOYST(1,X,Y):: CALL
MOTION(#1,4*-Y,4*X) : : CALL
POSITION(#2,R,C,#1,Y,X) : : CA
LL MOTION(#2, (Y-R)*.49, (X-C)
*.-49) :: CALL COINC(ALL,A)
120 IF A THEN CALL SOUND(-10
0,-2,8):: GOTO 110 ELSE CALL.
SOUND(-150,630-R-C,15) :: GO
TO 110


As you note Call Coinc has been used but in conjuction with the Formula 49.

Just to finish off this quarters program hints and tips here is one for you to work out without me telling you how it works.

100 CALL SCREEN(2) :: A=1 ::
FOR N=1 TO 28 :: CALL. SPRITE
(#N,42,16,N*6,ABS(N+249* (A<1
)),-6,N*2*A) :: A=-A :: NEXT
N
110 GOTO 110

T Stevens 1992

Console Power Supply

I have had some problems recently with console lock ups, which did not seem to go away when cleaning module or side connector contacts.
Then I found a text advising that the console was very prone to lock up if the mains supply varied by more than about 5%.
That was my problem! Too low a voltage- keeps the bills down but not too good for computers. The solution was to remove all high wattage devices from the console mains ring when using the computer. The resulting small increase in supply voltage did the trick.
Over at my parents house we measured a supply voltage more than 5% OVER the standard 240v, and this was confirned by the electricity supplier who put in a recording meter- high voltages put up bills and burn things out. Their supply voltage has now been adjusted to 240v.
[2016 update- and I have from time to time seen a mains voltage at home at 5% over 240v - but now we should be keeping to a European 230 volts. Except our suppliers are keeping their equipment at 240v whilst we import equipment set for 230v. The theory is that 240v is less than 5% higher than 230v and equipment should cope. Problem is that 5% over 240v is actually 10% over 230v. However whatever the European standard says, everyone seems happy, especially equipment manufacturers as you buy more of their product which is burning out faster... now you know why your ten year light bulbs fail after 18 months!]
So, any problems with electrical things, check your mains voltage- our privatised suppliers do not seem too worried about the voltage they feed to us these days!
stephen

From Brisbane

BITS and PIECES
by Col Christensen - Brisbane User Group Australia
SPRITELY SPRITES
Just a few little items in Extended Basic first. This one is a good old favourite called 3D Sprites we used to show to those poor souls with inferior computers to make their mouths gape.
Just one program line and great things happen. If you don't know the routine, try it and see
100 CALL CLEAR :: CALL SCREE
N(2) :: CALL MAGNIFY(2) :: FOR
X=1 TO 26 :: CALL SPRITE(#X
,X+64,INT(X/2)+3,10,40,30,10
4-X*8) :: NEXT X :: INPUT A$

Here is a little demo program I made many years back to demonstrate the priority of sprites and illustrates the effect of a sprite of higher priority masking out any of lower order when they coincide on the screen.
100 CALL CLEAR :: CALL SCREE
N(2) :: CALL MAGNIFY(2):: C=3
:: RANDOMIZE
110 CALL CHAR(42,"FFFFFFFFFF
FFFFFF")
120 CALL CHAR (36 , "00001F1131
F1FF42")
130 FOR X=1 TO 27 STEP 2
210 C=C+3 :: IF C>16 THEN C=
C-14
140 CALL SPRITE (#X,42,C,180-
X*4,220-X*6)
150 NEXT X
160 C=4
170 FOR X=2 TO 28 STEP 2
180 SP=INT (RND*12+5)
190 C=C+3 :: IF C>16 THEN C=
C-14
200 CALL SPRITE(#X,36,C,180-
X*4,220-X*6,0,-SP)
210 NEXT X
220 GOTO 220
Remember those messages picked out with monster LEDs that move across a display (the message not the LEDs). This is another demo routine used way back in the early 1980s simply by using the DISPLAY AT statement and was incorporated in an XBasic LOAD program
100 CALL CLEAR
110 A$=RPT$(" ",29)&"THE TI-
99/49 IS A COMPUTER MILES ABOVE
ITS CLASS AND CAN RUN RINGS ROU
ND ITS POOR COMPETITORS"
120 DISPLAY AT(22, 1)SIZE(28)
:A$
130 A$=SEG$(A$,2,LEN(A$)-1)&
SEG$(A$,1,1)
140 GOTO 120



Go to top of page

[ TI Book front page    |    TI Resources Page    |   PC99 Review    |   PC99 Programs ]