Clearing The Screen


PokeParadox

Founder of Pirate Games - Penjin Coder
Staff member
Joined
Dec 8, 2005
Messages
6,603
Age
41
Location
UK
Website
pokeparadox.itch.io
WEBSITE
https://github.com/pokeparadox
YOUTUBE
pokeparadox
I'm just wondering, what is the best way of clearing the screen using Ryleh's minilib?

In my demo for the coding compo, I just drew a black rectangle to the whole screen. This was really slow, however...
 
PokeParadox posted on Mar 11 2006 at 11:33 PM said:
I'm just wondering, what is the best way of clearing the screen using Ryleh's minilib?

In my demo for the coding compo, I just drew a black rectangle to the whole screen. This was really slow, however...

*fb is a pointer to the framebuffer.
color is 16 bit 5-6-5 RGB direct color value

It compiled without errors and should work.
Its perfomance is around 150MB/s and only blitter would be faster.

Code:
int fill_screen(unsigned short int *fb, unsigned short color)
{
    unsigned int *bla, pix1;

    bla = (unsigned int *)fb;
    pix1 = (unsigned int)color;

    asm
    (
        "mov r0, %0\n"
        "mov r2, %1\n"
        "add r1, r0, #153600\n"
        "orr r2, r2, r2, lsl #16\n"
        "mov r3, r2\n"
        "mov r4, r2\n"
        "mov r5, r2\n"
        "loop:"
        "stmia r0!, {r2, r3, r4, r5}\n"
        "stmia r0!, {r2, r3, r4, r5}\n"
        "stmia r0!, {r2, r3, r4, r5}\n"
        "stmia r0!, {r2, r3, r4, r5}\n"
        "cmp r0, r1\n"
        "blt loop\n"
        :
        :"r"(fb), "r"(pix1)
        :"r0", "r1", "r2", "r3", "r4", "r5"
    );
    return(0);
}
 
Last edited by a moderator:
Back
Top