Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:40 06 Jul 2025 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 5.05.06 beta

     Page 4 of 12    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 12:59pm 12 Sep 2020
Copy link to clipboard 
Print this post

And now for something completely different ...

A bit of strangeness with TRACE LIST:

> Colour Maximite 2
MMBasic Version 5.05.05
Copyright 2011-2020 Geoff Graham
Copyright 2016-2020 Peter Mather

> list "hello.bas"
Print "Hello World"
> trace list
> run "hello.bas"
Hello World

> trace list
[1]
> run "hello.bas"
Hello World

> trace list
[1] [1]
> run "hello.bas"
Hello World

> trace list
[1] [1] [1]
> new

> trace list
> run "hello.bas"
Hello World

> trace list
[1] [1] [1] [1]


My expectation was that the list would emptied on a NEW or a RUN.

Also note the weird behaviour of NEW where it appears to clear the list, until you then RUN at which point all the previous entries reappear.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 01:04pm 12 Sep 2020
Copy link to clipboard 
Print this post

And how about this joyous fragment:

> list "gosub.bas"
Trace On
Print "a" : Gosub foo : Print "c"
End
foo:
Print "d"
Return

> run "gosub.bas"
[a
[4][5]d
[6]c
[3]


I believe the correct output would be:

[2]a
[4][5]d
[6]c
[3]


Though this would be even better:

[2]a
[4][5]d
[6][2]c
[3]


Note that I don't write code like this, but sometimes I have to port it.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 01:23pm 12 Sep 2020
Copy link to clipboard 
Print this post

I thought gosub and return were deprecated?
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 02:05pm 12 Sep 2020
Copy link to clipboard 
Print this post

  mkopack73 said  I thought gosub and return were deprecated?


That doesn't mean they aren't supported for backward compatibility.

In any case, the issue with TRACE isn't GOSUB dependent:
> list "trace_bug.bas"
Trace On
Print "a" : foo() : Print "c"
End
Sub foo()
Print "d"
End Sub

> run "trace_bug.bas"
[a
[5]d
[6]c
[3]


Whereas the output I would ideally expect would be:

[2]a
[4][5]d
[6][2]c
[3]


Though it would be acceptable w/out the [4] and/or second appearance of [2].

Best wishes,

Tom
Edited 2020-09-13 00:06 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 03:51pm 12 Sep 2020
Copy link to clipboard 
Print this post

  Quote  o other language I’ve ever seen (and I’m up to something like 40 or 50 if you include all the various dialects at this point) has ever allowed this sort of syntactic modification that can have such code breaking results and still be considered the same language/dialect/version.

VBA
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 05:24pm 12 Sep 2020
Copy link to clipboard 
Print this post

  Quote  Except when your requirements conflict with their requirements and/or they wish to write code that uses multiple different libraries with conflicting sets of requirements.


As in my previous comment - libraries should always use, assume, and mandate defaults. This is the only sensible way to work. No-one needs to use any of the options in non-default modes so it is up to them to work with defaults if they wish to use libraries

Thwill, I'll fix the trace issue in the next beta. No version of MMBasic zeroes the trace list, not sure why. Will see if it can be changed without causing problems
Edited 2020-09-13 03:33 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 05:43pm 12 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  Thwill, I'll fix the trace issue in the next beta. No version of MMBasic zeroes the trace list, not sure why. Will see if it can be changed without causing problems


Thanks Peter no urgency, just reporting the issue because I noticed and could reproduce it.

What about the strange behaviour with the list when you NEW ? It appears to zero it, and then as soon as you RUN the old entries are back!

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 04:51am 13 Sep 2020
Copy link to clipboard 
Print this post

Not sure if this is a bug, but it was unexpected:

If I change font, then do "list" to list the program, the font changes back at the end of the listing.

editing to add: this is at the command line.
Edited 2020-09-13 14:57 by capsikin
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 06:25am 13 Sep 2020
Copy link to clipboard 
Print this post

Hi Peter,
I'm not sure if you saw VegiPete reporting that a stray ")" after a PIXEL statement didn't generate an error but I've just seen a  "For column = 0 to 40)" not generate one either (Version 5.05.05)

Cheers,

Andrew
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 07:20am 13 Sep 2020
Copy link to clipboard 
Print this post

  Quote  I'm not sure if you saw VegiPete reporting that a stray ")" after a PIXEL statement didn't generate an error but I've just seen a  "For column = 0 to 40)" not generate one either (Version 5.05.05)


In general MMbasic does not check for junk after the end of a valid statement. It is capable of doing this but adds processor overhead. This is not specific to the CMM2. Since it is benign it is probably best left as-is.
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 07:22am 13 Sep 2020
Copy link to clipboard 
Print this post

Thanks Peter,

Cheers, Andrew
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 12:10pm 13 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  Please find attached V5.05.06b2

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

This fixes a couple of sneaky bugs

Fixed bug where setting repeat rate to 25 cause options to be reset on next power up
Fixed bugs in search in editor
Possibly something else but I can't think what

Please report any bugs in the 5.05.06 betas in this thread to avoid cluttering up the forum


This is a tricky one, but I'd better report it.

I'm getting the error "Not enough heap memory". Based on past memory, if I turn the computer off and on the error will go away and it will be hard to track down, so I did some more testing first.

Testing, stage 1:

I'd been using the computer for a while, and now I can trigger the error by editing my 88 line program, pressing Ctrl-F to find, and typing a single character to search for.

The program also includes a 93 line font include file.

after the error, I'm trying typing "memory"
Program:
9K ( 1%) Program 153 lines
3K ( 0%) 1 Embedded Fonts
504K (99%) Free

Data:
0K ( 0%) 0 Variables
0K ( 0%) General)
5184K (100%) Free

I get the same error searching in a new 6 line or 1 line file.
I saved a 1 line file, then edited it and searched, and the search status line moved up the screen, and the command line status line appeared at the bottom of the screen.
If I enter the command cls, it's back to normal at the command line.

(edit: this may have been because the system was even lower on emory, rather than because it was a saved single line file)

Testing, stage 2:

With other errors, e.g. if I enter "print 4/0" or "asdf", I lose the cursor until I enter cls, and don't get a normal error message showing.

If I save mm.info(hpos) and mm.info(vpos) to variables while I've lost the cursor, I find
mm.info(hpos)=0 and mm.info(vpos)=-384

Trying again, I find if I press Enter a few dozen times when the cursor is lost, it does come back on screen.

Hmm, I edited a file, searched, and it seemed to lock up.

Testing, stage 3:

Ctrl-C, Esc, and entering cls, do not help.

At this point I did turn it off and on, and can't reproduce the problem.

I suspect once the editor is crashing due to not having enough heap memory, it is leaking even more memory, until it can't give error messages, and once MMBASIC can't give error messages, further errors may be leaking more memory until the system hangs.

But I don't know what's causing the initial low memory problem.
Is there a way to check how much heap is available - it seemed like there was plenty of memory for basic programs?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 12:36pm 13 Sep 2020
Copy link to clipboard 
Print this post

  Quote  This is a tricky one, but I'd better report it.


Thanks - I think  

  Quote  Is there a way to check how much heap is available


mm.info(heap)

  Quote  Ctrl-C, Esc, and entering cls, do not help.


What about NEW ? Any non-standard option settings?
Edited 2020-09-13 22:37 by matherp
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 01:29pm 13 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  This is a tricky one, but I'd better report it.


Thanks - I think  

  Quote  Is there a way to check how much heap is available


mm.info(heap)

Thanks, that should be helpful.
  Quote  
  Quote  Ctrl-C, Esc, and entering cls, do not help.


What about NEW ? Any non-standard option settings?


I might try "NEW" next time. Do you mean after it had apparently hung, or as a way to recover memory earlier?

No nonstandard options, I hadn't even set my keyboard yet.
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 02:05pm 13 Sep 2020
Copy link to clipboard 
Print this post

  capsikin said  
  matherp said  
  Quote  This is a tricky one, but I'd better report it.


Thanks - I think  

  Quote  Is there a way to check how much heap is available


mm.info(heap)

Thanks, that should be helpful.
  Quote  
  Quote  Ctrl-C, Esc, and entering cls, do not help.


What about NEW ? Any non-standard option settings?


I might try "NEW" next time. Do you mean after it had apparently hung, or as a way to recover memory earlier?

No nonstandard options, I hadn't even set my keyboard yet.



Hmm, starting to wonder if that shouldn't be a standard thing to put at the top of every program... (NEW that is...)  Might make for the safest situation all the time. Same with END at the bottom... I know the system will work just fine without them 99% of the time, but might be good practice to always use those even if they aren't explicitly required.
Edited 2020-09-14 00:39 by mkopack73
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 02:07pm 13 Sep 2020
Copy link to clipboard 
Print this post

  Quote  Hmm, starting to wonder if that shouldn't be a standard thing to put at the top of every program... (NEW that is...)  Might make for the safest situation all the time.

New deletes the current program - not a good idea in a program  
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 02:41pm 13 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Hmm, starting to wonder if that shouldn't be a standard thing to put at the top of every program... (NEW that is...)  Might make for the safest situation all the time.

New deletes the current program - not a good idea in a program  


Oh crap. that's right. For some reason I was thinking that just erased the values in the symbol table...  I was thinking of "clear"

ok, nevermind!
Edited 2020-09-14 00:46 by mkopack73
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10209
Posted: 05:59pm 13 Sep 2020
Copy link to clipboard 
Print this post

V5.05.06b5 posted

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

Bug fixes:
Fixes bugs in TRACE and TRACE LIST when multiple commands separated by colons are on a line
Clears OPTION ANGLE to default before running a program
Misalignment in Font 5 fixed - thanks Jim

New Features:
OPTION Y_AXIS should now work for all drawing commands including print, loading images and sprites - or at least it does for the tests I've conducted.
TRACE is cleaned at the start of a program

General comments:
  Quote  If I change font, then do "list" to list the program, the font changes back at the end of the listing.

Whether rightly or wrongly this is expected behaviour
  Quote  Also - not sure if this is a bug or a feature, but if I hold shift and use the cursor keys I can mark text, which is wonderful, but if I page up and page down whilst in this select mode (still holding shift), then the selection is lost.

Page up and Page down should be completely ignored in selection mode. I can't make them lose the selection. The paging code it too complex to allow in selection mode so it won't be added.
  Quote  There really needs to be a STANDARD consistent way to query the current setting of every option.

  Quote  Can the OPTIONS table layout/format/address please be published in this thread? At the very least a few subroutines could be written that use PEEK and properly parse the table values.

Temporary options are stored as normal variables and are not in the permanent option table. I will review including a general interrogation mechanism at a later date

  Quote  but would it be possible to enable an option for (in the editor) CONTROL + S to be save, and not select?

This would be a YAN (yet another option) which you would want to be permanent with little utility except for a tiny user base so sorry - no
Edited 2020-09-14 03:59 by matherp
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 07:02pm 13 Sep 2020
Copy link to clipboard 
Print this post

I don't know if this is intentional, but Up and Down arrows to navigate through previous commands doesn't work if you start typing a command then delete all the content.

Starting a new line, Up and Down work as normal.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 10:43am 14 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  V5.05.06b5 posted ...


Thanks Peter, I believe the behaviour of TRACE LIST is still not quite 100%, see the following, starting with a reset:
> Colour Maximite 2
MMBasic Version 5.05.06b5
Copyright 2011-2020 Geoff Graham
Copyright 2016-2020 Peter Mather

> list "hello.bas"
Print "Hello World"

> run "hello.bas"
Hello World

> trace list
[1] [1]


Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 4 of 12    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025