Page 1 of 1

Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 9:29 pm
by PeterJ
This week I'm looking at the HiSoft Colt Compiler

I'm aware that this compiler doesn't allow floating point numbers (apart from is very specific circumstances). I'm reading about the RND statement and it says I can simulate the way it uses RND by using USR 59997

If I do a little program in BASIC:

Code: Select all

10 let R=USR 59997
20 Print R
The Spectrum freezes. What am I doing wrong?


RND Returns a random integer between 0 and 32767
(this is not quite the same as Basic). To
obtain the same effect under Basic use USR 59997.

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 9:44 pm
by Ast A. Moore
I believe you must compile your code first. Otherwise, you’re just executing the code at that address straight away, and it’s not meant to be executed from BASIC.

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 9:49 pm
by PeterJ
Thanks [mention]Ast A. Moore[/mention], I assumed the same but then 'To obtain the same effect under Basic use USR 59997.' doesn't make much sense.

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 9:59 pm
by Ast A. Moore
Huh. Okay. Testing.

Right. I was wrong, and, oddly enough, it works for me. It gives me a random number straight from BASIC.

P.S. Ran it on in 48K mode.

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 10:01 pm
by PeterJ
Thanks [mention]Ast A. Moore[/mention],

Strange I'm using Fuse in 48K mode and it hangs. Let me try on one of my real Spectrums.

Many thanks

Peter

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 10:02 pm
by Ast A. Moore
I’m also using Fuse.

Re: Hisoft Colt Compiler

Posted: Tue Dec 11, 2018 10:07 pm
by PeterJ
Odd, mybe I have an add-on virtually attached that's causing an issue. Will take a look tomorrow evening.

Thanks again.

Re: Hisoft Colt Compiler

Posted: Thu Dec 13, 2018 7:01 am
by PeterJ
[mention]Ast A. Moore[/mention]

I reset all the configuration on Fuse and it now works fine. It may have been because I had loads of interfaces attached for my recent tutorial.

The documentation for Colt is excellent, and there is an additional readme on how to get past the limitations of the integer only approach.

Thanks

Re: Hisoft Colt Compiler

Posted: Thu Dec 13, 2018 10:01 am
by Ast A. Moore
Excellent. Glad it worked out for you in the end.

Re: Hisoft Colt Compiler

Posted: Sun Dec 16, 2018 1:25 pm
by Alessandro
Why sticking with Colt when you can use the newer and better Hisoft BASIC ?

Re: Hisoft Colt Compiler

Posted: Sun Dec 16, 2018 2:30 pm
by PeterJ
Hi [mention]Alessandro[/mention]

Colt has the Sprites add-on.

Peter

Re: Hisoft Colt Compiler

Posted: Sun Dec 16, 2018 2:39 pm
by Alessandro
OK Peter, if you are going to use that option (it was not my case when I employed HiSoft BASIC) it makes sense :)

Re: Hisoft Colt Compiler

Posted: Mon Mar 30, 2020 3:18 am
by oik0s
İt's too late but it works

LET n = RND / (32768/(max+1))