Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:26 27 Nov 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/VGA/WEB V5.07.08 release candidates

     Page 9 of 18    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 07:38am 18 Oct 2023
Copy link to clipboard 
Print this post

Martin

I assume you are loading then sprites to the L layer?
If that is the case then, at the moment, black is always transparent in L. So you load them to L and magenta pixels are omitted during the load but then the display mechanism omits black pixels.
However, I have a fix for this, try the attached. This has an expansion of the framebuffer layer command


PicoMiteVGA (2).zip


FRAMEBUFFER LAYER [colour]

by default black is transparent but you can now override this and choose any colour.

Why did you go for magenta rather than the darkest green?

Also, be aware you can get very confused with this new functionality (I did). For example if you set the transparent colour to magenta then the screen will go blank because L is cleared to zero which is now opaque black - you have been warned
I may try and change this to clear L to the transparent colour but at the moment prepare to be confused
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 08:46am 18 Oct 2023
Copy link to clipboard 
Print this post

  matherp said  Martin

I assume you are loading then sprites to the L layer?
If that is the case then, at the moment, black is always transparent in L. So you load them to L and magenta pixels are omitted during the load but then the display mechanism omits black pixels.
However, I have a fix for this, try the attached. This has an expansion of the framebuffer layer command


PicoMiteVGA (2).zip


FRAMEBUFFER LAYER [colour]

by default black is transparent but you can now override this and choose any colour.

Why did you go for magenta rather than the darkest green?

Also, be aware you can get very confused with this new functionality (I did).


thank you, works fine ..

its just that cls on L or Boxes to delete Sprites now has to be in Magenta
I used Magenta as it is not used within the Sprites unlike  darkgreen. Also if we can use Black for "Spriteborder" and within the Sprites they have more contrast than with dark green.

you can also use this for nice fade effects  

'Fade using Layer demo
MODE 2
Font 1
FRAMEBUFFER layer 9
For n=1 To 20
Print "something on the Screen"
Next

FRAMEBUFFER write l
CLS RGB(Magenta)
Do
 fade_out
 Pause 200
 fade_in
 Pause 200
Loop


Sub fade_out
 For n=0 To 7
   For x=n To 320 Step 8
     Line x,0,x,240,,0
   Next
   For y=n To 240 Step 8
     Line 0,y,320,y,,0
   Next
   Pause 80
 Next
End Sub

Sub fade_in
 For n=0 To 7
   For x=n To 320 Step 8
     Line x,0,x,240,,RGB(magenta)
   Next
   For y=n To 240 Step 8
     Line 0,y,320,y,,RGB(magenta)
   Next
 Pause 80
 Next
End Sub    

Edited 2023-10-18 19:32 by Martin H.
'no comment
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 12:06pm 18 Oct 2023
Copy link to clipboard 
Print this post

  Quote  its just that cls on L or Boxes to delete Sprites now has to be in Magenta


I'll change that so that in the special case of mode 2, writing to the layerbuf and CLS without parameters it uses the transparent colour - watch this space
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 01:43pm 18 Oct 2023
Copy link to clipboard 
Print this post

V5.07.08RC10

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

WebMite
No significant changes

PicoMiteVGA

FRAMEBUFFER LAYER [colour]
You can now select the colour that will be transparent when a layer is created
Colours are specified as a number between 0 and 15 representing:

0:BLACK,1:BLUE,2:MYRTLE,3:COBALT,4:MIDGREEN,5:CERULEAN,6:GREEN,7:CYAN,
8:RED,9:MAGENTA,10:RUST,11:FUCHSIA,12:BROWN,13:LILAC,14:YELLOW,15:WHITE

When FRAMEBUFFER WRITE L is active in Mode 2, CLS without any parameters will clear the screen to the transparent colour

PicoMite

Installing this will delete everything on the PicoMite

Heap memory and maximum program size now 132Kb

New commands:

FRAMEBUFFER MERGE [colour] [,mode] [,updaterate]

FRAMEBUFFER SYNC


Preconditions for new command
FRAMEBUFFER and LAYERBUFFER are created i.e.

FRAMEBUFFER CREATE
FRAMEBUFFER LAYER


FRAMEBUFFER MERGE - writes the contents of the framebuffer to the physical display overwriting any pixels in the framebuffer that are set in the layerbuffer (not zero)

FRAMEBUFER MERGE col - writes the contents of the framebuffer to the physical display overwriting any pixels in the framebuffer that are in the layerbuffer not set to the transparent colour  "col"

FRAMEBUFFER MERGE col,B - as above except that the transfer to the physical display takes place on the second processor and control returns to Basic immediately

FRAMEBUFFER MERGE col,R [,updaterate] - sets the second processor to continuously update the physical display with the merger of the two buffers. Automatically sets FRAMEBUFFER WRITE F if not F or L already set. By default the screen will update as fast as possible (At 133MHz an ILI9341 in SPI mode updates about 13 times a second, in 8-bit parallel mode the ILI9341 achieves 27 FPS)
If "updaterate" is set then the screen will update to the rate specified in milliseconds (unless that is less than the fastest achievable on the display)
NB: FRAMEBUFFER WRITE cannot be set to N while continuous merged update is active.

FRAMEBUFFER MERGE col,A - aborts the continuous updates

In addition deleting either the layerbuf or framebuffer, ctrl-C, or END will abort the automatic update as well.

When using an automatic update on an SPI screen any attempt to use touch functionality will cause an error, also SDcard access will error unless a different set of pins are used for the SDcard SPI connection. Mod file playback is compatible with automatic update as long as the mod file is loaded before the MERGE command is issued

FRAMEBUFFER SYNC
Waits for the latest update to complete to allow drawing without tearing

Example code:
https://youtu.be/GH-_HAiiWx0

FRAMEBUFFER create 'create a framebuffer
FRAMEBUFFER layer ' and a layer buffer
FRAMEBUFFER write f 'set graphics output to the framebuffer
Load image "b:/mandelbrot" ' and load a picture
FRAMEBUFFER merge 0,R,100 'now start a continuous update for the screen on CPU2 every 100mSec
FRAMEBUFFER write l' We will leave the framebuffer alone and just write to the layer
i=100
j=100
Do
 Do 'create a random origin for a circle staying on the screen
    x=i+Rnd()*6-3
    y=j+Rnd()*6-3
 Loop While x<50 Or x>MM.HRes-50 Or y<50 Or y>MM.VRes-50
 FRAMEBUFFER sync 'sync to the framebuffer write to avoid artifacts
 Box i-51,j-51,102,102,,0,0 ' clear the previous image
 Circle x,y,50,5,,RGB(red),RGB(blue) 'write a new image
 i=x
 j=y
Loop


This new facility would be ideal on one of the round displays where moving items could be drawn over a background with no tearing - PicoMite watch anyone?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 05:23pm 18 Oct 2023
Copy link to clipboard 
Print this post

PicoMiteV5.07.08RC10 updated 17:22UTC 18/10/23 to fix an issue with playing mod files while FRAMEBUFFER SYNC is waiting

Forgot to mention that

BLIT FRAMEBUFFER from, to, xin, yin, xout, yout, width, height [,colour]


Now works for all displays and framebuffers on the PicoMite and WebMite including transparent pixels when "colour" is specified (0-15). This allows copying any rectangular area from one framebuffer to another or to and from the physical display

from and to can be any combination of N,F, and L but not the same
Edited 2023-10-19 03:30 by matherp
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 05:34pm 18 Oct 2023
Copy link to clipboard 
Print this post

  TheMonkeys said  Hi Hans,
From the Documentation:
  Quote  MM.INFO(VERSION) Returns the version number as a floating point number.

This is regardless of whether you specify MM.INFO(VERSION) or MM.INFO$(VERSION).

Also, that "volvo","saab",... bit, I recall seeing that on Mozilla.org.  

Cheers,
Chris


Thanks Chris;

So I need to convert it to a string value at use.

Yes you are correct just playing with the examples from there and converting them for use with MMBasic web programming. Good place for examples.

I was really confused by the disappearing $ in the editor.

Thanks Again;

Hans ...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 05:42pm 18 Oct 2023
Copy link to clipboard 
Print this post

One more thing to note

FRAMEBUFFER BLIT is now deprecated and will be removed from the final release.
Use instead BLIT FRAMEBUFFER which is more powerful (transparent pixel capable) and better implemented (faster)
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 06:07pm 18 Oct 2023
Copy link to clipboard 
Print this post

@Peter,

Is it possible to align the color numbers.

For sprites (0...15)

colors:
'--Colorscheme accordung to Spritecolors
Data RGB(BLACK),RGB(BLUE),RGB(GREEN),RGB(CYAN),RGB(RED)
Data RGB(MAGENTA),RGB(YELLOW),RGB(WHITE),RGB(MYRTLE)
Data RGB(COBALT) ,RGB(MIDGREEN),RGB(CERULEAN),RGB(RUST)
Data RGB(FUCHSIA),RGB(BROWN),RGB(LILAC)

For layer colors (0...15)

0:BLACK,1:BLUE,2:MYRTLE,3:COBALT,4:MIDGREEN,5:CERULEAN,6:GREEN,7:CYAN,
8:RED,9:MAGENTA,10:RUST,11:FUCHSIA,12:BROWN,13:LILAC,14:YELLOW,15:WHITE


Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 06:22pm 18 Oct 2023
Copy link to clipboard 
Print this post

The 0-7 sprite colours are as used on the original Maximite and the layer colours are the actual nibble codes that output on the VGA pins.

My Basic CSUB creation programs do the mapping but would be trivial to edit so you could use any numbers you like in your sprite source files (i.e. the nibble codes)

The only place the sprite colours are used are in the firmware are the SPRITE LOAD command which is VGA only. I could add an extra parameter to that to optionally use the nibble codes but whether it is worth the effort.....

Does anyone use SPRITE LOAD?
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 06:37pm 18 Oct 2023
Copy link to clipboard 
Print this post

  matherp said  

Does anyone use SPRITE LOAD?

Of course, that was previously the only way to do this in a space-saving manner.
Or just 1 Bit/Pixel  GUI BITMAP for monochrome
'no comment
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:31pm 18 Oct 2023
Copy link to clipboard 
Print this post

Hi Peter,
I have come across another bugget.
If a mod file is playing, while a FRAMEBUFFER merge 9,b is being performed the mod file plays the first few bars then gets stuck in a single note loop, If I leave it running long enough, several minutes, it eventually does a reset. Only the playing of the MOD is affected the rest of the program continues running fine, till the reset happens.
If you can load and run the library and lcdpet.bas files I have just uploaded the petscii thread, that will demonstrate the problem, you will need all the extra ancillary files as well.
Otherwise Volhout said he would produce a complete package, maybe today, I can then modify it again for the LCD and see if the problem persists, if it does, then hopefully all you would then need is the new .bas file.
Regards Kevin.

PS, or I could zip up my whole "petrobot" directory for you?
Edited 2023-10-19 05:32 by Bleep
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:51pm 18 Oct 2023
Copy link to clipboard 
Print this post

I've zipped it up.

petrobot.zip

cd to petrobot
load the pet_lib.lib
run lcdpet.bas
then start playing the game.
Then the in game play music should get stuck, if you remove the b from the merge about line 173, it works fine.
Regards Kevin
Edited 2023-10-19 05:53 by Bleep
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 12:22pm 21 Oct 2023
Copy link to clipboard 
Print this post

V5.07.08RC11

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

Re-engineered background SPI LCD updates to co-exist better with touch and mod file playback. It is not possible to also do this for SDcard access so all card usage should be completed before using background updates or they should be stopped before resuming card access.

FRAMEBUFFER BLIT removed - see above

New optional parameter for SPRITE LOAD on the VGA version

SPRITE LOAD #n, fname$ [,mode]

mode defaults to zero in which case the CMM1/CMM2 colour codes are used
BLACK,BLUE,GREEN,CYAN,RED,MAGENTA,YELLOW,WHITE,MYRTLE,COBALT,MIDGREEN,CERULEAN,RUST,FUCHSIA,BROWN,LILAC;

If mode is specified as 1 then the RGB121 colour codes are used:
       BLACK,BLUE,MYRTLE,COBALT,MIDGREEN,CERULEAN,GREEN,CYAN,RED,MAGENTA,RUST,FUCHSIA,BROWN,LILAC,YELLOW,WHITE

New optional parameter for OPTION LCDPANEL for 8-bit parallel displays

OPTION LCDPANEL 8bitdisplaycode, orientation [, backlightpin] [,DCpin]
If DCpin is omitted then the pin allocation is as per the manual. If DCpin is specified then the pins DC, WR, RD, and RESET will be allocated sequentially from DCpin

General tidying up and very minor performance tweak for graphics framebuffer and VGA useage

Edited 2023-10-21 22:24 by matherp
 
javavi

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 218
Posted: 04:24pm 24 Oct 2023
Copy link to clipboard 
Print this post

PLAY MODFILE file$
Plays the song in a loop.
PLAY MODFILE file$ [,interrupt]
The interrupt subroutine executes at the end of playing a song.

And since this option appeared, I present my simple player
PMMP - PicoMite MusicPlayer

PMMP.zip
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 06:42pm 24 Oct 2023
Copy link to clipboard 
Print this post

Hi Peter,
I'm using a LCD display, if I use FRAMEBUFFER merge 0,b the screen updates fine, everything looks good.
If I modify the code to use FRAMEBUFFER copy f,n,b the screen is updated ok, but I'm seeing white flashes 4 or 5 pixels in a row randomly over the screen, if I remove the SD card they go away, any ideas what might be going on? I have done a flash clear and re-installed RC11 to be sure.

I am using an unusual cpu frequency, 336Mhz because if I use 378Mhz and do background copy or merge I'm getting crashes, presumably because the second processor is stressing the Pico more than it can cope with. :-(
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 08:58am 25 Oct 2023
Copy link to clipboard 
Print this post

Something I've noticed while testing rc11, using Framebuffer copy f,n or f,n,b on  a LCD, this appears to be only 16 colour, is that to be expected, like the merge, for example a colour which was put into the f framebuffer as rgb(140,140,140) comes out as light purple on the screen once copied?
Thanks for any guidance.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 09:44am 25 Oct 2023
Copy link to clipboard 
Print this post

Framebuffers are always rgb121 otherwise they would need much more memory than available on the rp2040
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 10:45am 25 Oct 2023
Copy link to clipboard 
Print this post

Yes of course, thank you, I do now remember the discussions about a full colour frame buffer taking up all the ram! Thank you. :-)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 02:21pm 27 Oct 2023
Copy link to clipboard 
Print this post

V5.07.08RC12

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

You can now use a variable in FRAMEBUFFER WRITE N/F/L/fr$
This should make it easier to write code that is easily transportable between PicoMite and PicoMiteVGA

Fixes issue with background framebuffer copy (I hope)

Trying to use \&00 or \000 as an escape sequence now gives an error and prompts re-coding as CHR$(0)
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 02:25pm 27 Oct 2023
Copy link to clipboard 
Print this post

  matherp said  Trying to use \&00 or \000 as an escape sequence now gives an error and prompts re-coding as CHR$(0)


No doubt you are correct Peter, but could you point me at that code, perhaps another set of eyes might find a way to make that escape sequence work?

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 9 of 18    
Print this page
© JAQ Software 2024