CHAN_F

Anything QL Software or Programming Related.
Post Reply
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

CHAN_F

Post by dilwyn »

Having a blank moment: does anyone know of an extension to peek a floating point value from the extended channel definition block?

e.g. PRINT CHAN_F(#0,HEX("14A")

i.e. a floating point version of Simon Goodwin's CHAN_B%, CHAN_W% and CHAN_L functions which return byte, word and long word values.

Asked this in response to printing in Quanta mag the tip from Tobias about the aspect ratio being stored in channel variable pt_asprt equ $14a ; 6 bytes float pixel aspect ratio, how to read the values and change them to experiment with.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: CHAN_F

Post by tofro »

Dilwyn,

a combination of DIY TK and Turbo Toolkit should help:

Code: Select all

PRINT PEEK_F(CHBASE(#x) + HEX("$14a"))
CHBASE comes with the "q" volume of DIY TK and returns the base address of a channel definition.

PEEK_F is a function from Turbo Toolkit and, well does what it says.

Cheers,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: CHAN_F

Post by dilwyn »

Thank you. I'll try that and pass on the results.


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: CHAN_F

Post by mk79 »

dilwyn wrote:Asked this in response to printing in Quanta mag the tip from Tobias about the aspect ratio being stored in channel variable pt_asprt equ $14a ; 6 bytes float pixel aspect ratio, how to read the values and change them to experiment with.
pt_asprt does not live in the CDB, but in the CON linkage block. You can play with it using the g-ratio extension:

http://members.upc.nl/b.spelten/ql/files/g_ratio.zip


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: CHAN_F

Post by pjw »

dilwyn wrote: <>
e.g. PRINT CHAN_F(#0,HEX("14A")

i.e. a floating point version of Simon Goodwin's CHAN_B%, CHAN_W% and CHAN_L functions which return byte, word and long word values.
Try

Code: Select all

deffn CHAN_F(ch, ad)
ret FLT(chan_W%(#ch;ad), CHAN_L(#ch;ad+2))
enddef
:
deffn FLT(x, b)
IF b = 0 OR x = 0: ret 0
ret b * 2 ^ (x - 2079)
enddef
:


Per
dont be happy. worry
- ?
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: CHAN_F

Post by dilwyn »

mk79 wrote:
dilwyn wrote:Asked this in response to printing in Quanta mag the tip from Tobias about the aspect ratio being stored in channel variable pt_asprt equ $14a ; 6 bytes float pixel aspect ratio, how to read the values and change them to experiment with.
pt_asprt does not live in the CDB, but in the CON linkage block. You can play with it using the g-ratio extension:

http://members.upc.nl/b.spelten/ql/files/g_ratio.zip
Thank you Marcel. I will print include this as additional information in the Helpline column in the next issue of Quanta - it's too late to change the current issue now.


Post Reply