Mode15 (220x176x16) high resolution 16color and improved directbitmap

works fine on mbed atleast, i dont use windows for development so idk about EmBitz

Seems it works on EmBitz.
It’s probably a compiler extension,
but we don’t have to worry about portability so it’ll be fine.

1 Like

Binary literals courtesy of the Arduino compatibility extensions I’ve included in the core

I thought Arduino defines only covered values in the format B11001100, not 0b11001100.
(And for that matter only covered 0-255, whereas here the value 0b1000000111000 has at least 13 bits.)

so testing i spotted something odd. the text can only draw top left corner or it softlocks the program also i see theres some screen clear happening im not sure where thats coming from or how to turn it off.

im currently doing the mode15 call in the main function so idk what im suposed to do to make this a plug and play mode so to speek

i have been trying to optimise and this kinda works :confounded:
its only a small improvement not having to call the lcd cs every pixel
i pulled out the only relevant part of setup_data_16, not sure why there a variable and if in there it seems pointless atleast for this

    write_command(0x22);
    CLR_CS;
    for (int x=0; x<0x4BA0;x++) {
        SET_CD;
        SET_RD;
        SET_MASK_P2;
        LPC_GPIO_PORT->MPIN[2] = ((pal[(((scrbuf[x]) & 0xf0) >> 4)]) << 3);//insanity
        CLR_MASK_P2;
        CLR_WR;
        SET_WR;
        
        SET_CD;
        SET_RD;
        SET_MASK_P2;
        LPC_GPIO_PORT->MPIN[2] = ((pal[( (scrbuf[x]) & 0x0f)]) << 3);//insanity
        CLR_MASK_P2;
        CLR_WR;
        SET_WR;
    }
    SET_CS;

1 Like

@jonne i hope i did it correctly but i did a pull request on github for the mode

1 Like

Actually you did two PRs.
Are they both required for Mode 15 to work?

@Pharap PRs?
sorry not sure what you mean

PR = Pull Request

You made two of them:

Are both needed to add Mode 15?
If so it might be hard to test the changes.

oh sorry i guess i messed something up, i did it all in browser maybe i think they both apply

im thinking of adding quad sector pallet swaping to mode15
example with one pallet:

where the quads are:

example result:

@adekto Have you got a drawBitmap and other primitives done for this mode?

It’s supposed to re use low resmodes primitives
There’s just a bit of trouble with text wen linebreak is enabled

oh yea that might not have been defined correctly now :confused:
uhm basicly you have to enable everything from lowres mode exept for the draw and buffer size
not sure what the easyest way of doing that is

#Binary (or it didn’t happen)

mode15.bin (57.5 KB)

#example available on Github repo

#Mode15.cpp

#include "Pokitto.h" // include Pokitto library
#include "monkey16.h"

Pokitto::Core mygame; //create Pokitto application instance

void drawBlurb(const char* text, int x, int y, uint8_t fc, uint8_t bgc) {
    for (int tx=-1;tx<2;tx++) {
        for (int ty=-1;ty<2;ty++) {
            mygame.display.setColor(bgc,15);
            mygame.display.setInvisibleColor(15);
            mygame.display.setCursor(x+tx,y+ty);
            mygame.display.print(text);
        }
    }
    mygame.display.setCursor(x,y);
    mygame.display.setColor(fc,bgc);
    mygame.display.setInvisibleColor(bgc);
    mygame.display.print(text);
}


int main () {
    int x=0,y=20;
    mygame.begin(); // start the application
    mygame.display.load565Palette(monkey16_pal); //load the palette for the image
    mygame.display.setColor(1,0); // set foreground and background colors from palette
    mygame.display.setFont(fontMonkey); // choose a lovely font
    mygame.display.setInvisibleColor(0);
    /* the "while" loop runs as long as the program is running */
    while (mygame.isRunning()) {
        /* mygame.update() is processed whenever it is time to update the screen */
        if (mygame.update()) {
            x-=2;
            if (x<-90) x=-90;
            else if (x>0) x = 0;
            mygame.display.drawBitmap(x,16,monkey161);
            mygame.display.drawBitmap(x+160,16,monkey162);
            if (x<-82) {
                    drawBlurb("The New Mode15!!",10,62,14,0);
            }
            if (x<-88) {
                    drawBlurb("Nice!",130,82,10,0);
            }

        }
    }
    return 0; // this is "good programming manners". Program informs it ended without errors
}

#My_settings.h


#ifndef MY_SETTINGS_H
#define MY_SETTINGS_H

#define PROJ_MODE15 	  1     // 220x176 hires 16 color mode
#define PROJ_ENABLE_SOUND 0     // 0 = all sound functions disabled

#endif
6 Likes

Lots more optimization coming.

Also:

Monkey Island font added!

4 Likes

#And:

PokittoLib also synchronized on mbed now

https://os.mbed.com/teams/Pokitto-Community-Team/code/Mode15/

2 Likes

awsome and i like the font :wink:

Anyone tried this on the device yet? It looks amazingly crisp on the LCD.

I haven’t but I was considering converting sensitive to mode15.

[edit]
Tested it, it’s nice, you can still see the screen update, but it’s far better than I expected to see! Well done!

2 Likes