Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
For a=0 To 65 For g=0 To 65 If a<18 And g<18 Then n(g)=RGB(0,255,0) Else n(g)=RGB(a*3.93,g*3.93,128*(a+g<65)) EndIf Next 'g Memory pack nn,Peek(varaddr m(0,a)),66,32 Next 'a
Do CLS Inc t,0.035:g=0:Print Timer:Timer=0 For i=60 To 255 Step 3 pf(0)=i:pf(1)=r*i+t bubblerow c(),d(),pf(),ct ' recurrence + scale + offset -> c(),d() Memory unpack Peek(varaddr m(0,g)),nn,66,32 Pixel c(),d(),n() Inc g Next 'i FRAMEBUFFER copy f,n Loop
This was an experiment in asking Claude to optimise the bubble universe program. It's first attempt in Basic was to create a sine/cos lookup table which slowed the program down. It then suggested a CSUB so I coached it through how to write one, how to make it RP2040/RP2350 agnostic and how to deal with floating point numbers. I did this by getting it to slowly go through a number of simple examples, squaring an integer, then squaring a float. We then moved on to optimising the bubble universe. On a HDMI build at 378MHz the frame rate increases from 5.1 to 42.4FPS. The next step is to improve the whole csub architecture to make writing them a bit easier. There will be a python script to generate a csub direct from the c source.
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1761
Posted: 12:10pm 20 Jun 2026
Copy link to clipboard
Print this post
[29] Memory pack nn,Peek(varaddr m(0,a)),66,32 Error : Address not divisible by 8causality ≠ correlation ≠ coincidence
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11516
Posted: 12:20pm 20 Jun 2026
Copy link to clipboard
Print this post
Works for me, hdmi and tft - you don't say what firmware and version you are running on
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1761
Posted: 12:22pm 20 Jun 2026
Copy link to clipboard
Print this post
..."you don't say what firmware and version you are running on"
PicoMiteHDMI MMBasic USB RP2350A Edition V6.03.00RC12
causality ≠ correlation ≠ coincidence
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1961
Posted: 12:29pm 20 Jun 2026
Copy link to clipboard
Print this post
Love seeing such a performance boost....only problem is...no one around me gets excited
dddns Guru Joined: 20/09/2024 Location: GermanyPosts: 843
Posted: 12:52pm 20 Jun 2026
Copy link to clipboard
Print this post
I never (knowingly) used AI up to now. Teaching AI is one thing, I surely couldn't do that with CSUB. Would one benefit from your teaching and simply say, write an CSUB for some issue If he signs to Claude today?
I am but I think its hard to express if you don't understand :))
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11516
Posted: 01:10pm 20 Jun 2026
Copy link to clipboard
Print this post
Try RC21
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1761
Posted: 01:23pm 20 Jun 2026
Copy link to clipboard
Print this post
Will do! I commented out the memory pack/unpack code and am getting a displayed value of approximately 26.45 (at 315MHz); I just don't know if the output was affected.
With the Tracecache enabled, a cycle takes 25.7 ms (= 38.9 at 315 MHz). Edited 2026-06-20 23:35 by twofingerscausality ≠ correlation ≠ coincidence
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1961
Posted: 01:26pm 20 Jun 2026
Copy link to clipboard
Print this post
I am but I think its hard to express if you don't understand :))
A couple of guys came by and asked what I'm doing...wire-wrapping a prototype board and of course I had to demonstrate...they couldn't get away fast enough
Probably gone to watch grown men chase a ball around a field.
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1961
Posted: 01:41pm 20 Jun 2026
Copy link to clipboard
Print this post
duplicate Edited 2026-06-21 00:01 by PhenixRising
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11516
Posted: 02:04pm 20 Jun 2026
Copy link to clipboard
Print this post
I commented out the memory pack/unpack code and am getting a displayed value of approximately 26.45 (at 315MHz); I just don't know if the output was affected.
Yes, it will be. I've just looked at the code again and that error isn't possible both addresses have to be divisible by 8.
Replace the loop with this:
For a=0 To 65 For g=0 To 65 If a<18 And g<18 Then n(g)=RGB(0,255,0) Else n(g)=RGB(a*3.93,g*3.93,128*(a+g<65)) EndIf Next 'g x%=Peek(varaddr m(0,a)):print x%,nn Memory pack nn,x%,66,32 Next 'a
What do you get?
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1761
Posted: 02:12pm 20 Jun 2026
Copy link to clipboard
Print this post
Hi Peter, Unfortunately, I’m still getting the same error (RC12). However, the memory pack seems unnecessary to me.
By the way, it would be helpful if you could post the C source code from time to time. Thanks! Michael