Hisoft Colt Compiler

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Hisoft Colt Compiler

Post 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.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post 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.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post 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.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post 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.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post 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
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore »

I’m also using Fuse.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ »

Odd, mybe I have an add-on virtually attached that's causing an issue. Will take a look tomorrow evening.

Thanks again.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post 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
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore »

Excellent. Glad it worked out for you in the end.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Hisoft Colt Compiler

Post by Alessandro »

Why sticking with Colt when you can use the newer and better Hisoft BASIC ?
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ »

Hi [mention]Alessandro[/mention]

Colt has the Sprites add-on.

Peter
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Hisoft Colt Compiler

Post 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 :)
oik0s
Drutt
Posts: 2
Joined: Mon Mar 30, 2020 2:59 am

Re: Hisoft Colt Compiler

Post by oik0s »

İt's too late but it works

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