diff src/video/xbios/SDL_xbios.c @ 4199:4c92a3d196f1 SDL-1.2

Set video mode, allocate buffers, and enable new Milan video xbios support, need a tester now :).
author Patrice Mandin <patmandin@gmail.com>
date Sun, 20 Sep 2009 12:46:46 +0000
parents 6405314a7c07
children 907624b7a72c
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c	Sun Sep 20 12:08:51 2009 +0000
+++ b/src/video/xbios/SDL_xbios.c	Sun Sep 20 12:46:46 2009 +0000
@@ -143,7 +143,7 @@
 	const char *envr = SDL_getenv("SDL_VIDEODRIVER");
 
 	/* Milan/Hades Atari clones do not have an Atari video chip */
-	if ( (Getcookie(C__MIL, &cookie_mil) == C_FOUND) ||
+	if ( /*(Getcookie(C__MIL, &cookie_mil) == C_FOUND) ||*/
 		(Getcookie(C_hade, &cookie_hade) == C_FOUND) ) {
 		return 0;
 	}
@@ -387,6 +387,7 @@
 	/* Initialize video mode list */
 	/* and save current screen status (palette, screen address, video mode) */
 	XBIOS_centscreen = SDL_FALSE;
+	XBIOS_oldvbase = Physbase();
 
 	/* Determine the current screen size */
 	this->info.current_w = 0;
@@ -402,7 +403,6 @@
 			{
 				short *oldpalette;
 			
-				XBIOS_oldvbase=Physbase();
 				XBIOS_oldvmode=Getrez();
 				switch(XBIOS_oldvmode << 8) {
 					case ST_LOW:
@@ -425,7 +425,6 @@
 			}
 			break;
 		case VDO_TT:
-			XBIOS_oldvbase=Logbase();
 			XBIOS_oldvmode=EgetShift();
 
 			switch(XBIOS_oldvmode & ES_MODE) {
@@ -451,7 +450,6 @@
 			XBIOS_ListTTModes(this, 0);
 			break;
 		case VDO_F30:
-			XBIOS_oldvbase=Logbase();
 			XBIOS_oldvmode=VsetMode(-1);
 
 			XBIOS_oldnumcol= 1<< (1 << (XBIOS_oldvmode & NUMCOLS));
@@ -622,7 +620,13 @@
 
 	for (i=0;i<2;i++) {
 		if (XBIOS_screensmem[i]!=NULL) {
-			Mfree(XBIOS_screensmem[i]);
+			if ((XBIOS_cvdo>>16) == VDO_MILAN)) {
+				if (i==1) {
+					VsetScreen(-1, -1, MI_MAGIC, CMD_FREEPAGE);
+				}
+			} else {
+				Mfree(XBIOS_screensmem[i]);
+			}
 			XBIOS_screensmem[i]=NULL;
 		}
 	}
@@ -709,7 +713,15 @@
 
 	/* Allocate buffers */
 	for (i=0; i<num_buffers; i++) {
-		XBIOS_screensmem[i] = Atari_SysMalloc(new_screen_size, MX_STRAM);
+		if ((XBIOS_cvdo>>16) == VDO_MILAN) {
+			if (i==0) {
+				XBIOS_screensmem[i] = XBIOS_oldvbase;
+			} else {
+				XBIOS_screensmem[i] = VsetScreen(-1, new_video_mode->number, MI_MAGIC, CMD_ALLOCPAGE);
+			}
+		} else {
+			XBIOS_screensmem[i] = Atari_SysMalloc(new_screen_size, MX_STRAM);
+		}
 
 		if (XBIOS_screensmem[i]==NULL) {
 			XBIOS_FreeBuffers(this);
@@ -805,6 +817,8 @@
 			}
 			break;
 		case VDO_MILAN:
+			VsetScreen(-1, new_video_mode->number, MI_MAGIC, CMD_SETMODE);
+
 			/* Set hardware palette to black in True Colour */
 			if (new_depth > 8) {
 				SDL_memset(F30_palette, 0, sizeof(F30_palette));
@@ -1033,6 +1047,7 @@
 			}
 			break;
 		case VDO_MILAN:
+			VsetScreen(-1, &XBIOS_oldvbase, MI_MAGIC, CMD_SETADR);
 			VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_SETMODE);
 			if (XBIOS_oldnumcol) {
 				VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);