Hisoft Colt Compiler

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

Hisoft Colt Compiler

Post by PeterJ » Tue Dec 11, 2018 9:29 pm

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.
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1217
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore » Tue Dec 11, 2018 9:44 pm

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.
0 x
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: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ » Tue Dec 11, 2018 9:49 pm

Thanks @Ast A. Moore, I assumed the same but then 'To obtain the same effect under Basic use USR 59997.' doesn't make much sense.
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1217
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore » Tue Dec 11, 2018 9:59 pm

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.
0 x
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: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ » Tue Dec 11, 2018 10:01 pm

Thanks @Ast A. Moore,

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

Many thanks

Peter
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1217
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore » Tue Dec 11, 2018 10:02 pm

I’m also using Fuse.
0 x
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: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ » Tue Dec 11, 2018 10:07 pm

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

Thanks again.
0 x

User avatar
PeterJ
Site Admin
Posts: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Hisoft Colt Compiler

Post by PeterJ » Thu Dec 13, 2018 7:01 am

@Ast A. Moore

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
0 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1217
Joined: Mon Nov 13, 2017 3:16 pm

Re: Hisoft Colt Compiler

Post by Ast A. Moore » Thu Dec 13, 2018 10:01 am

Excellent. Glad it worked out for you in the end.
0 x
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
Manic Miner
Posts: 508
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Hisoft Colt Compiler

Post by Alessandro » Sun Dec 16, 2018 1:25 pm

Why sticking with Colt when you can use the newer and better Hisoft BASIC ?
0 x

Post Reply