Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:57 27 Nov 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 : MMBasic for Windows - betas

     Page 14 of 30    
Author Message
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 02:17am 09 Apr 2022
Copy link to clipboard 
Print this post

Problem with GUI CLICK(REF)

Version 5.07.03b8



GUI Area #1,0,0,200,200
GUI Interrupt Mouseclick
Do
Loop

Sub Mouseclick
 Print CLICK(REF)
End Sub


When run, gives the following error after a mouse click in the area defined in the program.

Error in line 8: CLICK is not declared

Testing with Ctrlval shows the mouse click is recognised and correctly returns the #ref from the GUI AREA command.

Edit: Unsure about this last bit. Changing CLICK (CMM2) to TOUCH (picomite) makes no difference. What I am trying to achieve is for the GUI AREA command to return the control value assigned. D.
Edited 2022-04-09 13:14 by panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 06:58am 09 Apr 2022
Copy link to clipboard 
Print this post

Try MOUSE(REF)
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 02:07pm 09 Apr 2022
Copy link to clipboard 
Print this post

Spurious trailing NULL in written file:

> list "bad_file.bas"
Option Base 0
Option Default None
Option Explicit On
Option Console Both

Dim f$ = "myfile.txt"

Open f$ For Output As #1
Print #1, "Hello World"
Close #1

Open f$ For Append As #1
Print #1, "Goodbye World"
Dim i% = Eof(#1) ' It doesn't happen if this line is omitted.
Close #1

Open f$ For Input As #1
Dim s$ = Input$(255, 1)
Close #1

Dim ch%
For i% = 1 To Len(s$)
 ch% = Asc(Mid$(s$, i%, 1))
 If ch% > 31 And ch% < 255 Then
   Print Chr$(ch%);
 Else
   Print "<" Hex$(ch%, 2) ">";
 EndIf
Next
Print

Print "Where did the trailing <00> come from?"
> run
Hello World<0D><0A>Goodbye World<0D><0A><00>
Where did the trailing <00> come from?
>


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 11:14am 10 Apr 2022
Copy link to clipboard 
Print this post

V5.07.03b9


MMBasic.zip

Fixes the two bugs Tom has reported.

In addition (because it was so easy) saves and restores the ON ERROR SKIP status if an interrupt happens before the offending line
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 09:22pm 10 Apr 2022
Copy link to clipboard 
Print this post

  matherp said  V5.07.03b9

Fixes the two bugs Tom has reported.

In addition (because it was so easy) saves and restores the ON ERROR SKIP status if an interrupt happens before the offending line


Thanks Peter, tested the first two and confirm they are fixed. Not tested the latter at this time.

A regression that I think has occurred at some point in the last couple of builds:
? Day$(Now)
dummy


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 09:29pm 10 Apr 2022
Copy link to clipboard 
Print this post

Think it is a day 1 bug. Just happens to be only on Sundays.


MMBasic.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 09:36pm 10 Apr 2022
Copy link to clipboard 
Print this post

An interesting one on the CMM2 - so probably the wrong thread, yet here I am :

> ON ERROR SKIP
> OPEN "file-that-exists" FOR INPUT AS #1
> ? "*" MM.ERRMSG$ "*"
*Succeeded *


1. That there is any MM.ERRMSG$ on success is a bit counter-intuitive, and means you need to be careful to check MM.ERRNO <> 0, not MM.ERRMSG$ <> "" if you are interested in handling errors.

2. The "Succeeded " message has a trailing space; irrelevant if (1) were fixed.

Note that MMB4W does not set MM.ERRMSG$ on success, it would (correctly) be the empty string in this example.

Also on CMM2 and MMB4W:
SEEK #fnbr, pos

does not report an error if pos <= 0, it probably should.

Best wishes,

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 01:45pm 11 Apr 2022
Copy link to clipboard 
Print this post

Here is an inconsistency between MMB4W and the CMM2.

MMB4W:
> list "append_loc_bug.bas"
Option Base 0
Option Default None
Option Explicit 1
Option Console Both

Dim f$ = "append_loc_bug.txt"

Open f$ For Output As #1
Print #1, "foo";
Close #1

Open f$ For Append As #1
Print Loc(#1)
Close #1

End
> run "append_loc_bug.bas"
1
>


Run the same code on the CMM2 and it outputs 4 ... I think that the CMM2 is probably correct and MMB4W incorrect.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 02:06pm 11 Apr 2022
Copy link to clipboard 
Print this post

Looks like a bug/feature in ftell/fopen. As soon as you write something it will return the correct value but it doesn't seem to set the filepointer until something is written. Don't think I can do anything about it?
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 08:59am 12 Apr 2022
Copy link to clipboard 
Print this post

  matherp said  Looks like a bug/feature in ftell/fopen. As soon as you write something it will return the correct value but it doesn't seem to set the filepointer until something is written. Don't think I can do anything about it?


It looks like the C specification does not specify the behaviour in this particular case and thus an implementation is free to do what it wants - Linux/GCC behaves like the CMM2. Of course if you wanted you could get MMBasic to handle it as a special case when it knows a file has been opened for APPEND - YMMV.

Best wishes,

Tom
Edited 2022-04-12 19:08 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Kabron

Regular Member

Joined: 30/11/2017
Location: Germany
Posts: 65
Posted: 10:21am 12 Apr 2022
Copy link to clipboard 
Print this post

With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

 
Kabron

Regular Member

Joined: 30/11/2017
Location: Germany
Posts: 65
Posted: 01:51pm 15 Apr 2022
Copy link to clipboard 
Print this post

  Kabron said  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

Observed on two PC

Last working version: 5.07.03pa12
Edited 2022-04-15 23:53 by Kabron
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 469
Posted: 02:26pm 15 Apr 2022
Copy link to clipboard 
Print this post

  Kabron said  
  Kabron said  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

Observed on two PC

Last working version: 5.07.03pa12


Is this just the first time you run it or every time?  My antivirus(Avast) software interrupts the first run but pops up a notice that it is scanning the entire run of the code. Then It continues.  Maybe your antivirus is doing the same thing but not notifying you about the run time scan like mine does.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 04:27pm 15 Apr 2022
Copy link to clipboard 
Print this post

  Quote  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64


See page 8 of this thread and try launching from a DOS box with

MMBASIC 0
 
Kabron

Regular Member

Joined: 30/11/2017
Location: Germany
Posts: 65
Posted: 07:07am 16 Apr 2022
Copy link to clipboard 
Print this post

  matherp said  

See page 8 of this thread and try launching from a DOS box with

MMBASIC 0


This works,
but COPY/PASTE not work in console window.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 07:12am 16 Apr 2022
Copy link to clipboard 
Print this post

  Quote  but COPY/PASTE not work in console window.


Correct. And it won't be
 
Kabron

Regular Member

Joined: 30/11/2017
Location: Germany
Posts: 65
Posted: 07:14am 16 Apr 2022
Copy link to clipboard 
Print this post

  matherp said  
  Quote  but COPY/PASTE not work in console window.


Correct. And it won't be

Very discomfortable!
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 01:50pm 20 Apr 2022
Copy link to clipboard 
Print this post

Hi Peter,

Pretty sure this is a bug and different from the CMM2, but I only have MMB4L to compare against at the moment:

> Dim a%
> Poke Var a%, 0, 255
> ? Peek(Var a%, 0)
-1


Output from PEEK(VAR var, offset) should be an unsigned/byte value = 255.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 02:33pm 20 Apr 2022
Copy link to clipboard 
Print this post

  Quote  Pretty sure this is a bug and different from the CMM2,



MMBasic.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 09:15am 21 Apr 2022
Copy link to clipboard 
Print this post

Thanks Peter,

That issue is fixed.

1. Unfortunately this appears to be a regression from the previous build:
> list "append_bug.bas"
Option Console Both
Dim f$ = "append.txt"
On Error Skip
Kill f$
Open f$ For Output As #1
Print #1, "Hello World"
Close #1
Open f$ For Append As #1
? Eof(#1) ' Works if you comment out this line
Print #1, "Goodbye Peter"
Close #1
> run "append_bug.bas"
0
Error in line 10: File write
>


2. Also (in this and previous build) this crashes MMB4W rather than reporting a "Syntax" error
Dim i% = 1
? Peek(Var i%)


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 14 of 30    
Print this page
© JAQ Software 2024