Re: [Ql-Users] Select on

2020-06-20 Thread pjwitte via Ql-Users

On 20/06/2020 17:00, Jan Bredenbeek via Ql-Users wrote:

Op za 20 jun. 2020 14:01 schreef Dave Park via Ql-Users <
ql-users@lists.q-v-d.com>:


ooGyebd = Goodbye
goodbye <> Goodbye


Use a hash algorithm like CRC-16 or CRC-32? ;-)


Thats probably the fastest solution so far :o) Maybe overkill for just 
a few items. INSTR is pretty fast - and its built in.


Per


___
QL-Users Mailing List


Re: [Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Norman Dunbar via Ql-Users
Nothing worse!

On 20 June 2020 13:02:21 BST, Dave Park via Ql-Users  
wrote:
>Norman,
>
>At your age you want to watch it. You might show your MSB, and the
>nurse
>might think it's your LSB.
>
>Dave
>
>On Sat, Jun 20, 2020 at 4:16 AM Norman Dunbar via Ql-Users <
>ql-users@lists.q-v-d.com> wrote:
>
>> :-)
>>
>> I'll have the nurses check!
>>
>> Cheers,
>> Norm.
>> --
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>>
>> On 20 June 2020 10:05:33 BST, Dilwyn Jones via Ql-Users <
>> ql-users@lists.q-v-d.com> wrote:
>> >> format of data in registers as having the most significant bit at
>the
>> >right end
>> >I do certainly hope your MSB is at the correct end, Norman :-D 
>(ooer
>> >missus...!)
>> >
>> >Dilwyn
>> >___
>> >QL-Users Mailing List
>> ___
>> QL-Users Mailing List
>>
>
>
>-- 
>Dave Park
>d...@sinclairql.com
>___
>QL-Users Mailing List

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
QL-Users Mailing List


Re: [Ql-Users] Select on

2020-06-20 Thread Jan Bredenbeek via Ql-Users
Op za 20 jun. 2020 14:01 schreef Dave Park via Ql-Users <
ql-users@lists.q-v-d.com>:

>
>
>
> ooGyebd = Goodbye
> goodbye <> Goodbye
>
> Use a hash algorithm like CRC-16 or CRC-32? ;-)

Jan
___
QL-Users Mailing List


Re: [Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Dilwyn Jones via Ql-Users
Ha ha ha!!! :)

Dilwyn

On Sat, 20 Jun 2020 at 13:02, Dave Park via Ql-Users
 wrote:
>
> Norman,
>
> At your age you want to watch it. You might show your MSB, and the nurse
> might think it's your LSB.
>
> Dave
>
> On Sat, Jun 20, 2020 at 4:16 AM Norman Dunbar via Ql-Users <
> ql-users@lists.q-v-d.com> wrote:
>
> > :-)
> >
> > I'll have the nurses check!
> >
> > Cheers,
> > Norm.
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >
> > On 20 June 2020 10:05:33 BST, Dilwyn Jones via Ql-Users <
> > ql-users@lists.q-v-d.com> wrote:
> > >> format of data in registers as having the most significant bit at the
> > >right end
> > >I do certainly hope your MSB is at the correct end, Norman :-D  (ooer
> > >missus...!)
> > >
> > >Dilwyn
> > >___
> > >QL-Users Mailing List
> > ___
> > QL-Users Mailing List
> >
>
>
> --
> Dave Park
> d...@sinclairql.com
> ___
> QL-Users Mailing List
___
QL-Users Mailing List


Re: [Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Dave Park via Ql-Users
Norman,

At your age you want to watch it. You might show your MSB, and the nurse
might think it's your LSB.

Dave

On Sat, Jun 20, 2020 at 4:16 AM Norman Dunbar via Ql-Users <
ql-users@lists.q-v-d.com> wrote:

> :-)
>
> I'll have the nurses check!
>
> Cheers,
> Norm.
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> On 20 June 2020 10:05:33 BST, Dilwyn Jones via Ql-Users <
> ql-users@lists.q-v-d.com> wrote:
> >> format of data in registers as having the most significant bit at the
> >right end
> >I do certainly hope your MSB is at the correct end, Norman :-D  (ooer
> >missus...!)
> >
> >Dilwyn
> >___
> >QL-Users Mailing List
> ___
> QL-Users Mailing List
>


-- 
Dave Park
d...@sinclairql.com
___
QL-Users Mailing List


Re: [Ql-Users] Select on

2020-06-20 Thread Dave Park via Ql-Users
On Sat, Jun 20, 2020 at 3:03 AM Derek Stewart via Ql-Users <
ql-users@lists.q-v-d.com> wrote:

> Hi,
>
> Here is my un-subtle attempt, how about summing the ASCII codes for the
> character string to be selected and use SELect ON to select the option
> based on the sum total, for example:
>
> 10 a$="Goodbye"
> 15 asum=0
> 20 FOR a=1 TO LEN(a$): asum=asum+CODE(a)
> 40 SELect ON asum
> 50   = 255: REMark ASCII Code sum for "Hello"
> 51  PRINT "Hello World"
> 60   = 364: REMark ASCII sum for "Goodbye"
> 61  PRINT "Goodbye World"
> 70 END SELect
>

ooGyebd = Goodbye
goodbye <> Goodbye



-- 
Dave Park
d...@sinclairql.com
___
QL-Users Mailing List


Re: [Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Norman Dunbar via Ql-Users
:-)

I'll have the nurses check!

Cheers,
Norm.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

On 20 June 2020 10:05:33 BST, Dilwyn Jones via Ql-Users 
 wrote:
>> format of data in registers as having the most significant bit at the
>right end
>I do certainly hope your MSB is at the correct end, Norman :-D  (ooer
>missus...!)
>
>Dilwyn
>___
>QL-Users Mailing List
___
QL-Users Mailing List


Re: [Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Dilwyn Jones via Ql-Users
> format of data in registers as having the most significant bit at the right 
> end
I do certainly hope your MSB is at the correct end, Norman :-D  (ooer
missus...!)

Dilwyn
___
QL-Users Mailing List


[Ql-Users] QL Today Assembly Language Book.

2020-06-20 Thread Norman Dunbar via Ql-Users
A bug was recently found in section 1.2.1 where I described the format of data 
in registers as having the most significant bit at the right end. Duh! That has 
been corrected.

If you need a corrected copy, it's the June 2020 release at 
https://github.com/NormanDunbar/QLAssemblyLanguageBook/releases/latest although 
that URL always gets the very latest version.


If anyone needs a printed version, "Tinyfpga" on QL Forum has sorted out a 
print on demand setup, with my blessing, where it is at a cost or around 
£10.00. 



Cheers,
Norm.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
QL-Users Mailing List

Re: [Ql-Users] Select on

2020-06-20 Thread Derek Stewart via Ql-Users

Hi,

Here is my un-subtle attempt, how about summing the ASCII codes for the 
character string to be selected and use SELect ON to select the option 
based on the sum total, for example:


10 a$="Goodbye"
15 asum=0
20 FOR a=1 TO LEN(a$): asum=asum+CODE(a)
40 SELect ON asum
50   = 255: REMark ASCII Code sum for "Hello"
51  PRINT "Hello World"
60   = 364: REMark ASCII sum for "Goodbye"
61  PRINT "Goodbye World"
70 END SELect

On 19/06/2020 20:35, pjwitte via Ql-Users wrote:

On 19/06/2020 20:02, Daniel Baum via Ql-Users wrote:

What about doing something like this. In languages like c# the equivalent
of the "select on: command is hardly ever used and if .. else if ... else
is much more common:

100 INPUT a$
110 IF a$="a" THEN
115   PRINT "hello a"
120   ELSE
130 IF a$="b"
135 PRINT "hello b"
150 ELSE
155   IF a$="c"
157   PRINT "hello c "
160   ELSE
170 PRINT "hello d"
180   END IF
190 END IF
200 END IF


Actually, I had need of a similar construct recently. This is what I 
came up with:


100 FOR i% = 1 TO 6
110  case$ = 'case' & i%
120 c% = case$ INSTR "case1 case2 case3 case4 case5 case6"
130 :
140 SELect ON c%
150  =  1: PRINT 'case 1'
160  =  7: PRINT 'case 2'
170  = 13: PRINT 'case 3'
180  = 19: PRINT 'case 4'
190  = 25: PRINT 'case 5'
200  = 31: PRINT 'case 6'
210  = REMAINDER : PRINT 'ERROR'
220 END SELect
230 :
240 END FOR i%
This is obviously just a demo to illustrate the idea. It seems 
reasonably fast. In my case

I was able to keep all the terms to more or less the same size.
If there is a chance of ambiguity, one could wrap the terms in delimiters:

c% = '#' & case$ & '#' INSTR '#case1#test this2#or this#etc#..#'

Per


___
QL-Users Mailing List

___
QL-Users Mailing List