cool-bun-demo/screen.c

34 lines
729 B
C
Raw Normal View History

2024-05-02 16:52:06 +00:00
#include "screen.h"
#include "types.h"
#include <clib/exec_protos.h>
#include <exec/memory.h>
void allocateScreenMemory(struct ScreenSetup *screenSetup) {
char *memory = (char *)AllocMem(
TOTAL_SCREEN_SETUP_SIZE(screenSetup),
MEMF_CLEAR | MEMF_CHIP
);
screenSetup->memoryStart = memory;
}
void freeScreenMemory(struct ScreenSetup *screenSetup) {
FreeMem(
screenSetup->memoryStart,
TOTAL_SCREEN_SETUP_SIZE(screenSetup)
);
}
void prepareScreen(
struct ScreenSetup *screenSetup,
uint16_t width,
uint16_t height,
uint8_t bitplanes
) {
screenSetup->width = width;
screenSetup->height = height;
screenSetup->bitplanes = bitplanes;
screenSetup->nextBitplaneAdvance = width * height / 8;
}