Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:57 07 May 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 : Micromite MMBasic V5.3 Beta 3

     Page 3 of 3    
Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 03:57pm 16 Dec 2016
Copy link to clipboard 
Print this post

making the location of the end of number available through something like MM.EPOS could be quite useful, if you decide to go down that route. this makes parsing strings even easier for certain applications. an alternative (slightly cleaner) option would be extending the syntax of VAL thus:

VAL( string$ [, position])

where position is set to the location of the first non-number character, or zero if the full string evalutes to a number. also, if position is returned as 1, you would know for certain that the string does not start with a valid number.


btw: nice example jim :-)


cheers,
rob :-)Edited by robert.rozee 2016-12-18
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 06:19am 23 Dec 2016
Copy link to clipboard 
Print this post

geoff: would it perchance be possible to have some means of turning OFF automatic indenting in the editor, perhaps using f6 or some other function key? at the moment automatic indenting makes an absolute mess if you try to paste a listing into the editor using teraterm's edit->paste command.

a more contentious request would be to also move the 'exit' function from the ESC key to some other key (f10?). this would greatly help reduce the occasions when an escape sequence is mistaken as the user pressing the escape key. this can happen when entering the editor and immediately repositioning the cursor, causing the editor to exit. depending on a whole load of random conditions, windows can raqndomly insert small pauses in the middle of escape sequences.


cheers,
rob :-)
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 08:00am 23 Dec 2016
Copy link to clipboard 
Print this post

Pasting text into the editor makes a mess but it is not the automatic indenting that causes it. It is the fact that the editor has a lot of work to do for each character received and it quickly falls behind when a high speed stream of characters is received. I have tried working around this issue but so far it has been simpler to just not try to paste when in the edit mode.

While Windows can insert pauses the code for decoding escape sequences accommodates this and it works perfectly, even for baud rates as low as 300 baud. There is nothing broken there.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 11:40am 23 Dec 2016
Copy link to clipboard 
Print this post

when pasting indented text, i always find the editor inserts more indenting, causing subsequent lines to creep across the screen so that after a few lines the 'line too long' message flashes repeatedly on the status line.


cheers,
rob :-)
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:36pm 23 Dec 2016
Copy link to clipboard 
Print this post

OK, I think that I see what is going on. You are repeatedly pasting a single line with some leading spaces and the editor is taking the spaces as an indent.

I'm not sure that a special option would be the way to go - it would be better to simply copy the line without the spaces in the first place.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 03:03pm 23 Dec 2016
Copy link to clipboard 
Print this post

not quite, i'm grabbing a section of code from another program (consisting of several lines) and pasting it into the editor. for example, if i have this code in notepad:


Sub isr ' serial port handler
Local I, S$ length 80
S$ = Input$(72,#1)
If running Then
A$ = Right$(A$,255-Len(S$))+S$
I = Instr(A$,Chr$(13)+Chr$(10))
If I<>0 Then
CB$(head) = Left$(A$,I-1)
head = (head Mod 10)+1
If I<254 Then A$ = Mid$(A$,I+2) Else A$=""
EndIf
EndIf
End Sub


copy it to the clipboard, go to teraterm, and paste it into the micromite editor by right-clicking the mouse and clicking 'ok', i get:

Sub isr ' serial port handler
Local I, S$ length 80
S$ = Input$(72,#1)
If running Then
A$ = Right$(A$,255-Len(S$))+S$
I = Instr(A$,Chr$(13)+Chr$(10))
If I<>0 Then
CB$(head) = Left$(A$,I-1)
head = (head Mod 10)+1
If I<254 Then A$ = Mid$(A$,I+2) Else A$=""
EndIf
EndIf
End Sub


for this to work without dropping lines or characters i have to set a 500ms per line delay in teraterm. if i also set a 20ms per character delay, the editor (a) goes crazy when pasting (inserting even more indenting) and (b) cursor movement keys are interpreted as pressing 'esc' to exit.

are you able to reproduce this behaviour?

cheers,
rob :-)Edited by robert.rozee 2016-12-25
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 05:27pm 23 Dec 2016
Copy link to clipboard 
Print this post

I am not with my test setup (I'm in Sydney) but I can see where the problem is occurring. After the last post I thought of a solution where the editor could detect a fast stream of characters and switch to "paste mode" and in that case it could also suspend indenting. I will explore the idea further.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 09:00pm 23 Dec 2016
Copy link to clipboard 
Print this post

geoff: that would be extremely useful - with screen updates suspended in 'paste mode' until perhaps 500ms of continuous silence from the console.


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 02:56am 24 Dec 2016
Copy link to clipboard 
Print this post

have just uncovered an 'interesting' feature - if there are characters to the right of the cursor and you insert a block of text (as i've been doing above), automatic indenting appears to be disabled. though i still think adding a 'paste mode' with screen updating disabled is worthwhile, as it has a good chance of also eliminating the need to adjust line delays in teraterm.


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 03:45am 27 Dec 2016
Copy link to clipboard 
Print this post

page 36, micromite user manual 5.3 beta 3

"Arithmetic operators such as +, -, etc will be confused by a
64-bit unsigned number and will return nonsense results."

the above statements seem be outdated, as arithmetic operations all seem to work ok. perhaps it should say that scientific functions (sin, cos, etc) may be confused, although the couple i checked also worked on.


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 04:04am 27 Dec 2016
Copy link to clipboard 
Print this post

a small oversight in the handling of constants:

Const A%=123
Print A, A%
Const B$="hello"
Print B$, B
End

> run
123 123
hello hello
>


the above code should, strictly speaking, generate errors.


cheers,
rob :-)
Edited by robert.rozee 2016-12-28
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 01:01pm 27 Dec 2016
Copy link to clipboard 
Print this post

  robert.rozee said  "Arithmetic operators such as +, -, etc will be confused by a
64-bit unsigned number and will return nonsense results."

Yes, it would be more accurate if the text read: ...and may return nonsense results.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 03:17pm 27 Dec 2016
Copy link to clipboard 
Print this post

  Geoffg said  
  robert.rozee said  "Arithmetic operators such as +, -, etc will be confused by a
64-bit unsigned number and will return nonsense results."

Yes, it would be more accurate if the text read: ...and may return nonsense results


just re-read the manual, and see it is actually talking specifically about unsigned integers greater than 2^63 (ie, ones that wrap around to negative numbers).

a clearer approach may be to replace that whole section with something like:

Signed versus Unsigned Integers
Unlike floating point variables, integers variables are stored in such a way that they wrap around instead of overflowing and generating an error message. This can produce unexpected results when carrying out arithmatic using very large integer variables. Also, the Print statement will show the sign of an integer, while the hex$() statement returns the unsigned equivalent.

X% = &h7000000000000000
Y% = 0
For I=1 To 4
Y% = Y% + X%
Print Y%, Hex$(Y%)
Next I

> run
8070450532247928832 7000000000000000
-2305843009213693952 E000000000000000
5764607523034234880 5000000000000000
-4611686018427387904 C000000000000000
>


In the above example, no overflow error occurs when the addition statement Y% = Y% + X% overflows, the result just becomes negative. Print displays values greater than 2^63 as negative numbers, while Hex$() returns a 64-bit unsigned equivalent.

----

cheers,
rob :-)
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:45pm 05 May 2017
Copy link to clipboard 
Print this post

  Geoffg said  I thought of a solution where the editor could detect a fast stream of characters and switch to "paste mode" and in that case it could also suspend indenting. I will explore the idea further.

  robert.rozee said   geoff: that would be extremely useful - with screen updates suspended in 'paste mode' until perhaps 500ms of continuous silence from the console.

I have finally had the time to investigate this feature and sadly I must report that it cannot be done.

The reason is that the PIC32 just cannot stuff the characters into memory fast enough to keep up with the serial data stream. Each character needs to be inserted into the text in RAM which means that the characters after the insert point must be shuffled up to make space. At 38400 baud the data comes at 26uS per character and at 230400 baud it is just 4uS. I have tried all sorts of optimisations but I cannot get even close to this speed.

The AUTOSAVE command just stuffs the characters into memory with no checking or shuffling and even this struggles to keep up.

So, sorry about that Rob,
Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2291
Posted: 02:35am 06 May 2017
Copy link to clipboard 
Print this post

no worries, afterwards i did find myself thinking there may be major roadblocks with simply running out of computrons. i shall look at creating a teraterm macro to adjust the send delays used by teraterm that could be used instead.

although, since you mention that AUTOSAVE can just manage to keep up... what if there was a 'fast paste' key (perhaps shift-F5) that switched to saving input characters into unused RAM starting at the top and working down (ie, text would be saved backwards), and that after seeing a ctrl-Z in the data stream the editor terminates this 'fast paste' mode and inserts the characters at the cursor position at a suitably leisurely pace?


cheers,
rob :-)Edited by robert.rozee 2017-05-07
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 11:50am 06 May 2017
Copy link to clipboard 
Print this post

Yes, I thought about that but it was getting for too complicated for such a little feature.
Geoff Graham - http://geoffg.net
 
IvDel
Newbie

Joined: 02/05/2014
Location: Bulgaria
Posts: 4
Posted: 02:20am 09 May 2017
Copy link to clipboard 
Print this post

Greetings!
@Geoffg, could you give me information if you're planning on publishing an update of the source codes for micromite, MX and MZ Extreme on your official website?
I saw that the last published version is 5.3.02 but new versions are commented about on the forum.
Thank you.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:16pm 10 May 2017
Copy link to clipboard 
Print this post

Hi Ivan and welcome to the forum.

Normally I release the source for each "official" MM and MM+ release but not for test or beta releases because they change so rapidly and I have not documented them properly. I am working on a new release at this time and when finished I will publish the source for that.

The MMX source is managed by Peter Mather and I suspect that he will follow a similar routine and send me the source for his version at the next major release.

Geoff
Geoff Graham - http://geoffg.net
 
IvDel
Newbie

Joined: 02/05/2014
Location: Bulgaria
Posts: 4
Posted: 10:21pm 10 May 2017
Copy link to clipboard 
Print this post

Thank you, Geoff!
 
     Page 3 of 3    
Print this page


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

© JAQ Software 2024