![]() |
Forum Index : Microcontroller and PC projects : File Manager for PicoMite
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
Hello Javavi, I don't want to develop my own version but I would like to support yours! My first idea would be, to replace the "print @()" commands in the main code with a sub(). Only positioning values will stay for the moment. Are you interested? |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 436 |
Yes, this is an interesting idea and a possible way to unify with the console. All actions on output should be done in one universal procedure. It may of course slow down the work a little when quickly switching through the list of files. I need to try it.. Edited 2025-04-03 01:48 by javavi |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
Exactly. So we should think and agree on the syntax. When ending a line with a semicolon, a flag is maybe necessary and may be other things, I can't see. Suggestions? And if you accept some help I want to make clear, that it stays your work and I don't want to be even named! ..I could maybe do the ugly search and replace? :)) Edited 2025-04-03 02:00 by dddns |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
The plan I see seems to be not so hard: It's disabling the local screen for console output. see "option console" The printing routine formats for "text" and "print @" with according escape codes The user decides per config if output is serial/screen/both Printing with "text" to screen could be faster. Disabling one or the other because its not needed makes it faster Thoughts? |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 436 |
Hi Michael, I also encountered a problem when using two-dimensional arrays. For example, the sorting function takes a one-dimensional array as input, and I don't want to reload a large array of data from a two-dimensional array to a one-dimensional one, since I was trying to limit the use of RAM. Would there be a way to declare a reference to half of a two-dimensional array? By the way, would it be good to have a mechanism for assigning references to variables not only when passing names to subroutines and functions, or does it already exist? |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1520 |
> list Dim a$(1)=("atest0","atest1") Dim b$(1,1)=("test0.0","test0.1","test1.0","test1.1") btest(b$(0,1)) btest(b$(0,0)) End Sub btest(in$()) Print in$(0,0) Print in$(1,0) Print in$(0,1) Print in$(1,1) End Sub End Output: test1.0 test1.1 atest0 atest1 test0.0 test0.1 test1.0 test1.1 I think it looks good. You just need to pass the first element of the second dimension (here: btest(b$(0,1)). Remember, you're actually only passing the initial addresses! I don't understand. Can you give me an example? Regards Michael Edited 2025-04-03 04:01 by twofingers causality ≠ correlation ≠ coincidence |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
Because "print @" is made for console so it prints to it. But console is bound to the speed in which it is setup. @twofingers Have you tried setting the console to "option baudrate 921600" and the same on PC with a usb converter? -..action guaranteed |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10008 |
Here is code that is translated from the C from my playing with the FRAME command - uses a couple of MM. variables that aren't in RC9 but will be in RC10. This should be pretty much all that is needed (perhaps some cursor on/off as well but the idea will be the same, also either line wrap or line truncate for write and writeat) MM.DISPLAY - tells you if there is a connected physical display VGA/HDMI or TFT MM.HEIGHT gives the number of characters down the physical display with the current font MM.WIDTH gives the number of characters across the physical display with the current font |
||||
javavi![]() Guru ![]() Joined: 01/10/2023 Location: UkrainePosts: 436 |
Yes, it looks impressive! But the SORT command I use doesn't accept this, it only needs a one-dimensional array. Dim string A$(1,1)=("D","C","B","A") Sort A$() Error : Invalid variable For example, I need in the program to make a choice at the beginning which variable to use and assign a reference to it, and then the algorithm would work with this reference. As is now possible when passing the variable name to the subroutine. But sometimes I need such a reference to the selected variable in the program body. Edited 2025-04-03 05:09 by javavi |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
Many thanks! |
||||
BarryH![]() Newbie ![]() Joined: 05/01/2025 Location: AustraliaPosts: 9 |
@twofingers I'm struggling to understand what is happening in this piece of code. Could you please explain the mechanics (how/why) of it in more detail - eli5 thanks > list Dim a$(1)=("atest0","atest1") Dim b$(1,1)=("test0.0","test0.1","test1.0","test1.1") btest(b$(0,1)) btest(b$(0,0)) End Sub btest(in$()) Print in$(0,0) Print in$(1,0) Print in$(0,1) Print in$(1,1) End Sub End Output: test1.0 test1.1 atest0 atest1 test0.0 test0.1 test1.0 test1.1 BarryH |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1520 |
Hi Vadim, hi Barry, forget it! I've checked again. There doesn't seem to be a "legal" and clean way to pass a partial array. Perhaps Peter can change that someday. A string array copy and a string array reset would also be good and useful. So far, the only ways I've come up with for deleting a string array are re-dimensioning (Erase/Dim) or a looping solution. Regards Michael causality ≠ correlation ≠ coincidence |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
maybe with this line: Dim b$(1,1)=("test0.0","test0.1","test1.0","test1.1") This initializes and fills a 2 dimensional array b$() with 2 elements for column and row Array numbering starts with 0 In the brackets are listed values for all elements of row 0 AND THEN all elements of row 1 and so on. Number of elements given in brackets must exactly match the definition of the array with the dim statement. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7471 |
Just a thought... You know the address of the array. Why not overwrite its header to set its dimensions to zero? You could probably do all sorts of strange things like this. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1520 |
Hi Mick, ![]() Regards MIchael causality ≠ correlation ≠ coincidence |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
One would call it a feature others would call it a bug edit: If it is used as intended, it works and is an enrichment Edited 2025-04-03 22:17 by dddns |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1121 |
MATH SLICE and MATH INSERT can copy single array dimensions out of/in to multi-dimension arrays. Visit Vegipete's *Mite Library for cool programs. |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1520 |
Hi Pete, this is about string arrays. Can you tell us how this works for string arrays? It's also about passing part of a two-dimensional string array to a subroutine. This works: Dim A$(200) sub dosomething (a$()) sort a$() ... ... etc. end sub We want to find a way to make this work: Dim A$(200,1) sub dosomething (a$(,1))'Pass only the second part of the array end sub And all this without any contortions or slow copying in loops. ![]() This isn't about the functionality of the program; it works without this (to pass a partial array); it's more about saving memory, speed, aesthetics, and elegance! ![]() Regards Michael causality ≠ correlation ≠ coincidence |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10008 |
It doesn't. The clues in the command name "MATH" == numbers ![]() |
||||
dddns Senior Member ![]() Joined: 20/09/2024 Location: GermanyPosts: 215 |
Memory is the point for me. But I think it could look elegant as well, two use a pair of single dimension arrays. I'm not sure but I cannot imagine that this will ever work due to the internal management of memory allocated for multi dimensional arrays. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |