]> robinkrens.nl - git repository - swan-dev/commitdiff
main: set fg and bg map locations
authorRobin Krens <robin@robinkrens.nl>
Sat, 11 Jun 2022 19:29:52 +0000 (21:29 +0200)
committerRobin Krens <robin@robinkrens.nl>
Sat, 11 Jun 2022 19:29:52 +0000 (21:29 +0200)
inc/video.h
src/main.c

index 7a294fb64b80f5200e3d7f6c466f19db7321fd37..1fda526d0f7650228c38b48547ddc8d1ce8f0a97 100644 (file)
@@ -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
index 9be5eeb1c5bddb901395b0bcb6a94c65d7728cb6..bd4a86bf310b5a62138610f7b24f9a676f71879c 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <memory.h>
 #include <video.h>
+#include <config.h>
 #include <interrupt.h>
 
 /* 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) {
        }