THE COLT MINI-FAQ
-----------------

1) Why won't my program compile?

You're using a command that COLT doesn't allow! Probably... COLT is very
good at reporting back errors - check out the line it stops on and read
the manual again!


2) Do I have to save the entire compiler with my compiled code?

Yes! It won't work without it!


3) How the bloody hell do I use Random Numbers?

A very good question! Colt's handling of RND is very different to normal
Speccy Basic. Rather than returning a floating point number between 0
and 1, it returns an integer between 0 and 32767. This is much harder to
scale between two limits than the normal version...

However, all is not lost! Enter Matt Wenham, who explained the 
following procedures :

METHOD ONE
----------
This is quite complex, but works.

	10 LET a=RND: LET start=1: LET end=10
	20 LET y=(end-start)+1
	30 LET x=start+a-((a/y)*y)
	40 PRINT x
	50 GOTO 10

The routine will print random numbers between the values of START and
END, inclusive. Of course, it will only work when compiled....

For the sake of efficiency, always hard code the start, end and
(end-start)+1 values if you possibly can, as this saves looking up the 
variable values and will increase the code efficiency.

Unfortunately this isn't a very 'fair' routine, and higher and lower
numbers will be more likely to be picked than mid-range ones.


METHOD 2
--------
To get a nice even spread of numbers in a simpler manner, you can use
the following code :

	10 LET max=10
	20 LET n = RND / (32768/(max+1))
	30 IF n>max THEN GOTO 20
	40 PRINT n
	50 GOTO 20

Line 20 (nearly) uniformly scales 0->32767 to 0->max but with a small
probability that the result will be max+1. This is trapped for by the
code in line 30 (and it is a very small probability). 

If you hard coded (32768/(max-1)), the process would involve a single 
division and a single comparison, which will probably be faster than 
the first method.


METHOD 3
--------
This method was sent to me by Stephen Smith, and is very similar to
method 2, but slightly smaller and slightly less accurate, as described
by Matt....

	10 LET max=10
	20 LET n = RND/(32767/max)
	30 PRINT n
	40 GOTO 20

This version makes 'max' less probable than any other number, but it 
doesn't suffer from the small probability of the result being greater 
than 'max'.


Basically you should choose whichever method suits you best. For the
purposes of games, it would seem that ANY of these methods would be
okay, as the "randomness" of the numbers is seldom an issue.


4) My variables seem to "magically" lose their values!

I had this problem a couple of times and can't quite explain it! It
would seem to be a bug, but I can't say how to reproduce it as it seems
to happen randomly.... There is a way around it though - you need to
"refresh" your variables just before they fail.

i.e. if line 500 of your program is

500 PRINT AT y,x;"A"


and the compiler suddenly complains that y is out of range when you know
for a FACT that you set it to 5, then this is probably the bug at work.
To fix it, do this :

500 LET y=y
501 PRINT AT y,x;"A"


For some reason this seems to "remind" the compiler that your variable
is set to the right value. You may never come across this bug, but if
you do I hope you won't end up tearing your hair out like I did! :-)


5) I have my game as a snapshot - how do I get the COLT into there at
   the same time as my game without resetting?

Tricky! You'll have to save your game out to a TAP file, load the COLT
and then load your program back in from the TAP. Z80 and X128 both allow
you to save to a TAP file.


6) Are there any commercial games written with the COLT?

Yes! Quite a few, apparently. The COLT first came to my attention
because I found out that a commercial game that I had was written with
it! Take a look at any of Grant Jaquest's releases on the Power House
label - several of those are COLT compiled (Dispoable Heroes and Norman,
for example).


7) Does the COLT work on 128k Spectrums?

Yes and no. It will work on a Spectrum 128, but only in 48k mode. You
can't compile 128k-specific BASIC commands or access the sound chip from
BASIC using COLT, as far as I know. If you can prove me wrong then
please do! :-)


8) Can I send you my game to look at?

Sure you can! I'm always happy to see new Speccy games.... :-)




COLT Mini-FAQ compiled by Blood!

*================[ LTonks@iclretail.icl.com ]=================*
                    The Infamous BLOOD!                      
         The Speccy's not dead - it was just resting!        
 Who needs 500Mb of rendered intro when Jetpac fits in 16k?! 
*===[ http://www.geocities.com/SiliconValley/Lakes/6142/ ]====*

