|
Forum Index : Microcontroller and PC projects : MMbasic RP2350 V6.01.00EXP with user-defined structures
| Author | Message | ||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
I love the fact that, at least so far, changes to MMBasic are additions that rarely mess up programs that you have already written for earlier versions. You can also carry on programming in the way you prefer, if you wish, without *having* to learn new things. The stuff is there should you choose to though. :) I still bemoan the loss of Flash Slots though, but I suppose that's just me. lol I'm slowly getting used to drive A:. :) As a New Year's Resolution I intend to finally print an up to date copy of the manual. Sometime within the New Year anyway. 5.07.03 is a bit dated. ;) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10826 |
V6.01.00EXP4 PicoMiteV6.01.00EXP4.zip MMBasic_Structures_Manual.pdf StructTest.zip New commands as per Jim's request - see manual and tests 77-84 STRUCT EXTRACT and STRUCT INSERT Edited 2025-12-31 19:49 by matherp |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6426 |
Thank you and happy new year! VK7JH MMedit |
||||
| karlelch Guru Joined: 30/10/2014 Location: GermanyPosts: 310 |
Thank you, Peter - These new additions are very useful! Happy New Year from Switzerland |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10826 |
Forgot to mention, the release also supports the new RV3028 RTC. This is EXPENSIVE but in theory, even more accurate than the DS3231. Just use RTC SETTIME, RTC GETTIME and OPTION RTC AUTO ENABLE as for the DS3231 Edited 2025-12-31 20:53 by matherp |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 540 |
I get a "Display not configured" in Test 76. I'm running the plain EXP4 version (no VGA, no HDMI) If I comment out the following line, all the other tests pass. BOX boxes(i%).x, boxes(i%).y, boxes(i%).w, boxes(i%).h Once again, mea culpa. I forgot to add the LCDPANEL option back in after nuking the flash. Edited 2025-12-31 22:11 by toml_12953 |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 131 |
Thank you so much for the new features from me! And thank you for the additional explanations in the manual regarding alignment and padding! It will surely help many people understand! I just tested something: Type TPerson phone As integer surname As string Length 8 name As string Length 7 padding As string Length 6 'alignment to uint64_t End Type Dim people(2) As TPerson people(1).phone = 1234 people(1).surname = "Marther" people(1).name = "Peter" people(2).phone = 5678 people(2).surname = "Graham" people(2).name = "Geoff" Dim i As integer Dim o As integer Print "SIZEOF(TPerson)="; Struct(SIZEOF, "TPerson") ' WORKS, TOO !!! :) ' A "workaround" to replace Struct(OFFSETOF, "type,member") o = Peek(VARADDR people(1).name) - Peek(VARADDR people(1)) Print "OFFSETOF(TPerson,name)="; O; " =0x"; Hex$(o) ' WORKS !!! :) Print "VARADDR(people(1))=0x"; Hex$(Peek(VARADDR people(1))) Print "VARADDR(people(2))=0x"; Hex$(Peek(VARADDR people(2))) ' WORKS, TOO !!! :) ' Could make Struct(SIZE, typeArray() [, dimension]) obsolete !!! Print Bound(people(),1) End Nevertheless, I would be very happy if you could add `Struct(OFFSETOF, "type,member")`! I'm almost certain that the information is already stored internally, since you need the offset when accessing the struct member. And as shown above: `Struct(SIZE, typeArray() [, dimension])` could be omitted, since `Bound(typeArray() [, dimension])` fortunately also works! I wish you, Peter, and also you, Geoff, and everyone else here a happy new year! Stay healthy and well! |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2715 |
wots records? sums my experience. it's not basic anymore |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
Records are mentioned in the MMBasic manual. SD Card Support section, Random Access Files. A Record is a string, which may contain several pieces of data packed into it. It is accessed by its "record number". I first used them in Disk BASIC on the Tandy Model 1 so they are definitely in BASIC. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2715 |
sorry I feel not worthy of mmbasic as I'm too dum.. to dim. thanks again matherp/peter. turtle graphics rings a bell for school kids in the '80's |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
Oh, don't bother about that. I doubt if I'll ever use a lot of it. The MATH stuff and regular expressions in particular mangle my brain cells. :) BBC BASIC supported Turtle graphics so you'll have probably seen mention of it in relation to that. One thing I always liked on the BBC was Mode 7 teletext graphics. I always liked the teletext pictures. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 131 |
Hey Stan, "RECORDS" are data that belong together — either stored on a storage medium (floppy disk, hard disk, USB stick) in a file system — or in RAM in variables. This doesn't initially have anything to do with the programming language. In Pascal, however, there's a data type called "RECORD" that can represent this well. In C, it's called a 'struct'(ure) — and in QBasic and Visual Basic, it's always been, and in MMBasic it will be in future 'Type...End Type'. Nothing special about it. As I've said several times already: Don't worry about it — everything will continue to work without "structs." You can use them in the future, but you don't have to. No reason to cry. Do you also cry when your car comes with a radio "for free", even though you don't need it? You can still drive even if the radio isn't on. Happy new year! |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2715 |
Do you also cry when your car comes with a radio "for free", even though you don't need it? You can still drive even if the radio isn't on. Happy new year! and I got a 12v car radio 4 speakers, and cd, usb and ssd slot which I used for domestic home sound but thought the display was small and how you drive a car pissin with the display and not crash. I use a a pc for watching films or music and 2 Wharfdale speakers . all films care of pirate proxy. I'm too old to care. make this simple code structured, it does run 'option autorun on OPTION BASE 0 ' 0 based arrays option DEFAULT INTEGER OPTION EXPLICIT mode 2 dim dx(15),dy(15),spx(15),spy(15) dim cannon(119),missile(15),oldspx(15),oldspy(15) dim ptr,hiscore,spw,spht,temp,frame,frame_count,spdata,sp1 hiscore=0 'colour shortcuts const WH =RGB(255, 255, 255) 'WHITE const YE =RGB(255, 255, 0) 'YELLOW const LI =RGB(255, 128, 255) 'LILAC const BR =RGB(255, 128, 0) 'BROWN const FU =RGB(255, 64, 255) 'FUCHSIA const RU =RGB(255, 64, 0) 'RUST const MA =RGB(255, 0, 255) 'MAGENTA const RE =RGB(255, 0, 0) 'RED const CY =RGB(0, 255, 255) 'CYAN const GR =RGB(0, 255, 0) 'GREEN const CE =RGB(0, 128, 255) 'CERULEAN const MI =RGB(0, 128, 0) 'MIDGREEN const CO =RGB(0, 64, 255) 'COBALT const MY =RGB(0, 64, 0) 'MYRTLE const BL =RGB(0, 0, 255) 'BLUE const Bk =RGB(0, 0, 0) 'BLACK const Gy =RGB(128, 128, 128) 'GREY const Lg =RGB(210, 210, 210) 'LITEGREY const Og =RGB(255, 165, 0) 'ORANGE const PK =RGB(255, 160, 171) 'PINK const Gd =RGB(255, 215, 0) 'GOLD const SA =RGB(250, 128, 114) 'SALMON const BE =RGB(245, 245, 220) 'BEIGE ' restore cls udg1 'draws sprite1 on screen at 10,10 blit READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1 udg1 'draws sprite2 on screen at 10,10 blit read 2,10,10,16,16 'reads sprite2 from screen to blit buffer2 cls blit read 3,10,10,16,16 'reads 16x16 background to blit buffer3 ' for temp=0 to 15 'set up start sprite positions and directions do dx(temp)=(int(rnd*4)+1)-(int(rnd*8)+1) loop until dx(temp)<>0 do dy(temp)=(int(rnd*4)+1)-(int(rnd*8)+1) loop until dy(temp)<>0 spx(temp)=104+((rnd*64)+1) spy(temp)=144+((rnd*64)+1) next temp ' FRAMEBUFFER CREATE F FRAMEBUFFER WRITE f do 'demo moving sprite cls for temp=0 to 15 ' if sprite_status(temp)=1 then 'is sprite active if spx(temp)> 300 then 'check right edge dx(temp)= 0-dx(temp) elseif spx(temp)<8 then 'check left edge dx(temp)= 0-dx(temp) end if if spy(temp)>220 then 'check bottom edge dy(temp)= 0-dy(temp) elseif spy(temp)<8 then 'check top edge dy(temp)= 0-dy(temp) end if ' 'oldspx(temp)=spx(temp):oldspy(temp)=spy(temp) 'get last position for erase spx(temp)=spx(temp)+dx(temp):spy(temp)=spy(temp)+dy(temp) 'get new position for draw ' if frame=0 then'which sprite to draw 'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position blit WRITE 1,spx(temp),spy(temp) 'draw sprite1 at new position else 'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position blit WRITE 2,spx(temp),spy(temp) 'draw sprite2 at new position end if next temp ' FRAMEBUFFER COPY f,N frame_count=frame_count+1 'when to change sprite if frame_count=10 then frame=not frame frame_count=0 end if pause 20 loop ' sub udg1 'draws 16x16 data for blit to copy for spht=0 to 15 for spw=0 to 15 read sp1 pixel spw+10,spht+10,sp1 next spw next spht end sub ' 'sprite1 data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk 'sprite2 data bl,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,bl data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bl,wh,wh,re,bl,bk,bk,bl,re,wh,wh,bl,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,ye,ye,bk,bk,ye,ye,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk data bk,bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk data bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk data bk,bk,bk,bk,bk,ye,bk,bk,bk,bk,ye,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,ye,bk,bk,ye,bk,bk,bk,bk,bk,bk |
||||
| bfwolf Senior Member Joined: 03/01/2025 Location: GermanyPosts: 131 |
That was simply a hypothetical example of how something can have features you don't necessarily need, but which can be useful if you have a particular desire for them. If you don't need them, they don't (necessarily) hurt either. I didn't mean to imply that you don't enjoy listening to music in your car, and even with a good sound system. For example, I dread the day when all cars have keyless entry because it's easy for thieves to hack, and therefore many cars with keyless entry are stolen. That's one reason why I'm still driving my almost 20-year-old Fiat Panda... "Primitive technology, but it works." Another reason: There still isn't a truly cheap small electric car. I don't see what there is to criticize about this program. It's already "structured programming" because it doesn't use a "GOTO" command, but instead uses "IF... THEN... ELSE... ENDIF" and "FOR... NEXT" loops. I've already tried to explain that "structured programming" has nothing to do with "data structures", or at least doesn't require the use of "data structures". If the programming language supports "data structures", it "makes life easier" — that's what I mean. In that sense: You're welcome to continue programming everything the way you have been! Greetings! ![]() Addendum: I don't know if the comedy "Dinner for One" is as popular in the UK as it is in Germany? I once heard from a colleague in the UK that it's "rather unknown" there, even though it was made by well-known British comedians. Anyway, at the end of the party for her deceased friends, the 90-year-old "Miss Sophie" says to her butler (who had to represent all her friends and drink for them): "I think I'll retire now..." - that's what I'll do now too.. ![]() Edited 2026-01-01 10:12 by bfwolf |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6426 |
"STRUCT EXTRACT" works well and makes the code simpler and more readable. There was a very slight performance drop but well worth it. Testing on RP2040 Jim VK7JH MMedit |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10826 |
V6.01.00EXP5 PicoMiteRP2040V6.01.00EXP5.zip PicoMiteRP2350V6.01.00EXP5.zip MMBasic_Structures_Manual.pdf StructTest.zip Removes STRUCT(SIZE as BOUND works Adds STRUCT(OFFSET In addition changes the syntax of all struct functions to match other MMbasic functions so: STRUCT(SUBFUNCTION parameters) NOT STRUCT(SUBFUNCTION,parameters) See manual for details Assuming no further bugs reported or sensible and generally useful enhancements requested this will be the last experimental version before 6.02.00RC0 Note: one user is reporting issues with XMODEM, can anyone confirm any problems? I can't replicate. Edited 2026-01-01 18:55 by matherp |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
@bfwolf Yay!!! I *love* "Dinner for One" and have seen it many times. :) No, it's not as popular here as it is in Germany where, I believe, it's close to being required viewing every year! Happy New Year everyone. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6426 |
I don't see any problems with XMODEM or YMODEM. I have been testing YMODEM on MMCC and have done a lot of testing. Jim VK7JH MMedit |
||||
| karlelch Guru Joined: 30/10/2014 Location: GermanyPosts: 310 |
I had reported a XMODEM problem but it had turned out to be some nuking/exchanging firmware effect. In any case, after clearing everything and using the latest experimental version, XMODEM worked. Happy New Year! Best Thomas |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5599 |
Peter, Unless I am mistaken the RP2040 non VGA, non USB version is missing from the ZIP (and the WEBMITE 2350 is double). Volhout PicomiteVGA PETSCII ROBOTS |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |