51 lines
945 B
C
51 lines
945 B
C
#ifndef __SCREEN_H__
|
|
#define __SCREEN_H__
|
|
|
|
#include "types.h"
|
|
|
|
#define SCREEN_WIDTH (320)
|
|
#define SCREEN_HEIGHT (256)
|
|
|
|
struct ScreenSetup {
|
|
// human entered
|
|
uint16_t width;
|
|
uint16_t height;
|
|
short int bitplanes;
|
|
|
|
// calculated
|
|
unsigned char *memoryStart;
|
|
uint16_t byteWidth;
|
|
uint16_t nextBitplaneAdvance;
|
|
uint16_t nextBufferAdvance;
|
|
};
|
|
|
|
struct CurrentScreen {
|
|
uint16_t currentBuffer;
|
|
unsigned char *planes[8];
|
|
};
|
|
|
|
void setupScreen(
|
|
struct ScreenSetup *screenSetup,
|
|
uint16_t width,
|
|
uint16_t height,
|
|
uint8_t bitplanes
|
|
);
|
|
void teardownScreen(struct ScreenSetup *screenSetup);
|
|
|
|
void setCurrentScreen(
|
|
struct ScreenSetup *screenSetup,
|
|
struct CurrentScreen *currentScreen,
|
|
short int buffer
|
|
);
|
|
|
|
void swapCurrentScreenBuffer(
|
|
struct ScreenSetup *screenSetup,
|
|
struct CurrentScreen *currentScreen
|
|
);
|
|
|
|
void setupInitialCurrentScreen(
|
|
struct ScreenSetup *screenSetup,
|
|
struct CurrentScreen *currentScreen
|
|
);
|
|
#endif
|