Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 16:03 23 Apr 2024 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 : PicoMite/PicoMiteVGA V5.07.05 betas

     Page 1 of 11    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 03:55pm 22 May 2022
Copy link to clipboard 
Print this post

V5.07.05b1

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Fixes bug in PIO READ
Allows a single integer variable to be used when nbr=1 in PIO READ
Implements DRAW3D command and function (VGA version only)
Implements FRAMEBUFFER command (VGA version only)

See this thread and related doc for details of the 3D capabilities. The implementation is identical to the CMM2 Another demo

The Framebuffer command allow you to allocate some of the variable memory to either a framebuffer, a second display layer, or both and then use these in interesting ways to both avoid tearing artefacts and/or play graphics objects over the background display.

Commands:

FRAMEBUFFER CREATE 'allocates 38400 bytes to a framebuffer

FRAMEBUFFER LAYER 'allocates 38400 bytes to a second display layer. This layer sits on top of the main display. Any pixel set in this layer to something other than black will display on top of the main display. Pixels in this layer are fully opaque
NB: This command is only available when the CPU speed is set to 252MHz (OPTION CPUSPEED 252000)

FRAMEBUFFER WRITE fb' selects the buffer which all subsequent graphics commands will write to. Valid values for fb are:
N - the main display (N for Normal)
F - the framebuffer
L - the layer buffer

In the event that a framebuffer or a layer hasn't been created the command will be ignored and commands will continue to write to the main display

FRAMEBUFFER COPY s, d [,b]
Copies one framebuffer to another
Valid values for a and d are:
N - the main display
F - the framebuffer
L - the layer buffer
In the event that a framebuffer or a layer hasn't been created the command will be ignored.
The optional parameter B tells the copy to wait for the next frame blanking before starting the copy. If this is specified the copy will compete in frame blanking and no display artefacts will be seeen.

FRAMEBUFFER CLOSE [fb]
Closes one or more framebuffers and frees up the memory.
Valid values for fb are:
F - the framebuffer
L - the layer buffer
If fb is not specified both the framebuffer and layer buffer are closed. In the event that a framebuffer or a layer hasn't been created the command will be ignored.

FRAMEBUFFER WAIT
Pauses processing until the start of the next frame blanking period

If you Ctrl-C out of a program while the FRAMEBUFFER WRITE is set to the FRAMEBUFFER then you will need to execute FRAMEBUFFER CLOSE to get you cursor back.

Example program using layer and framebuffer

MODE 2
'clear the main screen and create a grid
CLS
For i=0 To MM.HRes-1 Step 10
Line i,0,i,MM.VRes-1
Next
For i=0 To MM.VRes-1 Step 10
Line 0,i,MM.HRes-1,i
Next

'Create a framebuffer and a layer buffer
'set graphics commands to write to the framebuffer
FRAMEBUFFER create
FRAMEBUFFER layer
FRAMEBUFFER write f

'create a moving sine wave in the framebuffer
' then copy the framebuffer to the layer buffer in frame blanking
' so it appears on top of the grid
j=0
Do
y=Sin(Rad(0+j))*MM.VRes\3+MM.VRes\2
For i=1 To MM.HRes-1
  yp=Sin(Rad(i+j))*MM.VRes\3+MM.VRes\2
  Line i,y,i,yp,1,RGB(green)
  y=yp
Next
Inc j
FRAMEBUFFER copy f,l,b
CLS
Loop


3D demo

Option explicit
Option default none
MODE 2
Dim float phi=(1+Sqr(5))/2
' data for location of vertices for truncated icosahedron of edge length 2
Data 0,1,3*phi
Data 0,1,-3*phi
Data 0,-1,3*phi
Data 0,-1,-3*phi
Data 1,3*phi,0
Data 1,-3*phi,0
Data -1,3*phi,0
Data -1,-3*phi,0
Data 3*phi,0,1
Data 3*phi,0,-1
Data -3*phi,0,1
Data -3*phi,0,-1
Data 2,(1+2*phi),phi
Data 2,(1+2*phi),-phi
Data 2,-(1+2*phi),phi
Data 2,-(1+2*phi),-phi
Data -2,(1+2*phi),phi
Data -2,(1+2*phi),-phi
Data -2,-(1+2*phi),phi
Data -2,-(1+2*phi),-phi
Data (1+2*phi),phi,2
Data (1+2*phi),phi,-2
Data (1+2*phi),-phi,2
Data (1+2*phi),-phi,-2
Data -(1+2*phi),phi,2
Data -(1+2*phi),phi,-2
Data -(1+2*phi),-phi,2
Data -(1+2*phi),-phi,-2
Data phi,2,(1+2*phi)
Data phi,2,-(1+2*phi)
Data phi,-2,(1+2*phi)
Data phi,-2,-(1+2*phi)
Data -phi,2,(1+2*phi)
Data -phi,2,-(1+2*phi)
Data -phi,-2,(1+2*phi)
Data -phi,-2,-(1+2*phi)
Data 1,(2+phi),2*phi
Data 1,(2+phi),-2*phi
Data 1,-(2+phi),2*phi
Data 1,-(2+phi),-2*phi
Data -1,(2+phi),2*phi
Data -1,(2+phi),-2*phi
Data -1,-(2+phi),2*phi
Data -1,-(2+phi),-2*phi
Data (2+phi),2*phi,1
Data (2+phi),2*phi,-1
Data (2+phi),-2*phi,1
Data (2+phi),-2*phi,-1
Data -(2+phi),2*phi,1
Data -(2+phi),2*phi,-1
Data -(2+phi),-2*phi,1
Data -(2+phi),-2*phi,-1
Data 2*phi,1,(2+phi)
Data 2*phi,1,-(2+phi)
Data 2*phi,-1,(2+phi)
Data 2*phi,-1,-(2+phi)
Data -2*phi,1,(2+phi)
Data -2*phi,1,-(2+phi)
Data -2*phi,-1,(2+phi)
Data -2*phi,-1,-(2+phi)
' 12 faces with 5 sides
Data 0,28,36,40,32
Data 33,41,37,29,1
Data 34,42,38,30,2
Data 3,31,39,43,35
Data 4,12,44,45,13
Data 15,47,46,14,5
Data 17,49,48,16,6
Data 7,18,50,51,19
Data 8,20,52,54,22
Data 23,55,53,21,9
Data 26,58,56,24,10
Data 25,57,59,27,11
' 20 faces with 6 sides
Data 32,56,58,34,2,0
Data 0,2,30,54,52,28
Data 29,53,55,31,3,1
Data 1,3,35,59,57,33
Data 13,37,41,17,6,4
Data 4,6,16,40,36,12
Data 5,7,19,43,39,15
'data 14,38,42,18,7,5
Data 22,46,47,23,9,8
Data 8,9,21,45,44,20
Data 10,11,27,51,50,26
Data 24,48,49,25,11,10
Data 36,28,52,20,44,12
Data 13,45,21,53,29,37
Data 14,46,22,54,30,38
Data 39,31,55,23,47,15
Data 16,48,24,56,32,40
Data 41,33,57,25,49,17
Data 42,34,58,26,50,18
Data 19,51,27,59,35,43
'
Dim float q1(4)
Dim float yaw=Rad(1),pitch=Rad(2),roll=Rad(0.5)
Dim integer i, j, nf=31, nv=60, camera=1
Dim float vertices(2,59)
' read in the coordinates of the verticies and scale
For j=0 To 59
For i=0 To 2
 Read vertices(i,j)
 vertices(i,j)=vertices(i,j)*20
Next i
Next j
'math scale vertices(),50,vertices()
'
Dim integer faces(173)
For i=0 To 173
Read faces(i)
Next i

Dim integer fc(30)=  (5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6)
Dim integer colours(2)=(RGB(red),RGB(white),RGB(black))
Dim integer edge(30)=(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
Dim integer fill(30)=(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
Math q_create Rad(2),1,0.5,0.25,q1()
Draw3D create 1, nv,nf, camera, vertices(), fc(), faces(), colours(), edge(),fill()
Draw3D camera 1,800,0,0
'draw3d diagnose 1,mm.hres\2,mm.vres\2,1000
FRAMEBUFFER create
FRAMEBUFFER write f
Draw3D show 1,0,0,1000,1
Do
Math q_euler yaw,pitch,roll,q1()
Inc yaw,Rad(1)
Inc pitch,Rad(2)
Inc roll,Rad(0.5)
Draw3D rotate q1(),1
Draw3D show 1,0,0,1000,1
FRAMEBUFFER copy f,n,b
Loop

Edited 2022-05-23 04:29 by matherp
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 231
Posted: 08:02pm 22 May 2022
Copy link to clipboard 
Print this post

Does your genius have no limits?  I live in awe of what you do.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 07:11am 23 May 2022
Copy link to clipboard 
Print this post

V5.07.05b2 - VGA only

fixes issue on some Pico in VGA mode 1 output at 126MHz

PicoMiteVGA.zip
 
TheRockGod
Newbie

Joined: 01/04/2022
Location: Australia
Posts: 8
Posted: 08:33am 25 May 2022
Copy link to clipboard 
Print this post

Very Cool!!! :-)
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 10:48am 25 May 2022
Copy link to clipboard 
Print this post

Not strictly related to "this" beta but rather than starting a new thread

Is it possible to use a buzzer/beeper without having a display connected?
I see from the manual that I can use the GUI BEEP Command
but if you have no display connected could you use the same Piezo buzzer on any pin and how could you declare/use it?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 11:01am 25 May 2022
Copy link to clipboard 
Print this post

Pulseout
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5708
Posted: 11:04am 25 May 2022
Copy link to clipboard 
Print this post

It would have been much better to start a new thread, so I will. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 07:39am 29 May 2022
Copy link to clipboard 
Print this post

V5.07.05b3


PicoMite_Beta.zip


Fixes bug in BITBANG LCD CMD and BITBANG LCD DATA
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3011
Posted: 09:56am 29 May 2022
Copy link to clipboard 
Print this post

  matherp said  V5.07.05b3


Contains VGA versions b1 & b3. Was it supposed to contain a non-VGA update as well?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 11:05am 29 May 2022
Copy link to clipboard 
Print this post

Oops


PicoMite_Beta.zip
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 04:15pm 29 May 2022
Copy link to clipboard 
Print this post

Is there a means by which a program can determine when the FRAMEBUFFER COPY operation has completed? (This would be very helpful for the CMM2 also.)

I've had a few cases where MMBasic is "too fast" and I've started redrawing the (non-visible) buffer before the previous one was copied to the display. Mostly this applies to the D parameter on the CMM2, which might be nice for the PicoVGA too.
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 04:55pm 29 May 2022
Copy link to clipboard 
Print this post

Copy on the Pico is synchronous so it has always finished before the next statement. The only option is whether or not to wait for the next blanking period before starting the copy
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1776
Posted: 02:04am 31 May 2022
Copy link to clipboard 
Print this post

On the current beta PWM Duty is required, not optional.
In the manual it is shown as optional.

> setpin 4,pwm1a
> pwm 1, 50, 50                        <--------OK
> pwm 1, 50                            <--------Not OK
Error: Invalid address - resetting
PicoMite MMBasic Version 5.07.05b3
Copyright 2011-2021 Geoff Graham
Copyright 2016-2021 Peter Mather

>
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 06:26am 31 May 2022
Copy link to clipboard 
Print this post

One duty is required, wouldn't make sense otherwise, but unlike MM2 needn't be the first one.

so pwm 1,50,,50 is OK as is pwm 1,50,50

Shouldn't crash though will fix in next beta
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1776
Posted: 08:00am 31 May 2022
Copy link to clipboard 
Print this post

Thanks for the prompt response.
As the manual shows the duty to be optional I imagined there was a default, 50% perhaps but as you show one or the other is optional not both.
I shouldn't make assumptions!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 04:14pm 01 Jun 2022
Copy link to clipboard 
Print this post

Coming soonish sprites etc. on the PicoMiteVGA
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 374
Posted: 04:43pm 01 Jun 2022
Copy link to clipboard 
Print this post

Peter, I just saw this first on YouTube!

This is so cool that you made this possible, although now I have to rewirte the code for my "fake" Sprite aproach via BLIT :) But this makes things a lot easier, just wonderful!    

Greetings
Daniel
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3503
Posted: 05:34am 02 Jun 2022
Copy link to clipboard 
Print this post

Dear Peter,

Since you are adding new functionality to PicomiteVGA, can I suggest 2 changes.

1/ Turn to mode 1 as soon as you enter edit mode. Many programs written for Picomite will use mode 2 for it's ability to show colour. But editting in mode 2 is difficult. I also noticed if I edit in mode 2 through USB (terminal program putty) that it opens a 40x25 window (not 80x25) so you cannot run on VGA in a different resolution and edit through USB terminal in a different resolution.

2/ This may be a major undertaking, but colour coding in the editor would be a real advantage. I think it may even be possible in 640x480 mode using the tiles you implemented. Using a font that is exactly 80x30 on VGA screen, with 40x30 tiles groups of 2 characters can take any colour. Since there is always a white space of colon separating 2 commands, this could work with commands starting on odd X position. Worst case the colon also changes colour.

I hope you can consider these changes

Volhout
Edited 2022-06-02 16:07 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5708
Posted: 06:35am 02 Jun 2022
Copy link to clipboard 
Print this post

But you're only supposed to edit programs in green, Volhout. I know this because I've seen it in films on the telly loads of times. ;)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Witenite
Newbie

Joined: 02/06/2022
Location: New Zealand
Posts: 8
Posted: 09:15am 02 Jun 2022
Copy link to clipboard 
Print this post

Hi Peter,
I've been watching this project for some time now, and now own a PIC32 based Maximite, a CMM2 and now have 2 Pico's running MMBASIC. As a lecturer at a local college in the computer science department, I've been really enthusiastic about sharing my experiences with MMBASIC and am really super impressed that this runs on a Pico! That's just my way of saying thank you for all your super hard work on this project. Truly is a blessing.

Now I just tried to run this latest Beta version of the code, but for some reason it won't let me setup the SD card or System SPI option. I get told OPTION SPI is an invalid option. The identical setup works just fine for me with an older version. Not to be put off, I then proceeded to copy (line by line) the demo program you have listed here into the editor, via PuTTy. This almost succeeds, except some of the very long lines error out in the editor, where the editor says LINE IS TOO LONG when I hit column 81. I'm curious to know how you go about typing longer lines into the editor.

If you can help at all, please let me know. At the same time I am more than happy to be a guinea pig for any new code you release for MMBASIC. Thanks again!
 
     Page 1 of 11    
Print this page
© JAQ Software 2024