Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:50 29 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 : Promote for Base 64 Coded Strings and Data Transfer

     Page 1 of 2    
Author Message
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 12:25am 16 Mar 2023
Copy link to clipboard 
Print this post

I want to promote for four new functions.

We have PICO WEB possibilities now. I think Base64 encoded strings are necessary.

1. B64Encode$(str$) returns a Base 64 encoded string

2. B64Decode$(str$) returns string decoded from a Base 64 coded string

Gone are the days of CPM drives and phone modems.
The probably error-prone XMODEM is no longer state of the art.

3. B64SEND(str$) sends a base 64 encoded string followed by Ctrl-Z and returns the number of characters sent to check for a successful send.
  B64SEND(str$, filename$) The same as before, but str$ can be a bitmap header or empty.
 
4. B64RECEIVE$(str$) receives a base 64 encoded string and decoded it automatically. The receiving stops until Ctrl-Z is detected. Like AUTOSAVE
  B64RECEIVE(filename$) The same as before, but stores the data encoded into a file under filename$. Returns the number of received characters.
 
Maybe a first argument could specifiy a serial port number (USB = 0) like B64SEND(port, str$).
The port could also be an ip address with port number.

Checking the number of characters are sent is useful in case of temporally broken wirings.
For my part, I could then do without XMODEM.

What do you think about that?

Gregor
Edited 2023-03-16 10:53 by aFox
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 07:25am 16 Mar 2023
Copy link to clipboard 
Print this post

All command and function name slots are currently full on the PicoMite (all versions AFAIK). Only matherp can answer this further.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2080
Posted: 10:00am 16 Mar 2023
Copy link to clipboard 
Print this post

With Airfix, you can build one thing, with Lego the possibilities are endless

http://www.fruitoftheshed.com/MMBasic.Base64-Mime-Encode-and-Decode-Functions.ashx

you might also like

http://www.fruitoftheshed.com/MMBasic.URL-ENCODE-Function.ashx
http://www.fruitoftheshed.com/MMBasic.URL-DECODE-Function.ashx
Edited 2023-03-16 20:01 by CaptainBoing
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 11:55am 16 Mar 2023
Copy link to clipboard 
Print this post

Nice one (inc one#,2) Cap'n. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2080
Posted: 12:59pm 16 Mar 2023
Copy link to clipboard 
Print this post

hth
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4256
Posted: 01:13pm 16 Mar 2023
Copy link to clipboard 
Print this post

  aFox said  I could then do without XMODEM.

What do you think about that?

Gregor


No, you would loose MMEdit

Volhout
PicomiteVGA PETSCII ROBOTS
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 01:54pm 16 Mar 2023
Copy link to clipboard 
Print this post

This is something that comes up often, rather than writing a simple subroutine to do something people want it built into the language.

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

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 02:00pm 16 Mar 2023
Copy link to clipboard 
Print this post

@Geoff

I often think we should have a library of subroutines and not burden the language itself.
Best regards
Michael
causality ≠ correlation ≠ coincidence
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3816
Posted: 02:02pm 16 Mar 2023
Copy link to clipboard 
Print this post

  twofingers said  @Geoff

I often think we should have a library of subroutines and not burden the language itself.
Best regards
Michael

Like fruitoftheshed?

John
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 02:08pm 16 Mar 2023
Copy link to clipboard 
Print this post

EDIT:
oops, double post. Sorry
Edited 2023-03-17 00:10 by twofingers
causality ≠ correlation ≠ coincidence
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2135
Posted: 02:10pm 16 Mar 2023
Copy link to clipboard 
Print this post

Why doesn't mmedit make triangle a key word like it does box? triangle works though.
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2080
Posted: 02:13pm 16 Mar 2023
Copy link to clipboard 
Print this post

  twofingers said  
I often think we should have a library of subroutines and not burden the language itself.


http://www.fruitoftheshed.com/MMBasic.AllPages.aspx
Edited 2023-03-17 00:14 by CaptainBoing
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 02:33pm 16 Mar 2023
Copy link to clipboard 
Print this post

  JohnS said  
Like fruitoftheshed?John

No, more officially checked and distributed with the firmware. Just like it used to be with Micromite firmware. Of course, Fruitoftheshed has its place!



Edited 2023-03-17 00:46 by twofingers
causality ≠ correlation ≠ coincidence
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 02:36pm 16 Mar 2023
Copy link to clipboard 
Print this post

  twofingers said  No, more officially checked and distributed with the firmware. Just like it used to be with Micromite firmware. Of course, Fruitoftheshed has its place!


Before my time, but I wouldn't be suprised if that was a dreadful burden on the maintainer.

Best wishes,

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

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 02:41pm 16 Mar 2023
Copy link to clipboard 
Print this post

  thwill said  Before my time, but I wouldn't be suprised if that was a dreadful burden on the maintainer.

That's true, but I think there definitely needs to be more support for Peter.
causality ≠ correlation ≠ coincidence
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 02:49pm 16 Mar 2023
Copy link to clipboard 
Print this post

  twofingers said  
  thwill said  Before my time, but I wouldn't be suprised if that was a dreadful burden on the maintainer.

That's true, but I think there definitely needs to be more support for Peter.


I don't disagree (and try to do my bit), but as I've said before TBS and the 'mites aren't a business and some things, such as this, generally require financial renumeration (not asking) or somebody very enthusiastic with an over-abundance of spare time (looks at the largely, presumably, retired population of the shed).

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 09:39pm 16 Mar 2023
Copy link to clipboard 
Print this post

Mick said:
 All command and function name slots are currently full on the PicoMite (all versions AFAIK).
> OK

@ CaptainBoing
> Very useful links
> Would be nice if these links or the BASIC codes will be added into the next version of the picomite manual,
> because I had not find any hints or code by the search of the forum asking for b64 or Base 64.
> Is this also a solution for LONGSTRINGs in view of speed?

Geoff wrote:
This is something that comes up often, rather than writing a simple subroutine to do something people want it built into the language.
> Geoff I agree with you but sometimes it needs more speed and also a simplified usage.
> The DISTANCE() function is an example for both.

A second try:

1. LONGSTRING B64 ENCODE CONCAT dest%(), src%()
2. LONGSTRING B64 DECODE CONCAT dest%(), src%()

In view of Pico versions with more memory and SD-cards
Sending and receiving Base 64 encoded Strings in parts of max. 64 bytes + LF and Ctrl-Z as EOF
3. B64 SEND filename$
4. B64 RESEIVE filename$

Or

3. XMODEM B64 SEND filename$
4. XMODEM B64 RESEIVE filename$
In this case only Base 64 encoded without special XMODEM stuff.

Ok, for small files I can write a program to handle this simple protocol.
But with larger file sizes?

We should see also the other side of the connection.
From XModem.c "From It has been tested on Terra Term and is intended for use with that software."
The other side is not only a Tera Term terminal.
I think it could be easier.

I am sure you will find a solution, not today but in the future.

Gregor
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1245
Posted: 10:07pm 16 Mar 2023
Copy link to clipboard 
Print this post

  aFox said  ... > Geoff I agree with you but sometimes it needs more speed and also a simplified usage.
> The DISTANCE() function is an example for both.[...]

I don't quite understand why a function like this shouldn't be possible with CSubs.

I don't mind if Peter adds additional features. My only concern is that it will come at the expense of available memory ... and Peter's time.
Best regards
Michael
causality ≠ correlation ≠ coincidence
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6814
Posted: 10:28pm 16 Mar 2023
Copy link to clipboard 
Print this post

Also, every additional command is something that 90% of users will never use so it's using up valuable hardware. If you *need* speed then CSUBs are the answer, but that's rarely the case. The PicoMite is plenty fast enough *for the sort of programs it's aimed at*. If you have to have huge, complex and fast programs then the RP2040 isn't for you, it's the wrong platform.

Note that ease of use doesn't necessarily mean much faster. The interpreter still has to go through the same code that it would if you wrote a CSUB. If you want really fast IO then learn how to use the PIO instead of trying to do it in MMBasic - that's what it's for. Having said that, BITBANG can produce virtually any serial output that you might want, and with great accuracy.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3816
Posted: 11:46pm 16 Mar 2023
Copy link to clipboard 
Print this post

I like Base64 (somewhat) but what problem is important enough that XMODEM isn't good enough?

If you're transferring big files, use the SD card or a Pico W maybe?

John
 
     Page 1 of 2    
Print this page
© JAQ Software 2024