Hex Compiling

Anything QL Software or Programming Related.
Derek_Stewart
QL Wafer Drive
Posts: 1365
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Hex Compiling

Postby Derek_Stewart » Wed May 15, 2019 10:19 pm

Hi,

What is the way to compile Hexadecimal numbers with Qliberator and SMSQ/E.

SMSQ/E can display hexadecimal numbers prefixed with a $ symbol.

Unfortunatley, Qliberator gives an error when trying to compile the statement.

Strangely enough, Turbo compiles this with no errors and works as expected.


Regards,

Derek
User avatar
tofro
QL Wafer Drive
Posts: 1578
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Hex Compiling

Postby tofro » Thu May 16, 2019 6:59 am

Derek,

There's an utility somewhere on Per's site (just recently re-opened), I believe, that replaces all hexadecimal constants in S*Basic programs with decimals for compilation. Should come in handy here.

(Thus, this is a just-in.time question)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
JonS
Chuggy Microdrive
Posts: 60
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

Re: Hex Compiling

Postby JonS » Thu May 16, 2019 7:19 am

Why not use HEX command?


User avatar
tofro
QL Wafer Drive
Posts: 1578
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Hex Compiling

Postby tofro » Thu May 16, 2019 7:28 am

JonS wrote:Why not use HEX command?


You can use that. But if you have a lot of these hex constants in a program, this might
  1. be quite some work
  2. be slow (runtime-wise): QLiberator is not smart enough to see that HEX("<constant>") is still a constant and uses valuable time to do the conversion at run-time. Replacing the hex constant with a "real", numerical constant is much faster

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
EmmBee
Brittle Membrane
Posts: 100
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: Hex Compiling

Postby EmmBee » Fri May 17, 2019 9:59 pm

tofro wrote:There's an utility somewhere on Per's site (just recently re-opened), I believe, that replaces all hexadecimal constants in S*Basic programs with decimals for compilation. Should come in handy here.

Yes, I've found it here ... http://www.knoware.no/
It can be found under ENTER / GO SUB / DeHex
It looks like a very neat procedure.

Regarding Turbo, I note that it's not possible to compile a $0 or %0.
Those cases would have to use a plain 0.

Michael



Who is online

Users browsing this forum: No registered users and 9 guests