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.
Posted: 12:10pm 20 Jun 2026 Copy link to clipboard
twofingers Guru
[29] Memory pack nn,Peek(varaddr m(0,a)),66,32 Error : Address not divisible by 8
Posted: 12:20pm 20 Jun 2026 Copy link to clipboard
matherp Guru
Works for me, hdmi and tft - you don't say what firmware and version you are running on
Posted: 12:22pm 20 Jun 2026 Copy link to clipboard
twofingers Guru
..."you don't say what firmware and version you are running on"
PicoMiteHDMI MMBasic USB RP2350A Edition V6.03.00RC12
Posted: 12:29pm 20 Jun 2026 Copy link to clipboard
PhenixRising Guru
Love seeing such a performance boost....only problem is...no one around me gets excited
Posted: 12:52pm 20 Jun 2026 Copy link to clipboard
dddns Guru
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 :))
Posted: 01:10pm 20 Jun 2026 Copy link to clipboard
matherp Guru
Try RC21
Posted: 01:23pm 20 Jun 2026 Copy link to clipboard
twofingers Guru
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 twofingers
Posted: 01:26pm 20 Jun 2026 Copy link to clipboard
PhenixRising Guru
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.
Posted: 01:41pm 20 Jun 2026 Copy link to clipboard
PhenixRising Guru
duplicate Edited 2026-06-21 00:01 by PhenixRising
Posted: 02:04pm 20 Jun 2026 Copy link to clipboard
matherp Guru
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?
Posted: 02:12pm 20 Jun 2026 Copy link to clipboard
twofingers Guru
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