Posted: 03:09pm 02 Apr 2025 Copy link to clipboard
dddns Guru
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?
Posted: 03:45pm 02 Apr 2025 Copy link to clipboard
javavi Guru
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
Posted: 03:51pm 02 Apr 2025 Copy link to clipboard
dddns Guru
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
Posted: 04:16pm 02 Apr 2025 Copy link to clipboard
dddns Guru
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?
Posted: 04:43pm 02 Apr 2025 Copy link to clipboard
javavi Guru
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?
Posted: 05:49pm 02 Apr 2025 Copy link to clipboard
twofingers Guru
> list Dim a$(1)=("atest0","atest1") Dim b$(1,1)=("test0.0","test0.1","test1.0","test1.1") btest(b$(0,1)) Print btest(b$(0,0)) Print 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
Posted: 06:02pm 02 Apr 2025 Copy link to clipboard
dddns Guru
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
Posted: 06:43pm 02 Apr 2025 Copy link to clipboard
matherp Guru
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
Posted: 06:59pm 02 Apr 2025 Copy link to clipboard
javavi Guru
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
Posted: 09:53pm 02 Apr 2025 Copy link to clipboard
dddns Guru
Many thanks!
Posted: 10:35am 03 Apr 2025 Copy link to clipboard
BarryH Newbie
@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)) Print btest(b$(0,0)) Print 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
Posted: 11:06am 03 Apr 2025 Copy link to clipboard
twofingers Guru
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
Posted: 11:27am 03 Apr 2025 Copy link to clipboard
dddns Guru
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.
Posted: 11:32am 03 Apr 2025 Copy link to clipboard
Mixtel90 Guru
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.
Posted: 11:39am 03 Apr 2025 Copy link to clipboard
twofingers Guru
Hi Mick,
Regards MIchael
Posted: 12:04pm 03 Apr 2025 Copy link to clipboard
dddns Guru
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
Posted: 09:51pm 03 Apr 2025 Copy link to clipboard
vegipete Guru
MATH SLICE and MATH INSERT can copy single array dimensions out of/in to multi-dimension arrays.
Posted: 09:11am 04 Apr 2025 Copy link to clipboard
twofingers Guru
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
Posted: 09:25am 04 Apr 2025 Copy link to clipboard
matherp Guru
It doesn't. The clues in the command name "MATH" == numbers
Posted: 09:37am 04 Apr 2025 Copy link to clipboard
dddns Guru
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.
Page 14 of 17
The Back Shed's forum code is written, and hosted, in Australia.