--- uae/src/picasso96.c 2018/04/24 17:16:38 1.1.1.17 +++ uae/src/picasso96.c 2018/04/24 17:18:27 1.1.1.18 @@ -91,9 +91,66 @@ static int set_panning_called = 0; SetPanning call. */ static uaecptr oldscr; +int screen_is_picasso; + static uae_u32 p2ctab[256][2]; /* + * Screen handling. + */ + +static void set_window_for_picasso (void) +{ + P96TRACE (("Function: set_window_for_picasso\n")); +#if 0 + if (current_width == picasso_vidinfo.width && current_height == picasso_vidinfo.height) + return; +#endif + + graphics_subshutdown (0); + graphics_subinit (); + + DX_SetPalette (0, 256); +} + +void gfx_set_picasso_modeinfo (int w, int h, int depth, int rgbfmt) +{ + P96TRACE (("Function: gfx_set_picasso_modeinfo w: %i h: %i depth: %i rgbfmt: %i\n", w, h, depth, rgbfmt)); + + if (screen_is_picasso + && picasso_vidinfo.width == w + && picasso_vidinfo.height == h) + return; + + picasso_vidinfo.width = w; + picasso_vidinfo.height = h; + picasso_vidinfo.depth = depth; + if (screen_is_picasso) + set_window_for_picasso (); +} + +void gfx_set_picasso_baseaddr (uaecptr a) +{ +} + +void gfx_set_picasso_state (int on) +{ + P96TRACE (("Function: gfx_set_picasso_state: %d\n", on)); + + if (on == screen_is_picasso) + return; + + graphics_subshutdown (0); + screen_is_picasso = on; + graphics_subinit (); + + if (on) + DX_SetPalette (0, 256); + else + reset_drawing (); +} + +/* * Debugging dumps */ @@ -332,8 +389,13 @@ static void CopyLibResolutionStructureU2 char *uaememptr = 0; int i; - uaememptr = gfxmem_xlate (amigamemptr); /* I know that amigamemptr is inside my gfxmem chunk, so I can just do the xlate() */ - memset (uaememptr, 0, PSSO_LibResolution_sizeof); /* zero out our LibResolution structure */ + /* I know that amigamemptr is inside my gfxmem chunk, so I can just + * do the xlate() */ + uaememptr = gfxmem_xlate (amigamemptr); + + /* zero out our LibResolution structure */ + memset (uaememptr, 0, PSSO_LibResolution_sizeof); + strcpy (uaememptr + PSSO_LibResolution_P96ID, libres->P96ID); put_long (amigamemptr + PSSO_LibResolution_DisplayID, libres->DisplayID); put_word (amigamemptr + PSSO_LibResolution_Width, libres->Width); @@ -389,7 +451,6 @@ static void AmigaListAddTail (uaecptr li * filled rectangle in the frame buffer; it can be used as a memcpy source if * there is no OS specific function to fill the rectangle. */ - static void do_fillrect (uae_u8 * src, int x, int y, int width, int height, uae_u32 pen, int Bpp, RGBFTYPE rgbtype) { @@ -2331,7 +2392,7 @@ static void write_gfx_byte (uaecptr addr static uae_u32 REGPARAM2 gfxmem_lget (uaecptr addr) { uae_u32 *m; - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; m = (uae_u32 *) (gfxmemory + addr); return do_get_mem_long (m); @@ -2340,7 +2401,7 @@ static uae_u32 REGPARAM2 gfxmem_lget (ua static uae_u32 REGPARAM2 gfxmem_wget (uaecptr addr) { uae_u16 *m; - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; m = (uae_u16 *) (gfxmemory + addr); return do_get_mem_word (m); @@ -2348,7 +2409,7 @@ static uae_u32 REGPARAM2 gfxmem_wget (ua static uae_u32 REGPARAM2 gfxmem_bget (uaecptr addr) { - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; return gfxmemory[addr]; } @@ -2356,7 +2417,7 @@ static uae_u32 REGPARAM2 gfxmem_bget (ua static void REGPARAM2 gfxmem_lput (uaecptr addr, uae_u32 l) { uae_u32 *m; - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; m = (uae_u32 *) (gfxmemory + addr); do_put_mem_long (m, l); @@ -2368,7 +2429,7 @@ static void REGPARAM2 gfxmem_lput (uaecp static void REGPARAM2 gfxmem_wput (uaecptr addr, uae_u32 w) { uae_u16 *m; - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; m = (uae_u16 *) (gfxmemory + addr); do_put_mem_word (m, (uae_u16) w); @@ -2379,7 +2440,7 @@ static void REGPARAM2 gfxmem_wput (uaecp static void REGPARAM2 gfxmem_bput (uaecptr addr, uae_u32 b) { - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; gfxmemory[addr] = b; @@ -2389,14 +2450,14 @@ static void REGPARAM2 gfxmem_bput (uaecp static int REGPARAM2 gfxmem_check (uaecptr addr, uae_u32 size) { - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; return (addr + size) < allocated_gfxmem; } static uae_u8 REGPARAM2 *gfxmem_xlate (uaecptr addr) { - addr -= gfxmem_start & gfxmem_mask; + addr -= gfxmem_start; addr &= gfxmem_mask; return gfxmemory + addr; }