Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:22 29 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 : Color Maximite Calls

Author Message
Questarian

Newbie

Joined: 06/04/2015
Location: United States
Posts: 7
Posted: 07:28am 26 Apr 2015
Copy link to clipboard 
Print this post

Hi!
I'm fairly new to the color maximite and mmbasic (4.5), and I might have missed something in the manuals, but it seems mmbasic is a bit temperamental about entirely passing the results of complex expressions in command, function and sub arguments. For example something like:

seek #1,(fn-1)*fontv*fonth+1+i*fonth
fails

fi=(fn-1)*fontv*fonth+1+i*fonth
seek #1, fi
works

with user defined subs/functions, on a sub define as Sub Menu(x,y):

Menu Int((hres-menuh)/2+offseth),Int((vres-menuv)/2+offsetv)
works

menu (hres-menuh)\2+offseth,(vres-menuv)\2+offsetv
fails

what was driving me nuts, it that it's not all the time, or with every commands/functions/sub. I've used a lot of complex expressions with line, pixel and for commands without any notable issues, and in smaller test programs the complex arguments appeared to work fine, but once it get to a certain size. and/or nested in routines, things seem to start getting particular... any thoughts?

-John E. Bielak-Edited by Questarian 2015-04-27
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 07:53am 26 Apr 2015
Copy link to clipboard 
Print this post

Hi and welcome!

  Quote  what was driving me nuts

me too! But if you always use brackets

Menu(x,y)
or
Menu((hres-menuh)\2+offseth,(vres-menuv)\2+offsetv)

then it should work fine!

Regards
Michael
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 01:30pm 26 Apr 2015
Copy link to clipboard 
Print this post

> always use brackets

YES !!!!
Not only with Basic. Keeps things tidy ..........
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 12:10am 27 Apr 2015
Copy link to clipboard 
Print this post

Welcome, Questarian. Love your avatar!
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:19am 27 Apr 2015
Copy link to clipboard 
Print this post

MMBasic does have some problems with processing the argument list to subroutines and functions. Especially when you have a function call in the argument list.

The Micromite version has fixed this but I have not retrofitted the changes to the Maximite version yet (too many things to do).

The workaround is to evaluate any arguments that might cause trouble to variables before calling the sub/fun and then just use the variables in the call.

Geoff
Geoff Graham - http://geoffg.net
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 12:31am 27 Apr 2015
Copy link to clipboard 
Print this post

@Geoff

BTW. >argument list

Micromites have some problems with spaces between function call and the first bracket.

Menu(x,y)
works

Menu (x,y)
works not.

That's no problem if you know it but not easy to find if you not expect it.

Regards
Michael



 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 02:46am 27 Apr 2015
Copy link to clipboard 
Print this post

An amazing amount of MMBasic is dedicated to catching errors and trying to give a useful error message. But there seems to be any number of fresh ways to trip up the interpreter.

I will look at this one and see if I can catch it.

Geoff
Geoff Graham - http://geoffg.net
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 03:24am 27 Apr 2015
Copy link to clipboard 
Print this post

  Geoffg said  ... But there seems to be any number of fresh ways to trip up the interpreter.

I will look at this one and see if I can catch it.

Geoff

my 2c:
Not worth the hassle when it comes at the expense of performance.

Michael
 
Questarian

Newbie

Joined: 06/04/2015
Location: United States
Posts: 7
Posted: 06:57am 04 May 2015
Copy link to clipboard 
Print this post

  Grogster said   Welcome, Questarian. Love your avatar!


Thanks! is part of my Theme...
 
Questarian

Newbie

Joined: 06/04/2015
Location: United States
Posts: 7
Posted: 07:11am 04 May 2015
Copy link to clipboard 
Print this post

  Geoffg said   MMBasic does have some problems with processing the argument list to subroutines and functions. Especially when you have a function call in the argument list.

The Micromite version has fixed this but I have not retrofitted the changes to the Maximite version yet (too many things to do).

The workaround is to evaluate any arguments that might cause trouble to variables before calling the sub/fun and then just use the variables in the call.

Geoff


That pretty much what i've been doing, breaking out the argument expressions to variables. it also helps breaking up long lines in smaller more manageable ones... It doesn't seem to affect every sub/function call so I've break them up when things start miss behaving.

-John-
 
Print this page


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

© JAQ Software 2024