Implement split-screen footer
This commit is contained in:
parent
1b87ca8aa3
commit
7abb774dfb
BIN
footer.tif
Executable file
BIN
footer.tif
Executable file
Binary file not shown.
49
testbed.c
49
testbed.c
|
@ -33,9 +33,18 @@ typedef struct {
|
|||
unsigned int i[16];
|
||||
} Tile_t;
|
||||
|
||||
unsigned int PAGE[] = { 0x00, 0x20, 0x40, 0x60 };
|
||||
// todo: HIGH BITS??
|
||||
unsigned int PAGE[] = { 0x04, 0x24 };
|
||||
|
||||
#define setWriteMode(m) outport(REG_GDC, 0x05 | m << 8)
|
||||
void setSplitScreen(unsigned int y) {
|
||||
// TODO: VGA registers??
|
||||
outport(REG_CRTC, 0x1018);// | y << 8);
|
||||
outport(REG_CRTC, 0x0107);
|
||||
}
|
||||
void unsetSplitScreen() {
|
||||
outport(REG_CRTC, 0xff18);
|
||||
outport(REG_CRTC, 0x1107);
|
||||
}
|
||||
|
||||
void prepareEgaMemCopy() {
|
||||
setAllPlanes();
|
||||
|
@ -51,20 +60,6 @@ void blitTile(unsigned int offsetFrom, unsigned int offsetTo) {
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void blitTile(Tile_t *tile, int plane, unsigned int page, unsigned int x, unsigned int y) {
|
||||
unsigned int *data = tile->b + (plane << 4);
|
||||
volatile unsigned int far *out = (volatile unsigned int far *)
|
||||
&VID[(y * 640) + (x << 1) + (page << 8)];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 320; i += 20) {
|
||||
out[i] = *(data++);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define flipPage(p) outport(REG_CRTC, 0x0c | (p << 8))
|
||||
|
||||
/*** K E Y B O A R D ***/
|
||||
|
@ -360,14 +355,14 @@ int tifLoadEGA(FILE *f, TifImageMeta_t meta, unsigned int vidOffset, int maxY) {
|
|||
int gpair = (pixelpair & 0x02) >> 1 | (pixelpair & 0x20) >> 4;
|
||||
int rpair = (pixelpair & 0x04) >> 2 | (pixelpair & 0x40) >> 5;
|
||||
int ipair = (pixelpair & 0x08) >> 3 | (pixelpair & 0x80) >> 6;
|
||||
int shift = (ipixelpair % 4) << 1;
|
||||
int shift = (3 - (ipixelpair % 4)) << 1;
|
||||
|
||||
b |= bpair << shift;
|
||||
g |= gpair << shift;
|
||||
r |= rpair << shift;
|
||||
i |= ipair << shift;
|
||||
|
||||
if (shift == 6 || ipixelpair == ipixelpairLim - 1) {
|
||||
if (shift == 0 || ipixelpair == ipixelpairLim - 1) {
|
||||
// todo: use write mode 2, this is slooww
|
||||
setPlane(PLANE_B); *out = b;
|
||||
setPlane(PLANE_R); *out = r;
|
||||
|
@ -478,7 +473,14 @@ int main() {
|
|||
unsigned int page = 0;
|
||||
|
||||
#define OFF_TILES 0x4200
|
||||
|
||||
setEGAMode();
|
||||
atexit(vid_cleanup);
|
||||
|
||||
f = fopen("FOOTER.TIF", "rb");
|
||||
meta = tifLoadMeta(f);
|
||||
tifLoadEGA(f, meta, 0, 24);
|
||||
fclose(f);
|
||||
|
||||
f = fopen("TILES.TIF", "rb");
|
||||
meta = tifLoadMeta(f);
|
||||
|
@ -487,21 +489,22 @@ int main() {
|
|||
|
||||
mouse_init();
|
||||
kbd_init();
|
||||
atexit(vid_cleanup);
|
||||
|
||||
while (!keyPressed(K_ESC)) {
|
||||
page ^= 0x20;
|
||||
page ^= 1;
|
||||
|
||||
prepareEgaMemCopy();
|
||||
drawOffset = page << 8;
|
||||
for (y = 0; y < 13; y ++) {
|
||||
drawOffset = PAGE[page] << 8;
|
||||
for (y = 0; y < 11; y ++) {
|
||||
for (x = 0; x < 20; x ++) {
|
||||
blitTile(OFF_TILES + ((((x + y + z) >> 2) % 3) << 5), drawOffset);
|
||||
drawOffset += 2;
|
||||
}
|
||||
drawOffset += 600; // 40 bytes per line * 15 more lines
|
||||
}
|
||||
flipPage(page);
|
||||
|
||||
flipPage(PAGE[page]);
|
||||
setSplitScreen(16);
|
||||
|
||||
kbd_wait();
|
||||
z++;
|
||||
|
|
BIN
testbed.exe
BIN
testbed.exe
Binary file not shown.
Loading…
Reference in a new issue