Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:27 28 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: FrameBufffers

     Page 1 of 2    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 11:15am 24 Jun 2023
Copy link to clipboard 
Print this post

Hi Peter et al.,

I want to take a temporary copy of an area of a FRAMEBUFFER (not N) which I will then restore later. Is there (or could there be) any way to do this other than copying the entire FRAMEBUFFER from F to L ? Something like how standard BLIT command works with its own internal memory buffers but allowing copying to and from FRAMEBUFFERs (with FRAMEBUFFER colour resolution).

Also IIRC doesn't frame buffer L{AYER} have some different behaviour (transparency) from frame buffer F, if so then it doesn't appear to be documented in the manual.

Best wishes,

Tom
Edited 2023-06-24 21:30 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 11:53am 24 Jun 2023
Copy link to clipboard 
Print this post

VGA or normal
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 11:55am 24 Jun 2023
Copy link to clipboard 
Print this post

Normal.
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 12:23pm 24 Jun 2023
Copy link to clipboard 
Print this post

Whilst messing with this I think I've also found a bug:

> OPTION LIST
PicoMite MMBasic Version 5.07.07
OPTION SYSTEM SPI GP6,GP3,GP4
OPTION AUTORUN 1
OPTION CPUSPEED (KHz) 252000
OPTION LCDPANEL ILI9341, RLANDSCAPE,GP2,GP1,GP0
OPTION GUI CONTROLS 2
OPTION TOUCH GP5,GP7
GUI CALIBRATE 0, 4034, 2040, -2600000, -64285
OPTION SDCARD GP22
OPTION AUDIO GP20,GP21, ON PWM CHANNEL 2

> LIST
FRAMEBUFFER Create

' Write Hello World to "F" and copy to the display.
FRAMEBUFFER Write F
Text 50, 50, "Hello World"
FRAMEBUFFER Copy F, N
' *** Display should now show "Hello World"
Pause 2000

Do

' Create "L" and copy "F" to "L"
FRAMEBUFFER Layer
FRAMEBUFFER Copy F, L

' Clear "F" and copy to the display.
CLS
FRAMEBUFFER Copy F, N
' *** Display should now be blank.
Pause 2000

' Copy "L" to "F" and then "F" to display.
FRAMEBUFFER Copy L, F
FRAMEBUFFER Copy F, N
' *** Display should now show "Hello World"
Pause 2000

' Close "L"
FRAMEBUFFER CLOSE L

Loop


In theory I believe this should flash "Hello World" on and off the display infinitely, in reality it only shows the text twice.

I guess following a FRAMEBUFFER CLOSE the re-creation isn't working properly, though nor is it throwing an ERROR.

Best wishes,

Tom
Edited 2023-06-24 22:24 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 01:14pm 24 Jun 2023
Copy link to clipboard 
Print this post

something like .. sprite/Blit to copy parts of the Framebuffer to screen?

framebuffer write f:sprite read no,x,y,w,h
framebuffer write n:sprite write no,x,y
sprite no clear
Edited 2023-06-24 23:15 by Martin H.
'no comment
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 01:22pm 24 Jun 2023
Copy link to clipboard 
Print this post

I want to be able to copy rectangles between  buffers (note that not all physical displays can be copied FROM) and ideally not pay for full 320x240 frame buffers when I don't need them. Basically the raw building blocks for sprites (4-bit) on the PicoMite.

Tom
Edited 2023-06-24 23:27 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 01:39pm 24 Jun 2023
Copy link to clipboard 
Print this post

Hmm, having located Peter's original post I can see that LAYER won't act as a second off screen buffer:

  Quote  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)


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 01:54pm 24 Jun 2023
Copy link to clipboard 
Print this post

This was my first effort with moving parts of the display around.
option DEFAULT INTEGER
OPTION EXPLICIT
dim counter
dim scrolx,scroly,scrolpix,scrolht,scrolwid
cls
'landscape
line 0,0,20,8
line 20,8,32,16
line 32,16,42,4
line 42,4,48,30
line 48,30,68,31
line 68,31,80,24
line 80,24,92,26
line 92,26,120,31
line 120,31,144,8
line 144,8,176,0
line 176,0,198,12
line 198,12,240,12
line 240,12,280,24
line 280,24,316,12
line 316,12,319,0

do
 for counter = 1 to 100
   scroll_left 0,0,2,320,32
 next counter
 
 for counter = 1 to 100
   scroll_right 0,0,2,320,32
 next counter
loop



sub scroll_left scrolx,scroly,scrolpix,scrolht,scrolwid
 blit read 1,scrolx,scroly,scrolpix,scrolht
 blit read 2,scrolpix,scroly,scrolwid-scrolpix,scrolht
 blit write 2,scrolx,scrolht,scrolwid-scrolpix,scrolht
 blit write 1,scrolwid-scrolpix,scroly,scrolpix,scrolht
 blit close 2
 blit close 1
end sub

sub scroll_right scrolx,scroly,scrolpix,scrolht,scrolwid
 blit read 1,scrolwid-scrolpix,scroly,scrolpix,scrolht
 blit read 2,scrolx,scroly,scrolwid-scrolpix,scrolht
 blit write 2,scrolpix,scroly,scrolwid-scrolpix,scrolht
 blit write 1,scrolx,scroly,scrolpix,scrolht
 blit close 2
 blit close 1  
end sub
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 02:07pm 24 Jun 2023
Copy link to clipboard 
Print this post

Hi Stan, that requires the display to be readable.

I was looking to composite in an off-screen buffer and then copy that entire buffer to the display. But I believe that requires at least one other additional screen buffer to be used as a source of "sprites" and also to which bits of the main buffer can be stored for later restoration.

Best wishes,

Tom
Edited 2023-06-25 00:20 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 02:37pm 24 Jun 2023
Copy link to clipboard 
Print this post

Is it vga or lcd? I want to try drawing in the frame buffer then refreshing the screen but lots of new stuff to learn. Amazing mmb has these capabilities, don't get it with 8bit ucontrollers.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 02:43pm 24 Jun 2023
Copy link to clipboard 
Print this post

  stanleyella said  Is it vga or lcd?


I'm talking about LCD. Note that the buffers only have 4 bit resolution (like the VGA) so copying from the display into a buffer involves a loss of colour resolution.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 02:56pm 24 Jun 2023
Copy link to clipboard 
Print this post

I didn't know that. What's 4bit resolution mean for lcd 16 colours? I'll see in the manual. It's new. cheers stan.

I can't see how to send graphics to a buffer in the manual other than copy part of the display. How to write it to another buffer?
Edited 2023-06-25 01:08 by stanleyella
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 05:13pm 24 Jun 2023
Copy link to clipboard 
Print this post

On a tangent, what happens to off screen graphics? Like a circle,box,polygon.
Are they not plotted on lcd or is the screen in a buffer and just the lcd screen size is displayed? I never get errors with graphics going off screen and should test if they wrap around ie disappear left and appear right after a while.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 05:33pm 24 Jun 2023
Copy link to clipboard 
Print this post

Your program that purports to show a bug has an error in it causing what you are seeing
Edited 2023-06-25 03:37 by matherp
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 05:40pm 24 Jun 2023
Copy link to clipboard 
Print this post

I think the rule is that it's up to you to make sure you stay within the frame to suit your application. Primitives like lines, circles, boxes and polygons are calculated when they are displayed so they may *appear* to still be there when off-screen and moved back, but they aren't, they are just being re-calculated.
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 05:46pm 24 Jun 2023
Copy link to clipboard 
Print this post

  matherp said  Your program that purports to show a bug has an error in it causing what you are seeing


Really? Care to be less obtuse .

Meanwhile have discovered the undocumented MM.INFO(WRITEBUFF) which allowed me to manually create another full screen buffer, though will still need firmware or CSUBs to blit (as opposed to full screen copy) between buffers.

Best wishes,

Tom
Edited 2023-06-25 03:57 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 06:11pm 24 Jun 2023
Copy link to clipboard 
Print this post

"We don't make mistakes, just happy little accidents." - Bob Ross.

Inspired by watching one of his shows yesterday. :)
Mick

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

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:18pm 24 Jun 2023
Copy link to clipboard 
Print this post

I don't think it's a bug just different displays like ssd1306  has a 1K buffer and wraps around.
ILI9341 no errors when graphics off screen , mmb not testing pixel is off screen? hence is it in a buffer larger than the display.
I was thinking asteroid and polygon in a "box".. just move the box and if going left the is right side of "box" off screen then right side appears on right sise of screen.. idea, same for all screen borders. just an idea I'm trying with polygons.
just a hobby watching startrek brave new worlds same time  
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:34pm 24 Jun 2023
Copy link to clipboard 
Print this post

  thwill said  
  matherp said  Your program that purports to show a bug has an error in it causing what you are seeing


Really? Care to be less obtuse .

Meanwhile have discovered the undocumented MM.INFO(WRITEBUFF) which allowed me to manually create another full screen buffer, though will still need firmware or CSUBs to blit (as opposed to full screen copy) between buffers.

Best wishes,

Tom

what else is undocumented ? but I don't do C, that's why I use mmb. can you convert to mmb?
Edited 2023-06-25 04:39 by stanleyella
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 06:58pm 24 Jun 2023
Copy link to clipboard 
Print this post

  stanleyella said  
what else is undocumented ? but I don't do C, that's why I use mmb. can you convert to mmb?


Hi Stan, I can't try to answer your questions without taking this thread further off piste. If you'd care to frame them in a new topic then I promise to give answering them a go.

Back on topic I'd appreciate knowing why my example doesn't work. OK, I misunderstood the purpose of the LAYER, but even given that misunderstanding I think it should still work as I described.

Best wishes,

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