Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:26 26 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 V5.05.06exp: Huge performance improvement - please test

     Page 8 of 8    
Author Message
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 10:47pm 27 Oct 2020
Copy link to clipboard 
Print this post

I used strings in the SELECT CASE with no problem in the last firmware.

But in the case, when I removed BLIT commands on the evaluation, no more system fault.
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 12:55am 28 Oct 2020
Copy link to clipboard 
Print this post

Peters fix solved my problem.

This is my amended "Test" Bug_In_Select.zip program which does what I expected

'
' Reply from Peter ... known MMBasic problem
' The workaround is to copy the array value into a temporary variable and test that
'
 FOR mC% = 1 to 2*WIDTH%+1
   wt$ = MID$(m$(mR%), mC%, 1)
   SELECT CASE wt$
      CASE "@"
         COLOUR RGB(RED)
      CASE "X"
         COLOUR RGB(GREEN)
      CASE "#"
         COLOUR RGB(BROWN)
      CASE ELSE
         COLOUR RGB(WHITE)
   END SELECT
   PRINT wt$;


@ywofingers ... your solution is much more elegant than mine

  matherp said  
That also works without crashing but if you can use SELECT A$ then logically you should be able to use
SELECT ARRAY$(I%) . In both cases the match won't happen if the CASE string and the SELECT string aren't the same. So the code was probably functionally incorrect but shouldn't have crashed.

@Peter ... that was my understanding from reading the manual.  My reading led me to believe it should have worked, but it didn't, I expected the SELECT CASE to evaluate the contents of the referenced array element and evaluate that against the CASE values.  
I'm very rusty with BASIC hence my inefficient code and overabundant comments ... its a learning exercise  

Many Thanks everyone for your help.

Womble
 
     Page 8 of 8    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024