fs2port/port/include/apple2hires.h
2026-05-13 21:32:05 -05:00

38 lines
1.3 KiB
C

// Apple II hires decoder. Reads an 8K hires page (the .po-derived
// `loading_panel.bin` file), unpacks the interleaved scanline layout
// into a flat 280x192 1-bit bitmap, and blits a row range into the
// port framebuffer using a chosen colour for lit pixels.
#ifndef APPLE2HIRES_H
#define APPLE2HIRES_H
#include <stdbool.h>
#include <stdint.h>
#include "framebuffer.h"
#define HIRES_WIDTH 280
#define HIRES_HEIGHT 192
#define HIRES_BYTES 8192
typedef struct HiresPageT {
uint8_t bits[HIRES_WIDTH * HIRES_HEIGHT]; // 1 byte per pixel, 0/1
} HiresPageT;
// Decode an 8K hires-page file from `path` into `out`. Returns true
// on success.
bool apple2HiresLoadFile(const char *path, HiresPageT *out);
// Blit rows [srcTopRow, srcTopRow+rows) of the decoded page into
// the framebuffer at (dstX, dstY), painting lit pixels with `litColor`
// and (if `paintBackground`) unlit pixels with `bgColor`.
void apple2HiresBlit(const HiresPageT *page,
int16_t srcTopRow,
int16_t rows,
FramebufferT *fb,
int16_t dstX,
int16_t dstY,
ColorE litColor,
ColorE bgColor,
bool paintBackground);
#endif