From: Robin Krens Date: Sat, 11 Jun 2022 19:29:52 +0000 (+0200) Subject: main: set fg and bg map locations X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=03e9de442d240b46d1341038abfa18119e5c7517;p=swan-dev main: set fg and bg map locations --- diff --git a/inc/video.h b/inc/video.h index 7a294fb..1fda526 100644 --- a/inc/video.h +++ b/inc/video.h @@ -6,7 +6,7 @@ #define IO_SPR_TABLE 0x04 #define IO_SPR_START 0x05 #define IO_SPR_STOP 0x06 -#define IO_FGBG_MAP 0x07 +#define IO_MAP_BASE 0x07 #define IO_FG_WIN_X0 0x08 #define IO_FG_WIN_Y0 0x09 #define IO_FG_WIN_X1 0x0A diff --git a/src/main.c b/src/main.c index 9be5eeb..bd4a86b 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,7 @@ */ #include #include +#include #include /* sprite data */ @@ -79,9 +80,16 @@ int main(void) setup_ivec(); init_video(); outport(IO_VIDEO_MODE, VMODE_16C_CHK | VMODE_CLEANINIT); - outport(IO_FGBG_MAP, 0x40); + unsigned short base = 0x3000; /* screens pos */ + unsigned short sprite_pos = base - (MAP_SIZE*2) - SPR_TABLE_SIZE; + unsigned short scr1_pos = base - (MAP_SIZE*2); /* 0x2000 */ + unsigned short scr2_pos = base - MAP_SIZE; /* 0x2800 */ + outport(IO_MAP_BASE, FG_MAP(scr2_pos) | BG_MAP(scr1_pos)); + outport(IO_SPR_TABLE, SPR_TABLE(sprite_pos)); + + /* icons */ outport(0x15, 0xEE); - + unsigned char * ptr = PALETTE_T; for (int i = 0; i < sizeof(bgtile_pal); ++i) { *ptr++ = bgtile_pal[i]; @@ -92,7 +100,7 @@ int main(void) *ptr++ = bgtile_gfx[i]; } - outport(IO_DISPLAY_CTRL, BG_ON); + outport(IO_DISPLAY_CTRL, BG_ON | FG_ON); while(1) { }