|
Forum Index : Microcontroller and PC projects : commands in mmbasic CELLINPUT CELLSET SHOWGRID video
| Author | Message | ||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
commands in mmbasic CELLINPUT CELLSET SHOWGRID video link to video mmbasic picomite > cls > cellinput 1,1 Invoer: 21 > cellinput 1,2 Invoer: 66 > cellinput 1,3 Invoer: 89 > cellset 1, 4, cell(1,1)+cell(1,2) > cellset 2, 2, cell(1,3)+20 > showgrid A B C D E +----------+----------+----------+----------+----------+ 1 | 21 | 66 | 89 | 87 | . | +----------+----------+----------+----------+----------+ 2 | . | 109 | . | . | . | +----------+----------+----------+----------+----------+ 3 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 4 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 5 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 6 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 7 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 8 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 9 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 10 | . | . | . | . | . | +----------+----------+----------+----------+----------+ |
||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
i try this bas program ' Spreadsheet Test Programma ' Maakt een simpele berekening voor 3 producten ' 1. Maak het grid eerst helemaal leeg (optioneel) CLS PRINT "Spreadsheet Grid Test wordt geladen..." ' 2. Productnamen en prijzen invoeren ' We gebruiken CELLINPUT voor tekst en vaste getallen CELLINPUT 1, 1, "Appels" CELLINPUT 1, 2, 1.50 ' Prijs per stuk CELLINPUT 2, 1, "Bananen" CELLINPUT 2, 2, 0.80 CELLINPUT 3, 1, "Peren" CELLINPUT 3, 2, 1.25 ' 3. Aantallen invoeren (je zou hier ook een prompt kunnen gebruiken) CELLINPUT 1, 3, 10 ' 10 appels CELLINPUT 2, 3, 5 ' 5 bananen CELLINPUT 3, 3, 12 ' 12 peren ' 4. Berekeningen maken met CELLSET en CELL() ' We berekenen de subtotalen: Prijs (kolom 2) * Aantal (kolom 3) PRINT "Berekeningen uitvoeren..." CELLSET 1, 4, CELL(1, 2) * CELL(1, 3) CELLSET 2, 4, CELL(2, 2) * CELL(2, 3) CELLSET 3, 4, CELL(3, 2) * CELL(3, 3) ' 5. Totaal berekenen van de hele kolom 4 CELLSET 5, 4, CELL(1, 4) + CELL(2, 4) + CELL(3, 4) CELLINPUT 5, 3, "TOTAAL:" ' 6. Het resultaat tonen PRINT "Klaar! Hier is het overzicht:" SHOWGRID output picomite > run Spreadsheet Grid Test wordt geladen... Berekeningen uitvoeren... Klaar! Hier is het overzicht: A B C D E +----------+----------+----------+----------+----------+ 1 | "Appels" | 1.50 | 10 | 15 | . | +----------+----------+----------+----------+----------+ 2 | "Bananen"| 0.80 | 5 | 4 | . | +----------+----------+----------+----------+----------+ 3 | "Peren" | 1.25 | 12 | 15 | . | +----------+----------+----------+----------+----------+ 4 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 5 | . | . | "TOTAAL:"| 34 | . | +----------+----------+----------+----------+----------+ 6 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 7 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 8 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 9 | . | . | . | . | . | +----------+----------+----------+----------+----------+ 10 | . | . | . | . | . | +----------+----------+----------+----------+----------+ |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5682 |
Hoi tenij000, Kun je ook je library subs laten zien. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
if back home upload hole thing to github but i did things like this // CELLINPUT: Voor tekst of handmatige getallen void cmd_cellinput(void) { getargs(&cmdline, 5, (unsigned char *)","); if (argc < 3) error("Syntaxis: CELLINPUT rij, kolom [, waarde]"); int row = (int)getinteger(argv[0]) - 1; int col = (int)getinteger(argv[2]) - 1; if (row < 0 || row >= GRID_ROWS || col < 0 || col >= GRID_COLS) error("Cel buiten bereik"); if (argc == 5) { // Directe invoer: CELLINPUT 1, 1, 100 strncpy((char *)grid_data[row][col], (char *)argv[4], GRID_CELL_SIZE - 1); } else { // Interactieve invoer: CELLINPUT 1, 1 unsigned char *input = GetTempStrMemory(); MMPrintString("Invoer: "); MMgetline(0, (char *)input); strncpy((char *)grid_data[row][col], (char *)input, GRID_CELL_SIZE - 1); } } // rob ---------------------------------------------------- // CELLSET: Rekent een som uit en plaatst de uitsl*g in een cel void cmd_cellset(void) { getargs(&cmdline, 5, (unsigned char *)","); if (argc < 5) error("Syntaxis: CELLSET rij, kolom, waarde"); int row = (int)getinteger(argv[0]) - 1; int col = (int)getinteger(argv[2]) - 1; MMFLOAT val = getnumber(argv[4]); // Gebruikt de PicoMite rekenmachine if (row < 0 || row >= GRID_ROWS || col < 0 || col >= GRID_COLS) error("Cel buiten bereik"); sprintf((char *)grid_data[row][col], "%.8g", (double)val); } void cmd_showgrid(void) { int r, c; // 1. Print de kolomkop (A t/m E) - Gewone tekst MMPrintString("\r\n "); for (c = 0; c < GRID_COLS; c++) { char header[16]; sprintf(header, " %c ", 'A' + c); MMPrintString(header); } MMPrintString("\r\n"); // 2. Hulpprogramma voor een dynamische lijn void printLine() { MMPrintString(" +"); for (int i = 0; i < GRID_COLS; i++) { MMPrintString("----------+"); } MMPrintString("\r\n"); } printLine(); // Bovenste lijn for (r = 0; r < GRID_ROWS; r++) { // Rijnummer aan de linkerkant (zonder kleurcodes) char rowNum[10]; sprintf(rowNum, "%2d |", r + 1); MMPrintString(rowNum); for (c = 0; c < GRID_COLS; c++) { char cellDisplay[20]; if (grid_data[r][c][0] == 0) { strcpy(cellDisplay, " . "); } else { char temp[12]; strncpy(temp, (char *)grid_data[r][c], 9); temp[9] = 0; sprintf(cellDisplay, " %-9s", temp); } char formatted[24]; sprintf(formatted, "%s|", cellDisplay); MMPrintString(formatted); } MMPrintString("\r\n"); printLine(); // Tussenlijn } MMPrintString("\r\n"); } |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5682 |
So you created a CSUB ? Or did you re-compile the whole MMBasic project ? Volhout PicomiteVGA PETSCII ROBOTS |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4232 |
I'm wondering for that, why not use BASIC instead of C? Why is it worth altering MMBasic (with the ongoing support issues etc)? John |
||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
did not alter anything in mmbasic did only make new commands like mmbasic did after that just recompile hole thing into a picomite uf2 file github to project files hole thing i used to make UF2 file on github place hole thing all the files etc Edited 2026-02-12 00:18 by tenij000 |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8536 |
But this makes a new version of MMBasic that isn't compatible with the current one. It's a code fork. Naughty. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
do look at the wrong version of picomite only see 1 issu in total or is it me UKTailwind PicoMiteAllVersions Repository navigation Code Issues 1 (1) Pull requests 3 (3) Actions Projects Security Insights |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10946 |
Seems like the only thing it does is effectively create a 2d array where values can be a number or a string. This is easily replicated using an array of types Option explicit Font 7 Type element valid As integer num As float label As string length 31 End Type ' Dim spreadsheet(9,9) As element spreadsheet(1,1)=loadnum(22) spreadsheet(3,3)=loadstring("hello") displaysheet Function loadnum(a!) As element loadnum.num=a! loadnum.valid=1 End Function ' Function loadstring(a$) As element loadstring.label=a$ loadstring.valid=1 End Function ' Sub displaysheet Local x,y,xp For x=Asc("A") To Bound(spreadsheet(),2)+Asc("A") Print Tab((x-Asc("A")+1)*10);Chr$(x); Next x For y=0 To Bound(spreadsheet(),1) Print y; For x=Asc("A") To Bound(spreadsheet(),2)+Asc("A") xp=x-Asc("A") Print Tab((x-Asc("A")+1)*10); If spreadsheet(y,xp).label <>"" Then Print spreadsheet(y,xp).label; ElseIf spreadsheet(y,xp).valid Then Print spreadsheet(y,xp).num; EndIf Next x Next y End Sub Edited 2026-02-12 01:12 by matherp |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4343 |
Hi @tenij000, It's not just you, Peter, the lead (almost only) programmer on the PicoMite project is "git adverse" and the GitHub repository https://github.com/UKTailwind/PicoMiteAllVersions is a git repository in name only. As you can tell from the commit history it's just a series of undocumented dumps of the code that Peter has made to publish the source. There are no "Issues" or "Pull requests" and he isn't even fond of patches. Everything happens here on TBS, or in Private Messages or emails to Peter. Is this good open source development practice? No, it's a sh*t-show . HOWEVER it's difficult to argue with results. Compare the many significant features that Peter has added to the PicoMite in the last 12 months with my almost non-existent showing for MMBasic for Linux (https://github.com/thwill1000/mmb4l). Of course if Peter is so inconsiderate as to fall off his perch the MMBasic community might be in trouble. Long live our glorious lead programmer ,Tom P.S. I wouldn't accept this feature into the interpreter source either as it's something that is not performance sensitive and could be implemented directly in MMBasic code. Edited 2026-02-12 02:45 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10946 |
PicoMite is not an "open source" development. There are 12 variants of the PicoMite and my experience is that "contributers" usually overlook the full impact of their suggestions. For example SPRITE(B was recently promoted by a third party. Nothing particularly wrong with the concept. However the "contributers" code resulted in the RP2040 versions failing to link as it used so much extra global memory. I had to rewrite it pretty much completely to use dynamic memory allocation only when used to get it to work. Another "contributer" objected to my untidy make file and tried to push changes. A pity therefore that they would have broken all support for the RP2350B. I have full version control outside of github with the ability to rewind development to any given point. It works for me and I have zero intention of changing it. |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4343 |
... and I've given up trying to change that, but it doesn't mean I won't still yank your chain occasionally. Best wishes, Tom Edited 2026-02-12 03:06 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| tenij000 Regular Member Joined: 30/05/2025 Location: NetherlandsPosts: 66 |
then at least at github link i send they can see how to add a command in mmbasic if they wane play whit it |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10946 |
I've no idea what you are asking for. The source is on github. Anyone can do what they like with it as long as they respect the licence terms. I just don't accept changes via github Edited 2026-02-12 03:30 by matherp |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4343 |
Peter I felt it would be rude not to reply to the implied question, but I wouldn't think you rude if you chose to ignore this and end the conversation. I'm no longer asking for anything but it does concern me that developers arriving here with a willingness to contribute to the ostensibly open-source PicoMite find a less than open-source development process. Ignoring the whole patches/pull changes thing there is no useful Issues database, no readable commit history on GitHub and no release tags. By comparison: https://github.com/thwill1000/mmb4l/commits/main/ - readable history of (mostly) small atomic commits. https://github.com/thwill1000/mmb4l/tags - tagged commits for each release. with separate branches for the latest release: https://github.com/thwill1000/mmb4l/tree/main vs. work in progress: https://github.com/thwill1000/mmb4l/tree/develop-v0.8-5 So that bugs can be fixed against the release without dragging in unstable work in progress. That said, my Issues database (https://github.com/thwill1000/mmb4l/issues) is admittedly somewhat wanting. HOWEVER results matter and I largely don't argue with yours. Best wishes, Tom Edited 2026-02-12 21:26 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |