]> 4ch.mooo.com Git - 16.git/commitdiff
clear video RAM using pointer set after INT 10h + vga update, not
authorJonathan Campbell <jonathan@castus.tv>
Sun, 17 Apr 2016 06:53:43 +0000 (23:53 -0700)
committerJonathan Campbell <jonathan@castus.tv>
Sun, 17 Apr 2016 06:53:43 +0000 (23:53 -0700)
before. this fixes scribbling over VGA ROM BIOS and possible DOSBox
UMB corruption.

src/lib/modex16.c

index 70e8e871b063aff8f5bc568cc0f49d6f8e00e941..cab1376675720d225ca62f6d01f1204c020a5ce4 100755 (executable)
@@ -80,7 +80,6 @@ vgaGetMode()
 void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)\r
 {\r
        word i;\r
-       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;      /* used for faster screen clearing */\r
        struct vga_mode_params cm;\r
        int CRTParmCount;\r
 \r
@@ -138,10 +137,12 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
        /* clear video memory */\r
        switch (cmem)\r
        {\r
-               case 1:\r
-               /* clear video memory */\r
-               vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
-               for(i=0; i<0x8000; i++) ptr[i] = 0x0000;\r
+               case 1: {\r
+                       /* clear video memory */\r
+                       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;      /* used for faster screen clearing */\r
+                       vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
+                       for(i = 0;i < 0x4000; i++) ptr[i] = 0x0000; // 0x4000 x dword = 64KB\r
+               }\r
                break;\r
        }\r
        gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH;\r