Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:51 02 May 2025 Privacy Policy
Jump to

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.

Forum Index : Microcontroller and PC projects : PicoMiteVGA DEMO

     Page 7 of 8    
Author Message
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1636
Posted: 01:23am 14 Dec 2024
Copy link to clipboard 
Print this post

@ Stan,
You have found Tassy Jim's MMBasic help file. Here is the document referred to:
The CMM2 3D engine.zip please refer to that before asking any questions.

Bill
Keep safe. Live long and prosper.
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 04:14pm 24 Dec 2024
Copy link to clipboard 
Print this post

Xmas Tree

MODE 2
FRAMEBUFFER CREATE
FRAMEBUFFER WRITE F
S=320
Do
CLS :t=t+1
For i=155 To 165
 Line 160,40,i,230,,RGB(brown)
Next i
For i=0 To 900 Step 2
 Pixel i*5+Sin(i)*20,(t+i*40)Mod 136
 a=Pi*2/60*(i+t/3)
 z=Cos(a)*i/10+550
 x=Sin(a)*i/6*S/z+160
 y=(i/3-150)*S/z+120
 C=Rnd*&HFFFFFF
 Circle 160,26,3,,,,C
 If z<550 Then
   Circle x,y,1+i/300,,,C,C
 Else
   Pixel x,y,C
 EndIf
Next i
FRAMEBUFFER COPY F,N,B
Loop
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 04:34pm 27 Dec 2024
Copy link to clipboard 
Print this post

Merry Christmas & Happy New Year!

MODE 2
FRAMEBUFFER create
FRAMEBUFFER write f
T$="Merry Christmas & Happy New Year!"
x=700:h=160
Do
CLS
If x<-350 Then x=700
Text x,5*Sin(x)+10,T$,C,5
C=Rnd*&HFFFFFF:x=x-1
Text x,5*Sin(x)+10,T$,C,5,,C
C=RGB(BROWN)
Box 140,220,40,20,1,C,C
C=RGB(GREEN)
For i=10 To 110 Step 5
 Triangle h,i,h-i,i+i,h+i,i+i,C,C
Next i
For i=4 To 43 Step .1
 p=i+Timer\100
 If Cos(p)<0 Then
   C=Rnd*&HFFFFFF
   Circle h+2.5*i*Sin(p),i*5,2,,,C,C
 EndIf
Next i
For i=0 To h
 Pixel i+i,Rnd*240
Next i
FRAMEBUFFER copy F,N,B
Loop
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 09:28pm 28 Dec 2024
Copy link to clipboard 
Print this post

Christmas Tree
https://github.com/anvaka/atree

MODE 2
FRAMEBUFFER CREATE
FRAMEBUFFER WRITE F
max = 19
xScale = 6
zScale = 2.5
yScale = 11.5
dz = 640
phase=0
Dim redSpiral(2)=(RGB(Red),RGB(Myrtle),1)
Dim cyanSpiral(2)=(RGB(Cyan),RGB(Myrtle),0)

Do
CLS
For i= -startFrom To max Step 0.08
 If (i<0) Or (i>max) Then Continue For
 createSpiral(redSpiral())
 createSpiral(cyanSpiral())
Next
Inc phase,0.1: If phase>6.28 then phase=0
FRAMEBUFFER COPY F,N,B
Loop

Sub createSpiral(config())
sign = Choice(config(2),-1,1)
If config(2) Then
 foreground = config(0)
 background = config(1)
Else
 foreground = config(1)
 background = config(0)
EndIf
zoff = i*Sin(i+phase)
z = dz/(dz-sign*zoff*zScale)
x = sign*i*Cos(i+phase)*z*xScale+160
y = i*z*yScale+2
If zoff+sign*Pi/4 < 0 Then
 Colour (foreground)
Else
 Colour (background)
EndIf
Pixel x,y
End Sub

Edited 2024-12-29 19:01 by javavi
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 08:45pm 16 Jan 2025
Copy link to clipboard 
Print this post

Lissaju 2   PicoMiteVGA/HDMI MMBasic V6.00.02


MODE 1
Option ANGLE DEGREES
FRAMEBUFFER CREATE
FRAMEBUFFER LAYER
RX=MM.HRes:RY=MM.VRes:CX=RX\2:CY=RY\2
Scale=0.95: AX=CY*Scale: AY=CY*Scale
a=1: b=0: p=0: f=0: c=0

CLS RGB(BLUE)
RBox 0,0,RX,RY
For y=80 To RY Step 80
For x= 8 To RX Step  8
Pixel x,y
Next x:Next y
For x=80 To RX Step 80
For y= 8 To RY Step  8
Pixel x,y
Next y:Next x

For y=0 To RY Step 8
Line CX+1,y,CX-1,y
If Not (y Mod 40) Then Line CX+2,y,CX-2,y
If Not (y Mod 80) Then Line CX+3,y,CX-3,y
Next y
For x=0 To RX Step 8
Line x,CY+1,x,CY-1
If Not (x Mod 40) Then Line x,CY+2,x,CY-2
If Not (x Mod 80) Then Line x,CY+3,x,CY-3
Next x

Triangle CX,0,CX-3,8,CX+3,8,,1
Triangle RX,CY,RX-8,CY-3,RX-8,CY+3,,1
Print @(CX-14,3) "Y"
Print @(RX-12,CY-16) "X"

FRAMEBUFFER WRITE F
Do
 If p>360 Then p=0: EndIf
 If b>6   Then a=a+1: b=0: c=0: EndIf
 If a>5   Then a=1:   b=0: c=0: EndIf
 If c=50  Then
   f=1
   If a=Fix(b) Then f=0: c=0: EndIf
 EndIf
 If c=130 Then f=0: c=0: EndIf

 CLS 0 : Colour RGB(WHITE),RGB(BLUE)
 Print : Print " A="a: Print " B="b: Print " P="p

     sx= AX * Sin(p) + CX
     sy= AY * Sin(p) + CY

 For i= 0 To 360
     x = AX * Sin(a*i + p) + CX
     y = AY * Sin(b*i + p) + CY
     Line sx,sy,x,y
     sx=x: sy=y
 Next i

 FRAMEBUFFER COPY F,L,B

 Inc p: Inc c
 If  f=0 Then b=b+.02

Loop Until Asc(Inkey$)
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 05:26pm 17 Jan 2025
Copy link to clipboard 
Print this post

I get a graticule and scrolling values in terminal but no Lissaju
stan
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10000
Posted: 05:41pm 17 Jan 2025
Copy link to clipboard 
Print this post

  Quote  I get a graticule and scrolling values in terminal but no Lissaju


You need to be running 6.00.02b0 and if running on a VGA version the CPU speed muust be >=252000
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 05:58pm 17 Jan 2025
Copy link to clipboard 
Print this post

@matherp sir. is vga also hdmi. the layers like FRAMEBUFFER COPY F,L,B seem different and FRAMEBUFFER CREATE
FRAMEBUFFER LAYER.
I got vga and hdmi to test. it's in the manual?
amazing the improvements to mmb especially pico 2. best wishes, stan
I'll load te beta
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 06:38pm 17 Jan 2025
Copy link to clipboard 
Print this post

loaded the beta and got Lissajous. interesting code and nice vga demo.
nice one @javavi  
thanks @matherp sir

> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.02b0
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD UK, 0, 0, 600, 150
OPTION CPUSPEED (KHz) 315000
OPTION SDCARD GP22, GP6, GP7, GP4
OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0

works nice in mode 2 but not mode 3, not enough heap mem
really is a nice program... we should all know trig
Edited 2025-01-18 04:55 by stanleyella
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 07:01pm 17 Jan 2025
Copy link to clipboard 
Print this post

my efforts with Lissajous was a sine on audio left right but delay one so out of phase then put sound int 2 a-d channels but back shelf
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 07:47pm 08 Feb 2025
Copy link to clipboard 
Print this post

Punched tape chart recorder


Option ANGLE DEGREES
c0=RGB(rust):c1=RGB(green):c2=RGB(white):c3=RGB(blue)
CX=MM.HRes\2

MODE 2: CLS
FRAMEBUFFER LAYER
Text 160,200,"- PicoMite -","CM",1,3,RGB(myrtle)
FRAMEBUFFER WRITE L

Do
Blit 0,0,0,1,MM.HRes,MM.VRes-1
Line 0,0,MM.HRes,0,,0

If t=0  Then For i=10 To MM.HRes-10 Step 2:Pixel i,1,c0:Next
Inc t: If t>20 Then t=0
If t0=0 Then For i=10 To MM.HRes-10 Step 20:Pixel i,1,c0:Next
Inc t0: If t0>2 Then t0=0
If t1=0 Then Line 0,2,6,2,4,c0:Line MM.HRes-6,2,MM.HRes,2,4,c0
Inc t1: If t1>10 Then t1=0

Pixel 140*Sin(d1)+CX,0,c1
d1=d1+1: If d1>360 Then d1=0

Pixel 100*Cos(d2+p2)+CX,0,c2
Pixel  20*Sin(d3)+CX,0,c3
d2=d2+3: If d2>360 Then d2=0: Inc p2,5
d3=d3+10: If d3>360 Then d3=0

Pause 10
Loop While Inkey$=""
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 10:39pm 08 Feb 2025
Copy link to clipboard 
Print this post

only half waveform
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1192
Posted: 05:44pm 09 Feb 2025
Copy link to clipboard 
Print this post

I found a beauty small C64 program on Facebook  and translated it to MMBASIC.
Mode 2
for i=1 to 8000
S=-log(.1+RND)
t=s*200:U=S*20*SIN(t):V=S*25*COS(t):P=S*3
C=COS(P):S=SIN(P)
X=U*C+V*S:Y=-U*S+V*C:R=X*X+Y*Y*Y
Z=40*EXP(-R/1000)*(RND-.5)
X=X*1.4+y*.6:Y=x*.2+y*.8
if ABS(x)<127 AND abs(Y)<=87 THEN PIXEL 160+x,120+y
NEXT



'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4815
Posted: 07:24am 10 Feb 2025
Copy link to clipboard 
Print this post

  javavi said  Punched tape chart recorder


Option ANGLE DEGREES
c0=RGB(rust):c1=RGB(green):c2=RGB(white):c3=RGB(blue)
CX=MM.HRes\2

MODE 2: CLS
FRAMEBUFFER LAYER
Text 160,200,"- PicoMite -","CM",1,3,RGB(myrtle)
FRAMEBUFFER WRITE L

Do
Blit 0,0,0,1,MM.HRes,MM.VRes-1
Line 0,0,MM.HRes,0,,0

If t=0  Then For i=10 To MM.HRes-10 Step 2:Pixel i,1,c0:Next
Inc t: If t>20 Then t=0
If t0=0 Then For i=10 To MM.HRes-10 Step 20:Pixel i,1,c0:Next
Inc t0: If t0>2 Then t0=0
If t1=0 Then Line 0,2,6,2,4,c0:Line MM.HRes-6,2,MM.HRes,2,4,c0
Inc t1: If t1>10 Then t1=0

Pixel 140*Sin(d1)+CX,0,c1
d1=d1+1: If d1>360 Then d1=0

Pixel 100*Cos(d2+p2)+CX,0,c2
Pixel  20*Sin(d3)+CX,0,c3
d2=d2+3: If d2>360 Then d2=0: Inc p2,5
d3=d3+10: If d3>360 Then d3=0

Pause 10
Loop While Inkey$=""


Maybe you should first choose the mode, and then after that decide what CX should be set to, since MM.Hres is different when in mode 1.
PicomiteVGA PETSCII ROBOTS
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 05:19pm 10 Feb 2025
Copy link to clipboard 
Print this post

  Volhout said  Maybe you should first choose the mode, and then after that decide what CX should be set to, since MM.Hres is different when in mode 1.

Yes, that's right.  
MODE 2: CLS
Option ANGLE DEGREES
c0=RGB(rust):c1=RGB(green):c2=RGB(white):c3=RGB(blue)
CX=MM.HRes\2

FRAMEBUFFER LAYER
Text 160,200,"- PicoMite -","CM",1,3,RGB(myrtle)
FRAMEBUFFER WRITE L

Do
Blit 0,0,0,1,MM.HRes,MM.VRes-1
Line 0,0,MM.HRes,0,,0

If t=0  Then For i=10 To MM.HRes-10 Step 2:Pixel i,1,c0:Next
Inc t: If t>20 Then t=0
If t0=0 Then For i=10 To MM.HRes-10 Step 20:Pixel i,1,c0:Next
Inc t0: If t0>2 Then t0=0
If t1=0 Then Line 0,2,6,2,4,c0:Line MM.HRes-6,2,MM.HRes,2,4,c0
Inc t1: If t1>10 Then t1=0

Pixel 140*Sin(d1)+CX,0,c1
d1=d1+1: If d1>360 Then d1=0

Pixel 100*Cos(d2+p2)+CX,0,c2
Pixel  20*Sin(d3)+CX,0,c3
d2=d2+3:  If d2>360 Then d2=0: Inc p2,5
d3=d3+10: If d3>360 Then d3=0
Pause 10
Loop While Inkey$=""
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 06:57pm 17 Feb 2025
Copy link to clipboard 
Print this post

Punched tape recorder with instrument scale

Option ANGLE DEGREES
Option DEFAULT INTEGER
MODE 2: CLS
c0=RGB(myrtle):c1=RGB(green):c2=RGB(white):c3=RGB(cyan)
c4=RGB(yellow):c5=RGB(midgreen)
CX=MM.HRes\2:Am=150:St=1:Clr=RGB(white)

FRAMEBUFFER LAYER
Box 0,0,MM.HRes,20,,c4:Box 0,22,MM.HRes,MM.VRes,,c5
For i=10 To MM.HRes-10 Step 5: Line i,8,i,12,,c4:Next
For i=10 To MM.HRes-10 Step 10:Line i,6,i,14,,c4:Next
FRAMEBUFFER WRITE L

Do
Blit 0,10,0,11,MM.HRes,MM.VRes-11
Line 0,0,MM.HRes,0,12,0

If t=0  Then For i=10 To MM.HRes-10 Step 2:Pixel i,16,c0:Next
Inc t: If t>20 Then t=0
If t0=0 Then For i=10 To MM.HRes-10 Step 20:Pixel i,16,c0:Next
Inc t0: If t0>2 Then t0=0
If t1=0 Then Line 3,21,8,21,4,c0:Line MM.HRes-8,21,MM.HRes-4,21,4,c0
Inc t1: If t1>10 Then t1=0

X0=Am*Sin(d1)+CX
Triangle X0,10,X0-4,1,X0+4,1,c3,c2
Line X0,12,X1,13,,Clr
X1=X0
d1=d1+St
If d1>360 Then d1=0:Am=150*Rnd:St=10*Rnd+1:Clr=&HFFFFFF*Rnd

Pause 10
Loop While Inkey$=""

Edited 2025-02-18 04:59 by javavi
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 09:39am 16 Mar 2025
Copy link to clipboard 
Print this post

Square Art   black and white, but also in color  

Do
 M=Int(2*Rnd)
 If M Then MODE 1 Else MODE 2
 XR=MM.HRES
 YR=MM.VRES
 For I=0 To 1000
   X=Int(XR*Rnd)
   Y=Int(YR*Rnd)
   W=Int(100*Rnd+4)
   H=Int(100*Rnd+4)
   C=Int(&HFFFF00*Rnd+255)
   F=Int(2*Rnd)
   If F Then Box X,Y,W,H,,C Else Box X,Y,W,H,,C,F
   Box X+1,Y+1,W-2,H-2,,0
   Box X-1,Y-1,W+2,H+2,,0
 Next
 Pause 2000
Loop
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4815
Posted: 11:06am 17 Mar 2025
Copy link to clipboard 
Print this post

Hi Vadim,

I thought this would be a boring one, but it turns out as one of the more interesting demo's. Especially the switching between mode 1 and mode 2 makes it interesting.
Tested on v6.00.02rc5 on RP2040 VGA.

Volhout
PicomiteVGA PETSCII ROBOTS
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 06:35pm 23 Mar 2025
Copy link to clipboard 
Print this post

  Martin H. said  I found a beauty small C64 program on Facebook  and translated it to MMBASIC.

Galactica B/W & Colour

Dim CM(6)=(0,8,10,12,14,13,15)
Colour Map CM(),CM()
Do
If Cint(Rnd) Then MODE 1 Else MODE 2
XC=MM.HRES\2:YC=MM.VRES\2
r1=200:r2=250
t1=200:t2=3
For N=1 To 5
 For I=0 To 10000
   L=-Log(Rnd)
   T=L*t1
   U=L*r1*Sin(T)
   V=L*r2*Cos(T)
   P=L*t2
   c=Cos(P)
   s=Sin(P)
   X=U*c+V*s
   Y=-U*s+V*c
   R=X*X+Y*Y
   Z=400*Exp(-R/100000)
   Z=Z*(Rnd -.5)
   Y=Y+Z+Rnd*50
   X=X-Z+Rnd*50
   xp=XC+X*.21+Y*.09
   yp=YC-X*.03-Y*.12
   If Pixel(xp,yp) Then
     Pixel xp,yp,CM(N+1)
   Else
     Pixel xp,yp,CM(N)
   EndIf
 Next
Next
Loop
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 11:58am 02 Apr 2025
Copy link to clipboard 
Print this post

Vertical Scrolling Clock

Const Mode.N=2
Const Font.N=1
Const T.Scale=4
Const T.Size=Len(Time$)
MODE  Mode.N
Const X.Res=MM.HRES,Y.Res=MM.VRES
Font  Font.N
Const X.FSize=MM.Info(FONTWIDTH)
Const Y.FSize=MM.Info(FONTHEIGHT)
Const X.Offset=X.FSize*T.Scale*T.Size\2
Const Y.Offset=Y.FSize*T.Scale\2
Dim integer X.Dir=1,Y.Dir=1
Dim integer X.Pos=MM.HRES\2,Y.Pos=MM.VRES\2
Dim Clr(15)=(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
Colour Map Clr(),Clr()

FRAMEBUFFER LAYER 0
FRAMEBUFFER WRITE L
Font 9
Print @(0,0);
For n=1 To (X.Res\8)*(Y.Res\8)
 Print Chr$(32+Int(Rnd*3));
Next

Do
Blit READ  1, 0,0,MM.HRES,1
Blit 0,1,0,0,MM.HRES,MM.VRES-1
Blit Write 1, 0,MM.VRES-1
Blit Close 1
Pause 20
FRAMEBUFFER WRITE N
If C=0 Then C=Int(Rnd*15)+1
Text X.Pos,Y.Pos,Time$,"CM",Font.N,T.Scale,Clr(C)
Inc X.Pos,X.Dir:Inc Y.Pos,Y.Dir
If X.Pos-X.Offset<0 Then X.Dir=1
If X.Pos+X.Offset>MM.HRES Then X.Dir=-1
If Y.Pos-Y.Offset<0 Then Y.Dir=1:C=0
If Y.Pos+Y.Offset>MM.VRES Then Y.Dir=-1:C=0
FRAMEBUFFER WRITE L
Loop While Inkey$=""

DefineFont 9
04200808
80402010 08040201
01020408 10204080
08080808 08080808
End DefineFont
 
     Page 7 of 8    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025