Added ML_background
This commit is contained in:
parent
b53210a490
commit
8a00ab5a6b
|
@ -35,7 +35,9 @@ SRC = ML_vram_adress \
|
|||
ML_bmp_8_or ML_bmp_8_and ML_bmp_8_xor \
|
||||
ML_bmp_8_or_cl ML_bmp_8_and_cl ML_bmp_8_xor_cl \
|
||||
ML_bmp_16_or ML_bmp_16_and ML_bmp_16_xor \
|
||||
ML_bmp_16_or_cl ML_bmp_16_and_cl ML_bmp_16_xor_cl
|
||||
ML_bmp_16_or_cl ML_bmp_16_and_cl ML_bmp_16_xor_cl \
|
||||
\
|
||||
ML_background
|
||||
|
||||
# INCLUDE FILES
|
||||
## PUBLIC
|
||||
|
@ -65,7 +67,8 @@ MAN = $(MAN3:%=man3/%.3)
|
|||
PLATFORM = sh3eb-elf-
|
||||
## Compilator
|
||||
CC = $(PLATFORM)gcc
|
||||
CFLAGS = -I $(INCDIR)
|
||||
CHKFLAGS = -Wall -Wextra
|
||||
CFLAGS = -I $(INCDIR) $(CHKFLAGS)
|
||||
## Archive manager
|
||||
AR = $(PLATFORM)ar
|
||||
## Ranlib
|
||||
|
|
|
@ -29,11 +29,17 @@ typedef enum {
|
|||
ML_CHECKER
|
||||
} ML_Color;
|
||||
|
||||
typedef enum {
|
||||
ML_MOR,
|
||||
ML_MAND,
|
||||
ML_MXOR
|
||||
} ML_Mode;
|
||||
|
||||
/*
|
||||
** Function prototypes
|
||||
*/
|
||||
|
||||
char* ML_vram_adress();
|
||||
void* ML_vram_adress();
|
||||
|
||||
void ML_clear_vram();
|
||||
void ML_clear_screen();
|
||||
|
@ -87,6 +93,11 @@ void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y);
|
|||
void ML_bmp_16_and_cl(const unsigned short *bmp, int x, int y);
|
||||
void ML_bmp_16_xor_cl(const unsigned short *bmp, int x, int y);
|
||||
|
||||
#define ML_background_or(B) ML_background((B), ML_OR)
|
||||
#define ML_background_and(B) ML_background((B), ML_AND)
|
||||
#define ML_background_xor(B) ML_background((B), ML_XOR)
|
||||
void ML_background(const void *bmp, ML_Mode mode);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/* ************************************************************************** */
|
||||
/* _____ _ */
|
||||
/* ML_background.c |_ _|__ _ _| |__ ___ _ _ */
|
||||
/* | Project : CaphiOS | |/ _ \| | | | '_ \ / _ \ | | | */
|
||||
/* | | (_) | |_| | | | | __/ |_| | */
|
||||
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
|
||||
/* Last updated: 2016/05/23 23:38:59 |___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <monochrome/internals.h>
|
||||
|
||||
/*
|
||||
** ML_background:
|
||||
** Draws a sprite on the whole screen.
|
||||
** @bmp: link to the bmp data (must be 128*16 bytes long)
|
||||
*/
|
||||
|
||||
void ML_background(const void *bmp, ML_Mode mode)
|
||||
{
|
||||
unsigned int *v = ML_vram_adress();
|
||||
const unsigned int *b = bmp;
|
||||
int w = 0;
|
||||
|
||||
switch (mode) {
|
||||
case ML_MAND:
|
||||
for (; w < 256; w++, v++, b++)
|
||||
*v &= *b;
|
||||
break;
|
||||
|
||||
case ML_MOR:
|
||||
for (; w < 256; w++, v++, b++)
|
||||
*v |= *b;
|
||||
break;
|
||||
|
||||
case ML_MXOR:
|
||||
for (; w < 256; w++, v++, b++)
|
||||
*v ^= *b;
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
typedef char*(*sc_cpv)(void);
|
||||
const unsigned int sc0135[] = {0xD201D002, 0x422B0009, 0x80010070, 0x0135};
|
||||
|
||||
char* ML_vram_adress()
|
||||
void* ML_vram_adress()
|
||||
{
|
||||
return ((sc_cpv)sc0135)();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue