Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:33 26 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 V5.09.00 betas: Sorting out SPRITE and BLIT + USB variants

     Page 4 of 9    
Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 03:14pm 17 Feb 2024
Copy link to clipboard 
Print this post

PicoMite MMBasic Version 5.09.00b1
OPTION SYSTEM SPI GP10,GP11,GP24
OPTION AUTORUN  ON
OPTION FLASH SIZE 4194304
OPTION HEARTBEAT OFF
OPTION PICO OFF
OPTION LCDPANEL ST7789_135, LANDSCAPE,GP8,GP12,GP9,GP25
OPTION SDCARD GP23, GP18, GP19, GP20
OPTION AUDIO GP2,GP3', ON PWM CHANNEL

Waveshare geek and bubble universe worked but Conway's life didn't or any sprite or layer L code.

 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 03:34pm 17 Feb 2024
Copy link to clipboard 
Print this post

You're right, anything with a layer doesn't work, bubble universe writes straight to the LCD. Had I had any error messages, they are working fine.
Regards, Kevin.
Edited 2024-02-18 01:38 by Bleep
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 03:39pm 17 Feb 2024
Copy link to clipboard 
Print this post

Please post the code for a program that doesn't work. Remember BLIT and SPRITE are now different commands and the code needs to use the correct one in 5.09.00
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 03:46pm 17 Feb 2024
Copy link to clipboard 
Print this post

It's the code from my post a few back code Only difference is to comment out the line that says 'SetPin GP25, DOUT' as it conflicts with the LCD GP25.
Regards Kevin
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4232
Posted: 03:54pm 17 Feb 2024
Copy link to clipboard 
Print this post

Conway life works on Geek on 50800
Volhout
PicomiteVGA PETSCII ROBOTS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 04:02pm 17 Feb 2024
Copy link to clipboard 
Print this post

This simple scope worked before

dim c%,x%,samples!(360)
SETPIN (31), AIn
adc open 500000,1 'samples per second

FRAMEBUFFER CREATE F
FRAMEBUFFER LAYER L
FRAMEBUFFER WRITE L
line 79,0,79,79,,rgb(red)
line 0,39,159,39,,rgb(red)
FRAMEBUFFER WRITE F

do
adc start samples!() 'get new samples

'trigger
c%=0
do:If samples!(c%) > 0.1 then if samples!(c%+1)<0.2 then exit do
inc c%:loop while c%<160

math scale samples!(),79,samples!()'scale to 80 pixel height
'cls

FRAMEBUFFER COPY L,F
for x%=0 to 158 'screen width
line x%,samples!(x%+c%),x%+1,samples!(x%+1+c%),,rgb(white) 'draw new sample
next x%
FRAMEBUFFER COPY F,N
loop
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 04:06pm 17 Feb 2024
Copy link to clipboard 
Print this post

Conway's life worked before.
RUN
[111] Sprite read 1, 5,5,15,15
Error : Not available on physical display
>

Const WIDTH = mm.hres
Const HEIGHT =mm.vres
Const CELL = 10
Gens = 0
CLS

FRAMEBUFFER CREATE


createSprites()
'Create some sprites to copy for the cells


'set up inital screen
FRAMEBUFFER WRITE F

For x = 10 To WIDTH Step CELL
For y = 10 To HEIGHT Step CELL
  alive = Int(Rnd*2)
  If alive = 1 Then
    Sprite WRITE 1,x, y
  EndIf
Next
Next

FRAMEBUFFER COPY f,n

'main loop
Do
gens = gens + 1
If gens = 101 Then Run
'clear out the next screen
FRAMEBUFFER write f
CLS

Colour RGB(white)
Text 0,260, "Generation " +Str$(gens)
Colour RGB(black)

For x = 10 To WIDTH Step CELL
For y = 10 To HEIGHT Step CELL
  FRAMEBUFFER write n  'count neighbours on current
  aliveNeighbours = countNeighbours(x,y)
  pixCol = Pixel(x+5,y+5) 'move to cell centre

  FRAMEBUFFER write f  'move back to new screen for all updates
  If pixCol = 16777215 Then

    If aliveNeighbours <2 Or aliveNeighbours > 3 Then
      Sprite write 2,x,y
    Else

      Sprite write 1,x,y
    EndIf
  Else
    If aliveNeighbours = 3 Then

      Sprite write 1,x,y
    EndIf
  EndIf
  'spontaneous creation and dying - added to allow sim to run longer

  mutate =Rnd()
  If mutate < 0.01 Then
    Sprite write 2,x,y  'spontaneous death
  ElseIf mutate > 0.999 Then
    Sprite write 1,x,y  'spontaneous life
  EndIf

Next y
Next x


FRAMEBUFFER copy f,n

Loop



Function countNeighbours(x,y)
count = 0
For dx = -10 To 10 Step CELL
  For dy = -10 To 10 Step CELL
    If (dx= 0 And dy=0) Then
    ' dont count yourself
    Else
        nx = (x+dx+WIDTH) Mod WIDTH
        ny = (y+dy+HEIGHT) Mod HEIGHT
        pixCol = Pixel(nx+5,ny+5)
        If pixCol = 16777215 Then
          count = count + 1
        EndIf
    EndIf
  Next dy
Next dx
countNeighbours = count
End Function



Sub createSprites()
Colour RGB(black)
Circle 10,10,5,,,,RGB(white)
Sprite read 1, 5,5,15,15' ****************** Error!

Colour RGB(black)
Circle 10,10,5,,,,RGB(black)
Sprite read 2, 5,5,15,15
End Sub

 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 04:06pm 17 Feb 2024
Copy link to clipboard 
Print this post

Change it to BLIT READ and try again
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 04:10pm 17 Feb 2024
Copy link to clipboard 
Print this post

  Volhout said  Conway life works on Geek on 50800
Volhout

hi, is that the version number? life did work before 50901
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 04:40pm 17 Feb 2024
Copy link to clipboard 
Print this post

  matherp said  Change it to BLIT READ and try again

RUN
[111] Blit read 1, 5,5,15,15
Error : Invalid on this display
>
is it me?
changed all sprite to blit
cheers, stan
note the different error messages... Invalid--not available

Edited 2024-02-18 02:55 by stanleyella
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 04:52pm 17 Feb 2024
Copy link to clipboard 
Print this post

Hi Peter,
There seem to be too many other comments going on, I assume you meant me to "Change it to BLIT READ and try again"?
If so here is what I did, and I'm still getting exactly the same, blank screen, with backlight, if I purposely introduce an error then the error message is displayed on the LCD screen fine, hopefully what I've done is what you intended.?

' Matrix code rain
' turn off default typing and force explicit typing
Option EXPLICIT
Option DEFAULT NONE
'SetPin GP25, DOUT
'SetPin GP25,dout:Pin(GP25)=0

Dim Integer horiz=MM.HRes/10-1, vert=MM.VRes/10-1
' Set up the rotation strings
Dim String orientate(3) Length 3 =("CMN","CMD","CMU","CMI")
Dim Integer shade(horiz),i,k=&hA00,l=2,LCD=0,c,r,x,n,m,y
Font 7

If MM.Device$="PicoMite" Or MM.Device$="PicoMiteUSB" Then
 FRAMEBUFFER create
 FRAMEBUFFER Write f
 LCD=1
Else
 MODE 2
EndIf

 CLS
' Draw 'Matrix' code rain display
 Do            
  If l=0 Then
' Move the 'code' down one line, gradually decreasing Green brightness
' If white change to Green
   If shade(m)=&hF0FFFF Then shade(m)=&hff00+k:shade(n)=&hff00+k
' Reduce Green brightness
   For y=0To horiz:shade(y)=Choice(shade(y)<&h1000,0,shade(y)-k):Next
  EndIf
' Move whole screen down 4 pixies
'   Blit 0,0,0,4,MM.HRes,MM.VRes-4
   Blit Read 1,0,0,MM.HRes,MM.VRes-4
   Blit Write 1,0,4
   Blit Close 1
' Blank out the top 4 lines of pixies
  Line 0,0,MM.HRes,0,4,0
  Inc l
  If l>1 Then
   l=0
' Output to display
   m=Rnd*horiz:n=Rnd*horiz
' Set to white initially
   shade(m)=&hF0FFFF : shade(n)=&hF0FFFF
' Draw the top line of randomised characters, rotating randomly    
   For x=0To horiz
    Text x*10+4,4,Chr$(Rnd*75+48),orientate(Rnd*3),,,shade(x)
   Next
  EndIf
  If LCD Then
'     FRAMEBUFFER Wait
    FRAMEBUFFER copy f,n
    Pause 40
  Else
    Pause 80
  EndIf
'   Error
'   Print Timer:Timer =0
 Loop
End

Regards, Kevin.
Edited 2024-02-18 03:02 by Bleep
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 05:12pm 17 Feb 2024
Copy link to clipboard 
Print this post

The bug is in FRAMEBUFFER COPY if you add ",B" to do the copy in the background it should work

Stan

Your issue is that you are trying to read from a non-readable display. You must put the FRAMEBUFFER WRITE F before trying to read then the read happens to memory
Edited 2024-02-18 03:13 by matherp
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 05:19pm 17 Feb 2024
Copy link to clipboard 
Print this post

Hi Kevin.  If it's not too many comments, there's a missing "For" in your code
Edited 2024-02-18 03:32 by stanleyella
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 05:22pm 17 Feb 2024
Copy link to clipboard 
Print this post

:-)
Glad you found it, yes if I use the 'b' option in the frame buffer copy, it now works just fine, both versions of 'BLIT' and 'BLIT READ/WRITE'.
Thank you Peter.
Regards, Kevin.
Edited 2024-02-18 03:26 by Bleep
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 05:39pm 17 Feb 2024
Copy link to clipboard 
Print this post

  matherp said  The bug is in FRAMEBUFFER COPY if you add ",B" to do the copy in the background it should work

Stan

Your issue is that you are trying to read from a non-readable display. You must put the FRAMEBUFFER WRITE F before trying to read then the read happens to memory

Can Mick or anyone explain this for the the dull crayons in the box please? :)
this and usb !?! usb wireless keyboard is working fine
do I need a sd card... drive b: in the sprite demo?
ps thanks Peter for all your work.
pps so it reads a readable display?? thought it would be from ram??
just when I was getting the hang of things :)
Edited 2024-02-18 04:13 by stanleyella
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 06:11pm 17 Feb 2024
Copy link to clipboard 
Print this post

Version 5.09.00b2

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

Fixes bug in FRAMEBUFFER COPY for SPI displays introduced in these betas
Major performance improvements for 16-bit parallel displays
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 06:29pm 17 Feb 2024
Copy link to clipboard 
Print this post

PicoMiteVGA MMBasic USB Edition  5.09.00b2
RUN
[76] FRAMEBUFFER LAYER L
Error : L is not declared
>
FRAMEBUFFER CREATE F
FRAMEBUFFER LAYER L
 FRAMEBUFFER WRITE L
cls RGB(black)

 FRAMEBUFFER WRITE f
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 06:53pm 17 Feb 2024
Copy link to clipboard 
Print this post

Have a look at the manual
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:03pm 17 Feb 2024
Copy link to clipboard 
Print this post

Hi Peter,
I Can confirm that all the LCD displays I have tested now work with Framebuffer Copy using 5.09.B2.
Regards, Kevin.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2127
Posted: 10:30pm 17 Feb 2024
Copy link to clipboard 
Print this post

  matherp said  Have a look at the manual

Peter sir, The manual is not uptodate with latest. I rely on my mind reading abilities to understand what is still relevant with betas. a spectrum of users and I'd be red end
 
     Page 4 of 9    
Print this page
© JAQ Software 2024