Improving FPS


Still a line of dots at the very top and across the middle.mode13.bin (37.0 KB)


What’s in “My_settings.h”?


Forgot to mention that the 2D scroller is named as “Examples\Scroll2Layers”. Jonne has merged that to PokittoLib.

    @file     My_settings.h
    @author   XX

    @section HOW TO USE My_settings

   My_settings can be used to set project settings inside the mbed online IDE


#define PROJ_HIRES 0            //1 = high resolution (220x176) , 0 = low resolution fast mode (110x88)
#define PROJ_ENABLE_SOUND 0     // 0 = all sound functions disabled
#define PROJ_MODE13 1	// Spinal's mode13 enabled



Here is the latest test version of my video player, it’s target framerate is 16 FPS, which is stored in the video header, as is other details like frame width and height etc. (5.8 MB)

This test will let you choose between the two file systems to play the video, one is fat and beeps a bit, the other doesn’t beep, but is far too slow.


I have been following this topic and the one about the scroller in 3d with great interest but I am a bit lost now:
Does only the low res mode benefit from these speed optimizations and can something similar been done to the hi res mode or is it already done?
Also are these optimizations already available in the latest version of pokittolib or not?

We really need (or at least I need) a good documentation of the different screen modes and their specifications, advantages, disadvantages,…
Maybe a specific topic about the pokittolib and all of its updates would also come in handy (because I do not entirely understand the added comments in the github repository)


Good points. Afaik, optimisations concern the Mode 2 (110x88x16 colors) and the Mode 13 only (@FManga ?) . They are in Pokittolib already. You can try the “Scroll2Layers” example.

The code can be optimized probably in all modes, but it is a huge task. In a hobby project it is best to do one by one, when there is enough demand, and when the coder has time for it.

I am also a bit lost about all the color modes we have (and which of them are really working). Should we make a separate thread about it or even a wiki document?

Something like:

  • Name and features (resolution, color count, sprite integration, tiles)
  • Supported by drawing primitives (DrawBitmap, DrawLine, etc.)
  • How to enable
  • Examples or games that are using it
  • A code snippet or short example program of usage
  • Status: initial / working / optimized/ etc.


Is there demand for mode 1 to get a similar treatment to modes 2 and 13?
There’s a minor bug in 2 and 13, which I intend to address soon. I could have a look at another mode then.

This would be very useful!


I don’t full understand the reason we need so many screen modes. I would think just 3 or 4 would be able to do everything.


What is mode 1?


Mode 1, aka MODE_HI_4COLOR or PROJ_HIRES. Isn’t that the one you were refering to?


Yes indeed :slight_smile: I had no idea that this was mode 1.
I am currently trying to do a game in mode 1: with 11 sprites I am getting ±50 fps which seems fast enough.
I don’t know if anyone else is using mode 1?
It also depends on how much work this would take. If this speed optimization is easily done, then I would say go for it. Otherwise we should maybe see if other people would like this as well…


You might want to take a quick look at a before-and-after of mode13’s optimization. :stuck_out_tongue:
Mode 1 involves more code than 2 and 13 combined.


I agree.

I can remember hires mode (220x176@4 colours) and lores mode (110x88@16 colours) but never any others.

The reason we have/need so many screen modes is because of differences in speed, memory and capabilities.

We haven’t even got a tile mode yet.

However, I think if we had all the different modes documented we might find that some of them are redundant.


I had a go at optimizing mode 1 (high res, 4 colors) and sent a PR. Mode 1 has two “sub-modes”: with and without sprites. I only looked at the no-sprites part of the code.
To test, here’s @ensonic’s Mandelbrot demo (with some modifications).
After it’s done calculating, press and hold A to see the FPS.
mandelbrot.bin (44.8 KB)


119 FPS

You crazy voodoo guy you


What movie is that from?


Both gifs are from Live And Let Die (James Bond).
Roger Moore’s first outing as Bond, and one of the only two films without ‘Q’ in it.

Good theme tune. Odd, but good.

When you were young and your heart was an open book,
you used to say live and let live.
(you know you did, you know you did, you know you did…)
But if this ever-changing world in which we live in makes you give in and cry…
say live and let die!

Youtube link.
(Guns and roses also did a variation of it. That’s here in case anyone’s interested.)


I knew about the song yet, somehow, I missed the movie. o_O


@FManga : display of fonts and bitmaps in mode 1 is broken after your last PR

Wrong bit order