Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:54 01 Aug 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 : CMM2: V5.07.00b10 - Selectable display page

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 09:39am 29 Jan 2021
Copy link to clipboard 
Print this post

If you want to confuse yourself Please try V5.07.00b10

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

This has the ability to select which page(s) are displayed on the screen

Syntax is:

PAGE DISPLAY n [,page]

Normal example of use is:

PAGE DISPLAY 3. This says show on the screen the current contents of page 3. The command does not impact the current write page

In 12 bit mode you can also use:
PAGE DISPAY 4,1

This sets the page to display for the top layer

The command executes in the next screen blanking period. When a program ends for any reason the normal display page 0 is restored

e.g.


page write 1
cls rgb(red)
page write 2
cls rgb(green)
do
page display 1
pause 100
page display 2
pause 100
loop
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 05:04pm 29 Jan 2021
Copy link to clipboard 
Print this post

Does the underlying Chrom-ART hardware only allow for page ORing in the 12 bit mode or could it work in 8 bit CLUT mode too?
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 05:15pm 29 Jan 2021
Copy link to clipboard 
Print this post

It can work in 4-bit CLUT mode AL44. Early versions of the firmware had this but it was pretty much useless with just 16 colours and needed lots of extra code to support. Full list of modes in LTDC are

#define LTDC_PIXEL_FORMAT_ARGB8888        0x00000000U   /*!< ARGB8888 LTDC pixel format */
#define LTDC_PIXEL_FORMAT_RGB888          0x00000001U   /*!< RGB888 LTDC pixel format   */
#define LTDC_PIXEL_FORMAT_RGB565          0x00000002U   /*!< RGB565 LTDC pixel format   */
#define LTDC_PIXEL_FORMAT_ARGB1555        0x00000003U   /*!< ARGB1555 LTDC pixel format */
#define LTDC_PIXEL_FORMAT_ARGB4444        0x00000004U   /*!< ARGB4444 LTDC pixel format */
#define LTDC_PIXEL_FORMAT_L8              0x00000005U   /*!< L8 LTDC pixel format       */
#define LTDC_PIXEL_FORMAT_AL44            0x00000006U   /*!< AL44 LTDC pixel format     */
#define LTDC_PIXEL_FORMAT_AL88            0x00000007U   /*!< AL88 LTDC pixel format     */
 
Nelno

Regular Member

Joined: 22/01/2021
Location: United States
Posts: 59
Posted: 02:40am 30 Jan 2021
Copy link to clipboard 
Print this post

  matherp said  If you want to confuse yourself Please try V5.07.00b10

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

This has the ability to select which page(s) are displayed on the screen

Syntax is:

PAGE DISPLAY n [,page]

Normal example of use is:

PAGE DISPLAY 3. This says show on the screen the current contents of page 3. The command does not impact the current write page

In 12 bit mode you can also use:
PAGE DISPAY 4,1

This sets the page to display for the top layer

The command executes in the next screen blanking period. When a program ends for any reason the normal display page 0 is restored

e.g.


page write 1
cls rgb(red)
page write 2
cls rgb(green)
do
page display 1
pause 100
page display 2
pause 100
loop


Woah, awesome! Thanks for enabling this. While I agree this can be confusing, it might also enable some neat tricks, especialyl with the higher-res / bit-depth modes!
 
Nelno

Regular Member

Joined: 22/01/2021
Location: United States
Posts: 59
Posted: 01:37am 13 Feb 2021
Copy link to clipboard 
Print this post

There appears to be an issue with PAGE DISPLAY in some modes.

The following program (attached as pagedisplay2.zip) will show the issue for mode 7. Basically, this mode ends up showing 2 pages at once for any page other than page 0.


dim numPages = 43

mode 7,8,0

dim colors(4)
colors(0) = rgb(white)
colors(1) = rgb(red)
colors(2) = rgb(green)
colors(3) = rgb(blue)

for i = 0 to numPages - 1
 page write i
 cls colors(i MOD 4)
 text 0,0,"Page " + str$(i)
next i

' wait for monitor to sync to mode
' hit a key to go to next page
for i = 0 to numPages - 1
 page display i
 a$ = ""
 do while a$ = ""
   a$ = inkey$
 loop
next i

end


pagedisplay2.zip

Note also that PAGE DISPLAY 5 fails with "Error in line 20: Address" even though my understanding is there should be 43 pages available to display in mode 7, 8 bit.

PAGE DISPLAY seems to work fine in mode 1 and 2 at all bit depths, but I haven't tried it in all other modes.

As for the utility of PAGE DISPLAY. I'm definitely finding uses for it.

When I found the mode 7 issue I was working on a tile-based renderer that uses swapping. It's not going to be feasible without CSUBs in higher res modes just due to the double-loop required to blit a screen full of tiles, but it looks like it might be quite reasonable at 320x240 resolutions.

As a working example I've attached box2.zip, which just renders a wireframe cube. This isn't using DRAW3D as I was having fun working out the rendering and optimizations myself for now.

box2.zip

This program can't maintain 60Hz @ 16 bits using PAGE COPY, but it can at 16 bits using PAGE DISPLAY, with about 13 ms of time left over per frame to do something else (shown as "wd:" in the stats). Furthermore, this is almost exactly the same amount of time that is left over in 8-bit depth mode at the same resolution, since the only work being done is the rendering of the text and cube (twice, once to erase the cube at the previous position and again to render the current position).

I think this definitely will allow BASIC to do some things at higher resolutions that it wouldn't be able to otherwise, at least not without CSUBs, and may be particularly useful for demo effects.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:33am 13 Feb 2021
Copy link to clipboard 
Print this post

My bad

There should be an error check on PAGE DISPLAY. This can't currently work in modes 3 or 5 or 6 or 7 or 12 or 13. I'll make some changes in the next beta in the meantime don't use PAGE DISPLAY for these modes.
 
johnd
Newbie

Joined: 22/10/2020
Location: United States
Posts: 30
Posted: 08:37am 13 Feb 2021
Copy link to clipboard 
Print this post

@Neino: I think this might be because the smaller resolutions are stored as single scan-line format in pages 1+, while page 0 is stored in the double scan-line format.  Hmm, this is too bad actually, because the single scan-line format gives us almost twice as many pages to work with.

If it comes down to having one or the other I'm not sure which I would prefer as there are advantages to both.  Do I want double the off-screen pages in low-res modes (stored as single scan-lines) but have to always do a page copy to page 0, or do I want half as many off-screen pages (stored as double scan-lines like page 0) but the ability to immediately display the page without having to do a page copy.
Edited 2021-02-13 18:39 by johnd
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:28am 13 Feb 2021
Copy link to clipboard 
Print this post

See the new beta
 
Nelno

Regular Member

Joined: 22/01/2021
Location: United States
Posts: 59
Posted: 05:36pm 13 Feb 2021
Copy link to clipboard 
Print this post

  matherp said  See the new beta


Thanks! I'll try that now.
 
Nelno

Regular Member

Joined: 22/01/2021
Location: United States
Posts: 59
Posted: 05:39pm 13 Feb 2021
Copy link to clipboard 
Print this post

  johnd said  @Neino: I think this might be because the smaller resolutions are stored as single scan-line format in pages 1+, while page 0 is stored in the double scan-line format.  Hmm, this is too bad actually, because the single scan-line format gives us almost twice as many pages to work with.

If it comes down to having one or the other I'm not sure which I would prefer as there are advantages to both.  Do I want double the off-screen pages in low-res modes (stored as single scan-lines) but have to always do a page copy to page 0, or do I want half as many off-screen pages (stored as double scan-lines like page 0) but the ability to immediately display the page without having to do a page copy.


I think I'd be fine with the ability to just swap between page 0 and 1 right now so that I can use one page for composition while displaying the other.

For debugging it's actually nice to be able to directly visualize your other pages sometimes, but it's not vital.
 
Nelno

Regular Member

Joined: 22/01/2021
Location: United States
Posts: 59
Posted: 06:44pm 13 Feb 2021
Copy link to clipboard 
Print this post

  matherp said  See the new beta


Working as expected in mode 7 now. Thanks!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025