Posted: 03:53pm 05 Jun 2025 Copy link to clipboard
jkdelauney Newbie
Thanks. I compared your current repo state to the last pull I had and I see what you're talking about.
I might not be able to learn from my own mistakes, but I can at least learn from other's. ;) Edited 2025-06-06 01:53 by jkdelauney
Posted: 04:19pm 05 Jun 2025 Copy link to clipboard
Bleep Guru
Alternatively, allow the same x, y, x, y, w, h parameters in the Framebuffer copy? which already has the background option. Edited 2025-06-06 02:20 by Bleep
Posted: 03:21am 06 Jun 2025 Copy link to clipboard
disco4now Guru
Peter, What do you think about the CHAIN command not running the normal code in the library. All other resources in the library (SUBs,FUNCTIONs,FONTs CSUBs) are still available to the chained program just the normal code it not run. The FLASH CHAIN command does not run the normal code. i.e. comment this line in do_chain()
if(Option.LIBRARY_FLASH_SIZE == MAX_PROG_SIZE) ExecuteProgram(LibMemory ); // run anything that might be in the library
Gerry
Posted: 07:33am 06 Jun 2025 Copy link to clipboard
matherp Guru
This discussion stems from, IMHO, incorrect use of the library. It should be a repository of subroutines and functions that are , in effect extending the language. Again, IMHO, it should never contain executable main program code and definitely should not be declaring global variables without ON SKIP protection. Disabling the library would mean that anything in the library would be inaccessible in the chained program. FLASH CHAIN is very different as it runs a pre-tokenised image. CHAIN loads from source and has to tokenise which means it rebuilds the subroutine tables. In any event, unless any critical bugs are found in the next few days, the release is completely closed and I have already sent the binaries to Geoff ready for release.
Posted: 07:54am 06 Jun 2025 Copy link to clipboard
Mixtel90 Guru
I can't understand why you would even consider having executable code in the Library, especially trying to Chain to it as the Library routines (like all well-behaved subroutines and functions) should all be using their own local variables so there's no need for them to access the variables area of the previous program. The only reason to try that I can see is to see if it breaks. :)
Posted: 08:46am 06 Jun 2025 Copy link to clipboard
toml_12953 Guru
I like to initialize constants to be used in every program such as TRUE=-1, FALSE=0, etc. I also like to set OPTION BASE 1, OPTION ESCAPE and other temporary options. The only problem is declaring the constants but now I get around it by doing this:
ON ERROR SKIP 2 CONST TRUE=-1 CONST FALSE=0 OPTION ESCAPE OPTION BASE 1 : : :
Posted: 08:55am 06 Jun 2025 Copy link to clipboard
matherp Guru
Much better, in my view, to have a template that you use to create any new program and put these in the template rather than the library. No need for ON ERROR then. I seem to remember MMEDIT supports such a template?
Posted: 09:46am 06 Jun 2025 Copy link to clipboard
Mixtel90 Guru
If you don't use MMEDIT then it's easy enough to LOAD "template.bas" from SD card before you start programming.
Posted: 02:55pm 06 Jun 2025 Copy link to clipboard
Amnesie Guru
Hello, I think I found a bug...
can anyone confirm this? I was trying the Keypad feature, see for yourself:
I tried also tried a different syntax, always the same. I am using as you can see a 128x64 LCD... Because of the "display error" in Putty I also tried to do something like:
option display 24,80
Problem persists. I have a 2 row by 3 column keypad.. I don't know what I am doing wrong.
row1 is: GP20 row2 is: GP21 col1 is: GP22 col2 is: GP19 col3 is: GP18
Greetings Daniel
Posted: 03:22pm 06 Jun 2025 Copy link to clipboard
matherp Guru
Obviously the error isn't right but manual page 55
Posted: 03:28pm 06 Jun 2025 Copy link to clipboard
Amnesie Guru
Hello Peter,
thank you a lot for your reply! Ahh this is my bad. My PCB is already designed for an 2 by 3 row Keypad... Hm.. Ok. Then I have to do a redesign. I assumed, that it would be no problem to allow a smaller keypad. Sorry my bad
Or is there a work-around possible?
I have some pins left, that I initially wanted to use for GPIO...
Greetings Daniel Edited 2025-06-07 01:34 by Amnesie
Posted: 03:35pm 06 Jun 2025 Copy link to clipboard
matherp Guru
If you have two unassigned pins then just include these in the keypad command and your PCB will work fine. Otherwise just run the scan in a timed Basic interrupt Edited 2025-06-07 01:36 by matherp
Posted: 03:48pm 06 Jun 2025 Copy link to clipboard
Amnesie Guru
Ah, thanks, good Idea! I know that a 2 by 3 keypad seems a bid odd, but I am saving one single pin at least .. Hey there are projects in which every single Pin counts... so I thought, it would work with the built-in keypad function. But you gave me a good hint! Thanks!
Greetings Daniel
Posted: 04:02pm 06 Jun 2025 Copy link to clipboard
Mixtel90 Guru
Of course, in some cases you can get several buttons on a single ADC input by switching resistors. You can save a lot of pins like that. In practice you can probably get 4 or 5 buttons easily, more if your resistor tolerances are good.
Posted: 02:01am 07 Jun 2025 Copy link to clipboard
phil99 Guru
Having trouble with BYVAL in latest RC. According to the manual changing the value in this test Sub should leave the original value unchanged. Or have I got it wrong? If that is the case an example in the manual would make it clearer.
> LIST ' Test prog 1 Dim integer a=5 Print "a =";a test
Sub test(BYVAL a As integer) If a = 5 Then a = 10 Print "In Sub a =";a EndIf End Sub
Print "After Sub a =";a End > > > RUN a = 5 In Sub a = 10 After Sub a = 10 > > option list PicoMite MMBasic RP2040 Edition V6.00.02RC26 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION SYSTEM I2C GP8,GP9 OPTION COLOURCODE ON OPTION CONTINUATION LINES ON OPTION CPUSPEED (KHz) 378000 OPTION DISPLAY 55, 155 OPTION LCDPANEL ST7796S, PORTRAIT,GP15,GP14,GP13,GP20 OPTION TOUCH GP12,GP11 GUI CALIBRATE 1, 140, 3979, 855, -1278 OPTION SDCARD GP17 OPTION RTC AUTO ENABLE >
Edited 2025-06-07 12:05 by phil99
Posted: 02:33am 07 Jun 2025 Copy link to clipboard
TassyJim Guru
' Test prog 1 DIM INTEGER a=5 PRINT "a =";a TEST a ''''''''' you forgot the parameter for the SUB
SUB TEST(BYVAL a AS INTEGER) IF a = 5 THEN a = 10 PRINT "In Sub a =";a ENDIF END SUB
PRINT "After Sub a =";a END
Posted: 02:37am 07 Jun 2025 Copy link to clipboard
toml_12953 Guru
You're not using a as a parameter when you call test. Change test to test a. If a isn't a parameter, it's global unless you define it as local in the sub.
> LIST ' Test prog 1 Dim integer a=5 Print "a =";a test a
Sub test(BYVAL a As integer) If a = 5 Then a = 10 Print "In Sub a =";a EndIf End Sub
Print "After Sub a =";a End > > > RUN a = 5 In Sub a = 10 After Sub a = 5 >
Posted: 03:17am 07 Jun 2025 Copy link to clipboard
phil99 Guru
Yes, me thick!
An example always help dimwits like me. Edited 2025-06-07 13:23 by phil99
Posted: 03:31am 07 Jun 2025 Copy link to clipboard
toml_12953 Guru
Take some solace in knowing that most BASICs would give you an error for trying to call a SUB that takes parameters without supplying them. MMBasic assumes you'll just do it right. That makes it a lot harder to debug a large program when integers can get out of range without an error and SUBs can be called with missing parameters, among other non-existent checks.
Posted: 04:51am 07 Jun 2025 Copy link to clipboard
TassyJim Guru
MMBASIC must be better than "most BASICs"
Edited 2025-06-07 14:52 by TassyJim
Page 50 of 52
The Back Shed's forum code is written, and hosted, in Australia.