diff --git a/src/floppy/fdd_86f.c b/src/floppy/fdd_86f.c index f0326d3d3..5ff02adb3 100644 --- a/src/floppy/fdd_86f.c +++ b/src/floppy/fdd_86f.c @@ -235,7 +235,6 @@ static d86f_t *d86f[FDD_NUM]; static uint16_t CRCTable[256]; static fdc_t *d86f_fdc; uint64_t poly = 0x42F0E1EBA9EA3693ll; /* ECMA normal */ -uint64_t table[256]; uint16_t d86f_side_flags(int drive); diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index b69b345fb..716b4c5df 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -205,7 +205,7 @@ void svga_close(svga_t *svga); uint32_t svga_mask_addr(uint32_t addr, svga_t *svga); uint32_t svga_mask_changedaddr(uint32_t addr, svga_t *svga); -void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); +void svga_doblit(int wx, int wy, svga_t *svga); enum { diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 05a44f27f..9a9f7a553 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -84,7 +84,7 @@ typedef rgb_t PALETTE[256]; extern int changeframecount; extern volatile int screenshots; -extern bitmap_t *buffer32, *render_buffer; +extern bitmap_t *buffer32; extern PALETTE cgapal, cgapal_mono[6]; extern uint32_t pal_lookup[256]; @@ -150,10 +150,10 @@ extern void video_inform(int type, const video_timings_t *ptr); extern int video_get_type(void); -extern void video_setblit(void(*blit)(int,int,int,int,int,int)); +extern void video_setblit(void(*blit)(int,int,int,int)); extern void video_blend(int x, int y); -extern void video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h); -extern void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); +extern void video_blit_memtoscreen_8(int x, int y, int w, int h); +extern void video_blit_memtoscreen(int x, int y, int w, int h); extern void video_blit_complete(void); extern void video_wait_for_blit(void); extern void video_wait_for_buffer(void); @@ -353,6 +353,7 @@ extern const device_t s3_phoenix_trio64vplus_pci_device; extern const device_t s3_phoenix_trio64vplus_onboard_pci_device; extern const device_t s3_mirocrystal_20sv_964_vlb_device; extern const device_t s3_mirocrystal_20sv_964_pci_device; +extern const device_t s3_mirocrystal_20sd_864_vlb_device; extern const device_t s3_phoenix_vision864_pci_device; extern const device_t s3_phoenix_vision864_vlb_device; extern const device_t s3_phoenix_vision868_pci_device; @@ -361,8 +362,9 @@ extern const device_t s3_diamond_stealth64_pci_device; extern const device_t s3_diamond_stealth64_vlb_device; extern const device_t s3_diamond_stealth64_964_pci_device; extern const device_t s3_diamond_stealth64_964_vlb_device; -extern const device_t s3_mirovideo_40sv_968_pci_device; -extern const device_t s3_mirovideo_40sv_968_vlb_device; +extern const device_t s3_mirovideo_40sv_ergo_968_pci_device; +extern const device_t s3_phoenix_vision968_pci_device; +extern const device_t s3_phoenix_vision968_vlb_device; extern const device_t s3_spea_mercury_p64v_pci_device; extern const device_t s3_elsa_winner2000_pro_x_964_pci_device; extern const device_t s3_elsa_winner2000_pro_x_pci_device; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 24fc1be51..10e4df12e 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -577,10 +577,10 @@ vid_poll_1512(void *priv) } if (enable_overscan) { - video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); } else { - video_blit_memtoscreen_8(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen_8(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); } } @@ -1403,7 +1403,7 @@ lcdm_poll(amsvid_t *vid) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, mda->firstline, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, mda->firstline, xsize, ysize); frames++; video_res_x = mda->crtc[1]; video_res_y = mda->crtc[6]; @@ -1571,7 +1571,7 @@ lcdc_poll(amsvid_t *vid) video_force_resize_set(0); } - video_blit_memtoscreen(0, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen(0, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); } diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index a2e8ce2a1..4e9d9e152 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -514,7 +514,7 @@ compaq_plasma_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x400 resolution */ diff --git a/src/machine/m_at_t3100e_vid.c b/src/machine/m_at_t3100e_vid.c index cf012a27b..b52c8ef03 100644 --- a/src/machine/m_at_t3100e_vid.c +++ b/src/machine/m_at_t3100e_vid.c @@ -590,7 +590,7 @@ void t3100e_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x400 resolution */ diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index c51dbf03a..c54c7f0c7 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -566,17 +566,17 @@ vid_poll(void *p) if (enable_overscan) { if (pcjr->composite) - video_blit_memtoscreen(0, (pcjr->firstline - 4) << 1, 0, ((pcjr->lastline - pcjr->firstline) + 8) << 1, + video_blit_memtoscreen(0, (pcjr->firstline - 4) << 1, xsize, ((pcjr->lastline - pcjr->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (pcjr->firstline - 4) << 1, 0, ((pcjr->lastline - pcjr->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (pcjr->firstline - 4) << 1, xsize, ((pcjr->lastline - pcjr->firstline) + 8) << 1); } else { if (pcjr->composite) - video_blit_memtoscreen(8, pcjr->firstline << 1, 0, (pcjr->lastline - pcjr->firstline) << 1, + video_blit_memtoscreen(8, pcjr->firstline << 1, xsize, (pcjr->lastline - pcjr->firstline) << 1); else - video_blit_memtoscreen_8(8, pcjr->firstline << 1, 0, (pcjr->lastline - pcjr->firstline) << 1, + video_blit_memtoscreen_8(8, pcjr->firstline << 1, xsize, (pcjr->lastline - pcjr->firstline) << 1); } } diff --git a/src/machine/m_tandy.c b/src/machine/m_tandy.c index 75aa7cbeb..8de9883b7 100644 --- a/src/machine/m_tandy.c +++ b/src/machine/m_tandy.c @@ -1032,17 +1032,17 @@ vid_poll(void *priv) if (enable_overscan) { if (!dev->is_sl2 && vid->composite) - video_blit_memtoscreen(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, 0, ((vid->lastline - vid->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (vid->firstline - 4) << 1, xsize, ((vid->lastline - vid->firstline) + 8) << 1); } else { if (!dev->is_sl2 && vid->composite) - video_blit_memtoscreen(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); else - video_blit_memtoscreen_8(8, vid->firstline << 1, 0, (vid->lastline - vid->firstline) << 1, + video_blit_memtoscreen_8(8, vid->firstline << 1, xsize, (vid->lastline - vid->firstline) << 1); } } diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index c3930d29e..8e1c7029c 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -556,7 +556,7 @@ static void t1000_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x200 resolution */ diff --git a/src/unix/unix.c b/src/unix/unix.c index ec71dee84..ca2866cb4 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -2,10 +2,7 @@ #define _FILE_OFFSET_BITS 64 #define _LARGEFILE64_SOURCE 1 #endif -#define _POSIX_C_SOURCE 200809L -#ifdef __APPLE__ -#define _DARWIN_C_SOURCE 1 -#endif +#include #include #include #include @@ -20,7 +17,7 @@ #include #include #include -#include + #include <86box/86box.h> #include <86box/keyboard.h> #include <86box/mouse.h> @@ -164,10 +161,10 @@ static const uint16_t sdl_to_xt[0x200] = typedef struct sdl_blit_params { - int x, y, y1, y2, w, h; + int x, y, w, h; } sdl_blit_params; -sdl_blit_params params = { 0, 0, 0, 0, 0, 0 }; +sdl_blit_params params = { 0, 0, 0, 0 }; int blitreq = 0; void* dynld_module(const char *name, dllimp_t *table) @@ -610,7 +607,7 @@ void ui_sb_bugui(char *str) } -extern void sdl_blit(int x, int y, int y1, int y2, int w, int h); +extern void sdl_blit(int x, int y, int w, int h); typedef struct mouseinputdata { @@ -1125,8 +1122,8 @@ int main(int argc, char** argv) } if (blitreq) { - extern void sdl_blit(int x, int y, int y1, int y2, int w, int h); - sdl_blit(params.x, params.y, params.y1, params.y2, params.w, params.h); + extern void sdl_blit(int x, int y, int w, int h); + sdl_blit(params.x, params.y, params.w, params.h); } if (title_set) { diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index e5abdcd32..ee1220409 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -23,7 +23,7 @@ typedef struct sdl_blit_params { - int x, y, y1, y2, w, h; + int x, y, w, h; } sdl_blit_params; extern sdl_blit_params params; extern int blitreq; @@ -121,26 +121,24 @@ sdl_stretch(int *w, int *h, int *x, int *y) void -sdl_blit_shim(int x, int y, int y1, int y2, int w, int h) +sdl_blit_shim(int x, int y, int w, int h) { params.x = x; params.y = y; params.w = w; params.h = h; - params.y1 = y1; - params.y2 = y2; blitreq = 1; } void ui_window_title_real(); void -sdl_blit(int x, int y, int y1, int y2, int w, int h) +sdl_blit(int x, int y, int w, int h) { SDL_Rect r_src; int ret; - if (!sdl_enabled || (y1 == y2) || (h <= 0) || (render_buffer == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { + if (!sdl_enabled || (h <= 0) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { video_blit_complete(); return; } @@ -153,17 +151,17 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) else sdl_resize(resize_w, resize_h); resize_pending = 0; } - r_src.x = 0; - r_src.y = y1; + r_src.x = x; + r_src.y = y; r_src.w = w; - r_src.h = y2 - y1; - SDL_UpdateTexture(sdl_tex, &r_src, &(render_buffer->dat)[y1 * w], w * 4); + r_src.h = h; + SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), (2048 + 64) * 4); video_blit_complete(); SDL_RenderClear(sdl_render); - r_src.x = 0; - r_src.y = 0; + r_src.x = x; + r_src.y = y; r_src.w = w; r_src.h = h; @@ -367,7 +365,7 @@ sdl_init_common(int flags) } sdl_mutex = SDL_CreateMutex(); - sdl_win = SDL_CreateWindow("86Box", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, scrnsz_x, scrnsz_y, SDL_WINDOW_OPENGL); + sdl_win = SDL_CreateWindow("86Box", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, scrnsz_x, scrnsz_y, SDL_WINDOW_OPENGL | (vid_resize & 1 ? SDL_WINDOW_RESIZABLE : 0)); sdl_set_fs(video_fullscreen); if (!(video_fullscreen & 1)) { diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index dda14f48e..ef3f2c4ef 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -463,17 +463,17 @@ cga_poll(void *p) if (enable_overscan) { if (cga->composite) - video_blit_memtoscreen(0, (cga->firstline - 4) << 1, 0, ((cga->lastline - cga->firstline) + 8) << 1, + video_blit_memtoscreen(0, (cga->firstline - 4) << 1, xsize, ((cga->lastline - cga->firstline) + 8) << 1); else - video_blit_memtoscreen_8(0, (cga->firstline - 4) << 1, 0, ((cga->lastline - cga->firstline) + 8) << 1, + video_blit_memtoscreen_8(0, (cga->firstline - 4) << 1, xsize, ((cga->lastline - cga->firstline) + 8) << 1); } else { if (cga->composite) - video_blit_memtoscreen(8, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen(8, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); else - video_blit_memtoscreen_8(8, cga->firstline << 1, 0, (cga->lastline - cga->firstline) << 1, + video_blit_memtoscreen_8(8, cga->firstline << 1, xsize, (cga->lastline - cga->firstline) << 1); } } diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index ed5cd6f00..3343aaf0e 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -326,9 +326,9 @@ void colorplus_poll(void *p) } if (colorplus->cga.composite) - video_blit_memtoscreen(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); + video_blit_memtoscreen(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); else - video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); + video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8); frames++; video_res_x = xsize - 16; diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index 0a82bdee1..d971a6af4 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -340,14 +340,14 @@ compaq_cga_poll(void *p) if (enable_overscan) { if (self->cga.composite) - video_blit_memtoscreen(0, self->cga.firstline - 8, 0, (self->cga.lastline - self->cga.firstline) + 16, xsize, (self->cga.lastline - self->cga.firstline) + 16); + video_blit_memtoscreen(0, self->cga.firstline - 8, xsize, (self->cga.lastline - self->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, self->cga.firstline - 8, 0, (self->cga.lastline - self->cga.firstline) + 16, xsize, (self->cga.lastline - self->cga.firstline) + 16); + video_blit_memtoscreen_8(0, self->cga.firstline - 8, xsize, (self->cga.lastline - self->cga.firstline) + 16); } else { if (self->cga.composite) - video_blit_memtoscreen(8, self->cga.firstline, 0, self->cga.lastline - self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); + video_blit_memtoscreen(8, self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); else - video_blit_memtoscreen_8(8, self->cga.firstline, 0, self->cga.lastline - self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); + video_blit_memtoscreen_8(8, self->cga.firstline, xsize, self->cga.lastline - self->cga.firstline); } } diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 570a676d3..61cf87ee0 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -35,7 +35,7 @@ #include <86box/vid_ega.h> -void ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega); +void ega_doblit(int wx, int wy, ega_t *ega); #define BIOS_IBM_PATH "roms/video/ega/ibm_6277356_ega_card_u44_27128.bin" @@ -597,10 +597,10 @@ ega_poll(void *p) if (ega->vres) { wy = (ega->lastline - ega->firstline) << 1; - ega_doblit(ega->firstline_draw << 1, (ega->lastline_draw + 1) << 1, wx, wy, ega); + ega_doblit(wx, wy, ega); } else { wy = ega->lastline - ega->firstline; - ega_doblit(ega->firstline_draw, ega->lastline_draw + 1, wx, wy, ega); + ega_doblit(wx, wy, ega); } frames++; @@ -658,7 +658,7 @@ ega_poll(void *p) void -ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) +ega_doblit(int wx, int wy, ega_t *ega) { int y_add = (enable_overscan) ? overscan_y : 0; int x_add = (enable_overscan) ? overscan_x : 0; @@ -675,15 +675,8 @@ ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) bottom <<= 1; } - if ((wx <= 0) || (wy <= 0)) { - video_blit_memtoscreen(x_start, y_start, 0, 0, 0, 0); + if ((wx <= 0) || (wy <= 0)) return; - } - - if (y1 > y2) { - video_blit_memtoscreen(x_start, y_start, 0, 0, xsize + x_add, ysize + y_add); - return; - } if (ega->vres) ega->y_add <<= 1; @@ -734,7 +727,7 @@ ega_doblit(int y1, int y2, int wx, int wy, ega_t *ega) } } - video_blit_memtoscreen(x_start, y_start, y1, y2 + y_add, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, xsize + x_add, ysize + y_add); if (ega->vres) ega->y_add >>= 1; diff --git a/src/video/vid_f82c425.c b/src/video/vid_f82c425.c index ab8b12299..a9d2f14ba 100644 --- a/src/video/vid_f82c425.c +++ b/src/video/vid_f82c425.c @@ -584,7 +584,7 @@ static void f82c425_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; /* Fixed 640x200 resolution */ diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index c054230b1..57854a051 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -689,7 +689,7 @@ genius_poll(void *p) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* Fixed 728x1008 resolution */ diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 4e1d4e8b9..6c9660bb8 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -517,9 +517,9 @@ hercules_poll(void *priv) } if (enable_overscan) - video_blit_memtoscreen_8(0, dev->firstline, 0, ysize + 28, xsize + 16, ysize + 28); + video_blit_memtoscreen_8(0, dev->firstline, xsize + 16, ysize + 28); else - video_blit_memtoscreen_8(8, dev->firstline + 14, 0, ysize + 14, xsize, ysize); + video_blit_memtoscreen_8(8, dev->firstline + 14, xsize, ysize); frames++; // if ((dev->ctrl & 2) && (dev->ctrl2 & 1)) { if (dev->ctrl & 0x02) { diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index df5b01da0..607780a68 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -581,7 +581,7 @@ herculesplus_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, dev->firstline, 0, dev->lastline - dev->firstline, xsize, dev->lastline - dev->firstline); + video_blit_memtoscreen_8(0, dev->firstline, xsize, dev->lastline - dev->firstline); frames++; if ((dev->ctrl & HERCULESPLUS_CTRL_GRAPH) && (dev->ctrl2 & HERCULESPLUS_CTRL2_GRAPH)) { video_res_x = dev->crtc[1] * 16; diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 8b644077e..64d93a5c0 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -998,7 +998,7 @@ incolor_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, dev->firstline, 0, dev->lastline - dev->firstline, xsize, dev->lastline - dev->firstline); + video_blit_memtoscreen(0, dev->firstline, xsize, dev->lastline - dev->firstline); frames++; if ((dev->ctrl & INCOLOR_CTRL_GRAPH) && (dev->ctrl2 & INCOLOR_CTRL2_GRAPH)) { video_res_x = dev->crtc[1] * 16; diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index c05744b01..f2550f134 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -230,7 +230,7 @@ void mda_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, mda->firstline, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, mda->firstline, xsize, ysize); frames++; video_res_x = mda->crtc[1]; video_res_y = mda->crtc[6]; diff --git a/src/video/vid_nga.c b/src/video/vid_nga.c index 66c09d744..1c34db342 100644 --- a/src/video/vid_nga.c +++ b/src/video/vid_nga.c @@ -474,17 +474,17 @@ nga_poll(void *priv) /* nga specific */ if (enable_overscan) { if (nga->cga.composite) - video_blit_memtoscreen(0, (nga->cga.firstline - 8), 0, (nga->cga.lastline - nga->cga.firstline) + 16, + video_blit_memtoscreen(0, (nga->cga.firstline - 8), xsize, (nga->cga.lastline - nga->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, (nga->cga.firstline - 8), 0, (nga->cga.lastline - nga->cga.firstline) + 16, + video_blit_memtoscreen_8(0, (nga->cga.firstline - 8), xsize, (nga->cga.lastline - nga->cga.firstline) + 16); } else { if (nga->cga.composite) - video_blit_memtoscreen(8, nga->cga.firstline, 0, (nga->cga.lastline - nga->cga.firstline), + video_blit_memtoscreen(8, nga->cga.firstline, xsize, (nga->cga.lastline - nga->cga.firstline)); else - video_blit_memtoscreen_8(8, nga->cga.firstline, 0, (nga->cga.lastline - nga->cga.firstline), + video_blit_memtoscreen_8(8, nga->cga.firstline, xsize, (nga->cga.lastline - nga->cga.firstline)); } } diff --git a/src/video/vid_ogc.c b/src/video/vid_ogc.c index cdc433bdf..c562c6f11 100644 --- a/src/video/vid_ogc.c +++ b/src/video/vid_ogc.c @@ -489,17 +489,17 @@ ogc_poll(void *priv) /* ogc specific */ if (enable_overscan) { if (ogc->cga.composite) - video_blit_memtoscreen(0, (ogc->cga.firstline - 8), 0, (ogc->cga.lastline - ogc->cga.firstline) + 16, + video_blit_memtoscreen(0, (ogc->cga.firstline - 8), xsize, (ogc->cga.lastline - ogc->cga.firstline) + 16); else - video_blit_memtoscreen_8(0, (ogc->cga.firstline - 8), 0, (ogc->cga.lastline - ogc->cga.firstline) + 16, + video_blit_memtoscreen_8(0, (ogc->cga.firstline - 8), xsize, (ogc->cga.lastline - ogc->cga.firstline) + 16); } else { if (ogc->cga.composite) - video_blit_memtoscreen(8, ogc->cga.firstline, 0, (ogc->cga.lastline - ogc->cga.firstline), + video_blit_memtoscreen(8, ogc->cga.firstline, xsize, (ogc->cga.lastline - ogc->cga.firstline)); else - video_blit_memtoscreen_8(8, ogc->cga.firstline, 0, (ogc->cga.lastline - ogc->cga.firstline), + video_blit_memtoscreen_8(8, ogc->cga.firstline, xsize, (ogc->cga.lastline - ogc->cga.firstline)); } } diff --git a/src/video/vid_pgc.c b/src/video/vid_pgc.c index 213d85f6a..34e5c2d99 100644 --- a/src/video/vid_pgc.c +++ b/src/video/vid_pgc.c @@ -2493,7 +2493,7 @@ pgc_cga_poll(pgc_t *dev) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* We have a fixed 640x400 screen for CGA modes. */ @@ -2578,7 +2578,7 @@ pgc_poll(void *priv) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen(0, 0, xsize, ysize); frames++; video_res_x = dev->screenw; diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 98f85a9f5..24a322d25 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -46,6 +46,7 @@ #define ROM_MIROCRYSTAL10SD_805 "roms/video/s3/MIROcrystal10SD_VLB.VBI" #define ROM_MIROCRYSTAL20SV_964_VLB "roms/video/s3/S3_964VL_BT485_27C256_miroCRYSTAL_20sv_ver1.2.bin" #define ROM_MIROCRYSTAL20SV_964_PCI "roms/video/s3/mirocrystal.VBI" +#define ROM_MIROCRYSTAL20SD_864_VLB "roms/video/s3/Miro20SD.BIN" #define ROM_PHOENIX_86C80X "roms/video/s3/805.vbi" #define ROM_PARADISE_BAHAMAS64 "roms/video/s3/bahamas64.bin" #define ROM_PHOENIX_VISION864 "roms/video/s3/86c864p.bin" @@ -61,8 +62,9 @@ #define ROM_ELSAWIN2KPROX_964 "roms/video/s3/elsaw20004m.BIN" #define ROM_ELSAWIN2KPROX "roms/video/s3/elsaw20008m.BIN" #define ROM_PHOENIX_VISION868 "roms/video/s3/1-DSV3868.BIN" -#define ROM_MIROVIDEO40SV_968 "roms/video/s3/S3_968PCI_TVP3026_miroVideo40SV_PCI_1.04.BIN" +#define ROM_MIROVIDEO40SV_ERGO_968_PCI "roms/video/s3/S3_968PCI_TVP3026_miroVideo40SV_PCI_1.04.BIN" #define ROM_SPEA_MERCURY_P64V "roms/video/s3/S3_968PCI_TVP3026_SPEAMecuryP64V_ver1.01.BIN" +#define ROM_PHOENIX_VISION968 "roms/video/s3/1-DSV3968P.BIN" enum { @@ -90,11 +92,13 @@ enum S3_ELSAWIN2KPROX_964, S3_ELSAWIN2KPROX, S3_PHOENIX_VISION868, - S3_MIROVIDEO40SV_968, + S3_MIROVIDEO40SV_ERGO_968, S3_MIROCRYSTAL10SD_805, S3_SPEA_MIRAGE_P64, S3_SPEA_MERCURY_P64V, - S3_MIROCRYSTAL20SV_964 + S3_MIROCRYSTAL20SV_964, + S3_MIROCRYSTAL20SD_864, + S3_PHOENIX_VISION968 }; @@ -254,6 +258,12 @@ typedef struct s3_t int ssv_len1, ssv_len2; uint8_t ssv_dir1, ssv_dir2; uint8_t ssv_draw1, ssv_draw2; + + /*S3 928 and 80x cards only*/ + int setup_fifo_slot, setup_fifo_slot2; + int draw_fifo_slot, draw_fifo_slot2; + int port_slot1, port_slot2; + int port_slot3, port_slot4; } accel; struct { @@ -472,14 +482,16 @@ s3_cpu_dest(s3_t *s3) static int s3_enable_fifo(s3_t *s3) { + svga_t *svga = &s3->svga; + if ((s3->chip == S3_TRIO32) || (s3->chip == S3_TRIO64) || (s3->chip == S3_TRIO64V) || (s3->chip == S3_TRIO64V2) || (s3->chip == S3_VISION864) || (s3->chip == S3_VISION964) || (s3->chip == S3_VISION968) || (s3->chip == S3_VISION868)) return 1; /* FIFO always enabled on these chips. */ - //return !!((svga->crtc[0x40] & 0x08) || (s3->accel.advfunc_cntl & 0x40)); - return 0; /*Disable FIFO on pre-964 cards due to glitches going around*/ + return !!((svga->crtc[0x40] & 0x08) || (s3->accel.advfunc_cntl & 0x40)); + //return 0; /*Disable FIFO on pre-964 cards due to glitches going around*/ } static void @@ -488,6 +500,12 @@ s3_accel_out_pixtrans_w(s3_t *s3, uint16_t val) svga_t *svga = &s3->svga; if (s3->accel.cmd & 0x100) { + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -547,6 +565,10 @@ s3_accel_out_pixtrans_w(s3_t *s3, uint16_t val) } break; } + + if ((s3_enable_fifo(s3) && s3->chip >= S3_VISION964) || (s3_enable_fifo(s3) == 0)) { + s3->accel.draw_fifo_slot = 0; + } } } @@ -554,6 +576,12 @@ static void s3_accel_out_pixtrans_l(s3_t *s3, uint32_t val) { if (s3->accel.cmd & 0x100) { + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -613,6 +641,10 @@ s3_accel_out_pixtrans_l(s3_t *s3, uint32_t val) } break; } + + if ((s3_enable_fifo(s3) && s3->chip >= S3_VISION964) || (s3_enable_fifo(s3) == 0)) { + s3->accel.draw_fifo_slot = 0; + } } } @@ -623,6 +655,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) switch (port) { case 0x8148: case 0x82e8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.cur_y_bitres = (s3->accel.cur_y_bitres & 0xff00) | val; s3->accel.cur_y = (s3->accel.cur_y & 0xf00) | val; s3->accel.poly_cy = s3->accel.cur_y; @@ -643,6 +681,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x8548: case 0x86e8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.cur_x_bitres = (s3->accel.cur_x_bitres & 0xff00) | val; s3->accel.cur_x = (s3->accel.cur_x & 0xf00) | val; s3->accel.poly_cx = s3->accel.cur_x << 20; @@ -665,6 +709,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x8948: case 0x8ae8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.desty_axstp = (s3->accel.desty_axstp & 0x3f00) | val; s3->accel.point_1_updated = 1; break; @@ -686,6 +736,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x8d48: case 0x8ee8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.destx_distp = (s3->accel.destx_distp & 0x3f00) | val; s3->accel.point_1_updated = 1; break; @@ -705,6 +761,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x9148: case 0x92e8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.err_term = (s3->accel.err_term & 0x3f00) | val; break; case 0x9149: case 0x92e9: @@ -722,6 +784,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x9548: case 0x96e8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.maj_axis_pcnt = (s3->accel.maj_axis_pcnt & 0xf00) | val; break; case 0x9459: case 0x96e9: @@ -739,6 +807,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0x9948: case 0x9ae8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; s3->accel.cmd = (s3->accel.cmd & 0xff00) | val; s3->data_available = 0; s3->accel.b2e8_pix = 0; @@ -768,6 +842,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xa148: case 0xa2e8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; if (s3->bpp == 3 && s3->accel.multifunc[0xe] & 0x10 && !(s3->accel.multifunc[0xe] & 0x200)) s3->accel.bkgd_color = (s3->accel.bkgd_color & ~0x00ff0000) | (val << 16); else @@ -804,6 +884,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xa548: case 0xa6e8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; if (s3->bpp == 3 && s3->accel.multifunc[0xe] & 0x10 && !(s3->accel.multifunc[0xe] & 0x200)) s3->accel.frgd_color = (s3->accel.frgd_color & ~0x00ff0000) | (val << 16); else @@ -840,6 +926,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xa948: case 0xaae8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; if (s3->bpp == 3 && s3->accel.multifunc[0xe] & 0x10 && !(s3->accel.multifunc[0xe] & 0x200)) s3->accel.wrt_mask = (s3->accel.wrt_mask & ~0x00ff0000) | (val << 16); else @@ -876,6 +968,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xad48: case 0xaee8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; if (s3->bpp == 3 && s3->accel.multifunc[0xe] & 0x10 && !(s3->accel.multifunc[0xe] & 0x200)) s3->accel.rd_mask = (s3->accel.rd_mask & ~0x00ff0000) | (val << 16); else @@ -912,6 +1010,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xb148: case 0xb2e8: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; if (s3->bpp == 3 && s3->accel.multifunc[0xe] & 0x10 && !(s3->accel.multifunc[0xe] & 0x200)) s3->accel.color_cmp = (s3->accel.color_cmp & ~0x00ff0000) | (val << 16); else @@ -948,10 +1052,22 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; case 0xb548: case 0xb6e8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; s3->accel.bkgd_mix = val; break; case 0xb948: case 0xbae8: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; s3->accel.frgd_mix = val; break; @@ -961,6 +1077,24 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) case 0xbd49: case 0xbee9: s3->accel.multifunc_cntl = (s3->accel.multifunc_cntl & 0xff) | (val << 8); s3->accel.multifunc[s3->accel.multifunc_cntl >> 12] = s3->accel.multifunc_cntl & 0xfff; + switch (s3->accel.multifunc_cntl >> 12) { + case 0: + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + break; + case 0xa: + s3->accel.port_slot3++; + s3->accel.port_slot4++; + if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot++; + if (s3->accel.setup_fifo_slot > 8) + s3->accel.setup_fifo_slot = 1; + break; + } break; case 0xd148: case 0xd2e8: @@ -1058,6 +1192,12 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) break; s3->accel.pix_trans[0] = val; if (s3->accel.cmd & 0x100) { + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; if (!(s3->accel.cmd & 0x600)) { if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { if (((s3->accel.frgd_mix & 0x60) != 0x40) || ((s3->accel.bkgd_mix & 0x60) != 0x40)) @@ -1194,6 +1334,13 @@ s3_accel_out_fifo(s3_t *s3, uint16_t port, uint8_t val) } break; } + + if ((s3_enable_fifo(s3) && s3->chip >= S3_VISION964) || (s3_enable_fifo(s3) == 0)) { + if (s3->accel.port_slot1 || s3->accel.port_slot2) { + s3->accel.draw_fifo_slot = 0; + } else if (s3->accel.port_slot3 || s3->accel.port_slot4) + s3->accel.setup_fifo_slot = 0; + } } static void @@ -1374,6 +1521,13 @@ s3_accel_write_fifo(s3_t *s3, uint32_t addr, uint8_t val) s3_accel_out_fifo(s3, addr & 0xffff, val); } else { if (s3->accel.cmd & 0x100) { + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + if ((s3->accel.cmd & 0x600) == 0x200) { if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { if (((s3->accel.frgd_mix & 0x60) != 0x40) || ((s3->accel.bkgd_mix & 0x60) != 0x40)) @@ -1391,6 +1545,9 @@ s3_accel_write_fifo(s3_t *s3, uint32_t addr, uint8_t val) } else s3_accel_start(1, 1, 0xffffffff, val | (val << 8) | (val << 16) | (val << 24), s3); } + if ((s3_enable_fifo(s3) && s3->chip >= S3_VISION964) || (s3_enable_fifo(s3) == 0)) { + s3->accel.draw_fifo_slot = 0; + } } } } @@ -2176,8 +2333,9 @@ s3_io_set_alt(s3_t *s3) if (!s3->translate) return; - if ((s3->chip == S3_VISION968 || s3->chip == S3_VISION868) && (svga->seqregs[9] & 0x80)) + if ((s3->chip == S3_VISION968 || s3->chip == S3_VISION868) && (svga->seqregs[9] & 0x80)) { return; + } io_sethandler(0x4148, 0x0002, s3_accel_in, NULL, NULL, s3_accel_out, NULL, NULL, s3); io_sethandler(0x4548, 0x0002, s3_accel_in, NULL, NULL, s3_accel_out, NULL, NULL, s3); @@ -2234,8 +2392,9 @@ s3_io_set(s3_t *s3) io_sethandler(0x03c0, 0x0020, s3_in, NULL, NULL, s3_out, NULL, NULL, s3); - if ((s3->chip == S3_VISION968 || s3->chip == S3_VISION868) && (svga->seqregs[9] & 0x80)) + if ((s3->chip == S3_VISION968 || s3->chip == S3_VISION868) && (svga->seqregs[9] & 0x80)) { return; + } io_sethandler(0x42e8, 0x0002, s3_accel_in, NULL, NULL, s3_accel_out, NULL, NULL, s3); io_sethandler(0x46e8, 0x0002, s3_accel_in, NULL, NULL, s3_accel_out, NULL, NULL, s3); @@ -2355,9 +2514,10 @@ s3_out(uint16_t addr, uint8_t val, void *p) else rs3 = 0; bt48x_ramdac_out(addr, rs2, rs3, val, svga->ramdac, svga); - } else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && s3->card_type == S3_ELSAWIN2KPROX)) + } else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && (s3->card_type == S3_ELSAWIN2KPROX || + s3->card_type == S3_PHOENIX_VISION968))) ibm_rgb528_ramdac_out(addr, rs2, val, svga->ramdac, svga); - else if ((s3->chip == S3_VISION968 && (s3->card_type == S3_MIROVIDEO40SV_968 || s3->card_type == S3_SPEA_MERCURY_P64V))) { + else if ((s3->chip == S3_VISION968 && (s3->card_type == S3_SPEA_MERCURY_P64V || s3->card_type == S3_MIROVIDEO40SV_ERGO_968))) { rs3 = !!(svga->crtc[0x55] & 0x02); tvp3026_ramdac_out(addr, rs2, rs3, val, svga->ramdac, svga); } else if (((s3->chip == S3_86C801) || (s3->chip == S3_86C805)) && (s3->card_type != S3_MIROCRYSTAL10SD_805)) @@ -2384,7 +2544,7 @@ s3_out(uint16_t addr, uint8_t val, void *p) return; if ((svga->crtcreg == 0x36) && (svga->crtc[0x39] != 0xa5)) return; - if (s3->chip == S3_TRIO64V2 && svga->crtcreg >= 0x80) + if ((s3->chip == S3_TRIO64V2) && svga->crtcreg >= 0x80) return; old = svga->crtc[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; @@ -2419,6 +2579,19 @@ s3_out(uint16_t addr, uint8_t val, void *p) } s3->bpp = (svga->crtc[0x50] >> 4) & 3; break; + + case 0x5c: + if ((val & 0xa0) == 0x80) + i2c_gpio_set(s3->i2c, !!(val & 0x40), !!(val & 0x10)); + if (s3->card_type == S3_PHOENIX_VISION868 || s3->card_type == S3_PHOENIX_VISION968) { + if ((val & 0x20) && (!(svga->crtc[0x55] & 0x01) && !(svga->crtc[0x43] & 2))) + svga->dac_addr |= 0x20; + } else if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968) { + if ((val & 0x80) && (!(svga->crtc[0x55] & 0x01) && !(svga->crtc[0x43] & 2))) + svga->dac_addr |= 0x02; + } + break; + case 0x69: if (s3->chip >= S3_VISION964) s3->ma_ext = val & 0x1f; @@ -2445,6 +2618,7 @@ s3_out(uint16_t addr, uint8_t val, void *p) else s3->ma_ext = (s3->ma_ext & ~0xc) | ((val & 3) << 2); break; + case 0x6a: if (s3->chip >= S3_VISION964) { s3->bank = val; @@ -2531,11 +2705,6 @@ s3_out(uint16_t addr, uint8_t val, void *p) } break; - case 0x5c: - if ((val & 0xa0) == 0x80) - i2c_gpio_set(s3->i2c, !!(val & 0x40), !!(val & 0x10)); - break; - case 0x42: if ((s3->chip == S3_VISION964) || (s3->chip == S3_VISION968) || (s3->chip == S3_86C928)) { if (((svga->miscout >> 2) & 3) == 3) @@ -2630,9 +2799,10 @@ s3_in(uint16_t addr, void *p) else if ((s3->chip == S3_VISION964 && s3->card_type != S3_ELSAWIN2KPROX_964) || (s3->chip == S3_86C928)) { rs3 = !!(svga->crtc[0x55] & 0x02); return bt48x_ramdac_in(addr, rs2, rs3, svga->ramdac, svga); - } else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && s3->card_type == S3_ELSAWIN2KPROX)) + } else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && (s3->card_type == S3_ELSAWIN2KPROX || + s3->card_type == S3_PHOENIX_VISION968))) return ibm_rgb528_ramdac_in(addr, rs2, svga->ramdac, svga); - else if ((s3->chip == S3_VISION968 && (s3->card_type == S3_MIROVIDEO40SV_968 || s3->card_type == S3_SPEA_MERCURY_P64V))) { + else if ((s3->chip == S3_VISION968 && (s3->card_type == S3_SPEA_MERCURY_P64V || s3->card_type == S3_MIROVIDEO40SV_ERGO_968))) { rs3 = !!(svga->crtc[0x55] & 0x02); return tvp3026_ramdac_in(addr, rs2, rs3, svga->ramdac, svga); } else if (((s3->chip == S3_86C801) || (s3->chip == S3_86C805)) && (s3->card_type != S3_MIROCRYSTAL10SD_805)) @@ -2655,7 +2825,10 @@ s3_in(uint16_t addr, void *p) case 0x31: return (svga->crtc[0x31] & 0xcf) | ((s3->ma_ext & 3) << 4); case 0x35: return (svga->crtc[0x35] & 0xf0) | (s3->bank & 0xf); case 0x45: s3->hwc_col_stack_pos = 0; break; - case 0x51: return (svga->crtc[0x51] & 0xf0) | ((s3->bank >> 2) & 0xc) | ((s3->ma_ext >> 2) & 3); + case 0x51: + if (s3->chip == S3_86C801 || s3->chip == S3_86C805) + return (svga->crtc[0x51] & 0xfa) | ((s3->bank >> 2) & 0x4) | ((s3->ma_ext >> 2) & 1); + return (svga->crtc[0x51] & 0xf0) | ((s3->bank >> 2) & 0xc) | ((s3->ma_ext >> 2) & 3); case 0x5c: /* General Output Port Register */ temp = svga->crtc[svga->crtcreg] & 0xa0; if (((svga->miscout >> 2) & 3) == 3) @@ -2674,7 +2847,7 @@ s3_in(uint16_t addr, void *p) /* Phoenix S3 video BIOS'es seem to expect CRTC registers 6B and 6C to be mirrors of 59 and 5A. */ case 0x6b: - if (s3->chip != S3_TRIO64V2 && s3->card_type != S3_MIROVIDEO40SV_968) { + if (s3->chip != S3_TRIO64V2) { if (svga->crtc[0x53] & 0x08) { return (s3->chip == S3_TRIO64V) ? (svga->crtc[0x59] & 0xfc) : (svga->crtc[0x59] & 0xfe); } else { @@ -2684,10 +2857,10 @@ s3_in(uint16_t addr, void *p) return svga->crtc[0x6b]; break; case 0x6c: - if (s3->chip != S3_TRIO64V2 && s3->card_type != S3_MIROVIDEO40SV_968) { - if (svga->crtc[0x53] & 0x08) + if (s3->chip != S3_TRIO64V2) { + if (svga->crtc[0x53] & 0x08) { return 0x00; - else + } else return (svga->crtc[0x5a] & 0x80); } else return svga->crtc[0x6c]; @@ -2728,7 +2901,7 @@ static void s3_recalctimings(svga_t *svga) else bt48x_recalctimings(svga->ramdac, svga); } else if (s3->chip == S3_VISION968) { - if (s3->card_type == S3_MIROVIDEO40SV_968 || s3->card_type == S3_SPEA_MERCURY_P64V) + if (s3->card_type == S3_SPEA_MERCURY_P64V || s3->card_type == S3_MIROVIDEO40SV_ERGO_968) tvp3026_recalctimings(svga->ramdac, svga); else ibm_rgb528_recalctimings(svga->ramdac, svga); @@ -2748,10 +2921,7 @@ static void s3_recalctimings(svga_t *svga) svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)); - if (((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) || (svga->crtc[0x3a] & 0x10)) { - pclog("CRTC14 bit 6 byte mode = %02x, CRTC17 bit 6 byte mode = %02x, CRTC17 bit 5 word mode ma15 = %02x, CRTC31 bit 3 dword mode = %02x\n", - svga->crtc[0x14] & 0x40, svga->crtc[0x17] & 0x40, svga->crtc[0x17] & 0x20, svga->crtc[0x31] & 0x08); - + if (((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) || (svga->crtc[0x3a] & 0x10)) { if (svga->crtc[0x31] & 0x08) /*This would typically force dword mode, but we are encountering accel bugs with it, so force byte mode instead*/ svga->force_byte_mode = 1; else @@ -2773,11 +2943,13 @@ static void s3_recalctimings(svga_t *svga) svga->hdisp *= 2; } - if (s3->card_type == S3_MIROVIDEO40SV_968) { + if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968 || s3->card_type == S3_MIROCRYSTAL20SD_864 || + s3->card_type == S3_PHOENIX_VISION968 || s3->card_type == S3_SPEA_MERCURY_P64V) { if (svga->hdisp != 1408) svga->hdisp = s3->width; } if (s3->card_type == S3_MIROCRYSTAL10SD_805) { + pclog("S3 CRTC51 = %02x, CRTC5D = %02x, CRTC5E = %02x, CRTC35 = %02x\n", svga->crtc[0x51], svga->crtc[0x5d], svga->crtc[0x5e], svga->crtc[0x35]); if (svga->rowoffset == 256 && ((svga->crtc[0x51] & 0x30) == 0x00 && !(svga->crtc[0x43] & 0x04))) svga->rowoffset >>= 1; } @@ -2799,6 +2971,16 @@ static void s3_recalctimings(svga_t *svga) if (s3->width == 1280 || s3->width == 1600) svga->hdisp *= 2; } + if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968 || s3->card_type == S3_PHOENIX_VISION968 || + s3->card_type == S3_SPEA_MERCURY_P64V) { + if (svga->hdisp == (1408*2)) + svga->hdisp /= 2; + else + svga->hdisp = s3->width; + } + + if (s3->card_type == S3_SPEA_MIRAGE_86C801 || s3->card_type == S3_SPEA_MIRAGE_86C805) + svga->hdisp = s3->width; break; case 16: svga->render = svga_render_16bpp_highres; @@ -2818,7 +3000,8 @@ static void s3_recalctimings(svga_t *svga) if (s3->width == 1280 || s3->width == 1600) svga->hdisp *= 2; } - if (s3->card_type == S3_MIROVIDEO40SV_968) { + if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968 || s3->card_type == S3_PHOENIX_VISION968 || + s3->card_type == S3_SPEA_MERCURY_P64V) { if (svga->hdisp == (1408*2)) svga->hdisp /= 2; else @@ -2836,7 +3019,8 @@ static void s3_recalctimings(svga_t *svga) else svga->hdisp = (svga->hdisp * 2) / 3; } else { - if (s3->card_type == S3_MIROVIDEO40SV_968) + if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968 || s3->card_type == S3_PHOENIX_VISION968 || + s3->card_type == S3_SPEA_MERCURY_P64V) svga->hdisp = s3->width; } break; @@ -2851,7 +3035,9 @@ static void s3_recalctimings(svga_t *svga) } if (s3->width == 1280 || s3->width == 1600 || (s3->card_type == S3_SPEA_MERCURY_P64V)) svga->hdisp *= 2; - if (s3->card_type == S3_MIROVIDEO40SV_968 || s3->card_type == S3_MIROCRYSTAL20SV_964) + if (s3->card_type == S3_MIROVIDEO40SV_ERGO_968 || s3->card_type == S3_MIROCRYSTAL20SV_964 || + s3->card_type == S3_MIROCRYSTAL20SD_864 || s3->card_type == S3_PHOENIX_VISION968 || + s3->card_type == S3_SPEA_MERCURY_P64V) svga->hdisp = s3->width; break; } @@ -3096,7 +3282,7 @@ s3_updatemapping(s3_t *s3) mem_mapping_enable(&s3->mmio_mapping); } else mem_mapping_disable(&s3->mmio_mapping); - + /* New MMIO. */ if (svga->crtc[0x53] & 0x08) mem_mapping_set_addr(&s3->new_mmio_mapping, s3->linear_base + 0x1000000, 0x20000); @@ -3133,7 +3319,10 @@ s3_accel_out(uint16_t port, uint8_t val, void *p) if (port >= 0x8000) { if (s3_enable_fifo(s3)) { - s3_queue(s3, port, val, FIFO_OUT_BYTE); + if (s3->chip <= S3_86C805) + s3_accel_out_fifo(s3, port, val); + else + s3_queue(s3, port, val, FIFO_OUT_BYTE); } else { s3_accel_out_fifo(s3, port, val); } @@ -3179,9 +3368,12 @@ s3_accel_out_w(uint16_t port, uint16_t val, void *p) if (!s3->enable_8514) return; - if (s3_enable_fifo(s3)) - s3_queue(s3, port, val, FIFO_OUT_WORD); - else + if (s3_enable_fifo(s3)) { + if (s3->chip <= S3_86C805) + s3_accel_out_fifo_w(s3, port, val); + else + s3_queue(s3, port, val, FIFO_OUT_WORD); + } else s3_accel_out_fifo_w(s3, port, val); } @@ -3193,9 +3385,12 @@ s3_accel_out_l(uint16_t port, uint32_t val, void *p) if (!s3->enable_8514) return; - if (s3_enable_fifo(s3)) - s3_queue(s3, port, val, FIFO_OUT_DWORD); - else + if (s3_enable_fifo(s3)) { + if (s3->chip <= S3_86C805) + s3_accel_out_fifo_l(s3, port, val); + else + s3_queue(s3, port, val, FIFO_OUT_DWORD); + } else s3_accel_out_fifo_l(s3, port, val); } @@ -3217,6 +3412,7 @@ s3_accel_in(uint16_t port, void *p) case 0x8148: case 0x82e8: s3_wait_fifo_idle(s3); + return s3->accel.cur_y & 0xff; case 0x8149: case 0x82e9: s3_wait_fifo_idle(s3); @@ -3278,29 +3474,122 @@ s3_accel_in(uint16_t port, void *p) case 0x8118: case 0x9948: case 0x9ae8: temp = 0; /* FIFO empty */ - if (!s3->blitter_busy) + if (!s3->blitter_busy && s3->chip >= S3_VISION964) wake_fifo_thread(s3); if (FIFO_FULL && (s3->chip >= S3_VISION964)) temp = 0xff; /*FIFO full*/ - return temp; /*FIFO empty*/ + else if (s3->chip <= S3_86C805) { + if (s3_enable_fifo(s3)) { + if (s3->accel.port_slot3) { + if (s3->accel.setup_fifo_slot) { + switch (s3->accel.setup_fifo_slot) { + case 1: + temp = 1; + break; + case 2: + temp = 3; + break; + case 3: + temp = 7; + break; + case 4: + temp = 0x0f; + break; + case 5: + temp = 0x1f; + break; + case 6: + temp = 0x3f; + break; + case 7: + temp = 0x7f; + break; + case 8: + temp = 0xff; + break; + } + } + + s3->accel.setup_fifo_slot2 = s3->accel.setup_fifo_slot; + s3->accel.setup_fifo_slot = 0; + s3->accel.port_slot3 = 0; + } else if (s3->accel.port_slot1) { + if (s3->accel.draw_fifo_slot) { + switch (s3->accel.draw_fifo_slot) { + case 1: + temp = 1; + break; + case 2: + temp = 3; + break; + case 3: + temp = 7; + break; + case 4: + temp = 0x0f; + break; + case 5: + temp = 0x1f; + break; + case 6: + temp = 0x3f; + break; + case 7: + temp = 0x7f; + break; + case 8: + temp = 0xff; + break; + } + } + + s3->accel.draw_fifo_slot2 = s3->accel.draw_fifo_slot; + s3->accel.draw_fifo_slot = 0; + s3->accel.port_slot1 = 0; + } + } + } + return temp; case 0x8119: case 0x9949: case 0x9ae9: - if (!s3->blitter_busy) + if (!s3->blitter_busy && s3->chip >= S3_VISION964) wake_fifo_thread(s3); temp = 0; - if ((s3->chip >= S3_86C928) && s3_enable_fifo(s3)) { - if (!FIFO_EMPTY || s3->force_busy) { - temp |= 0x02; /*Hardware busy*/ + if (s3_enable_fifo(s3)) { + if (s3->chip >= S3_VISION964) { + if (!FIFO_EMPTY || s3->force_busy) { + temp |= 0x02; /*Hardware busy*/ + } else { + temp |= 0x04; /*FIFO empty*/ + } + s3->force_busy = 0; + if (FIFO_FULL) + temp |= 0xf8; /*FIFO full*/ } else { - temp |= 0x04; /*FIFO empty*/ + if (s3->force_busy) { + temp |= 0x02; /*Hardware busy*/ + } else { + if (s3->accel.port_slot2) { + s3->accel.port_slot2 = 0; + if (!s3->accel.draw_fifo_slot2) + temp |= 0x04; /*FIFO empty*/ + if (s3->accel.draw_fifo_slot2) + s3->accel.draw_fifo_slot2 = 0; + } else if (s3->accel.port_slot4) { + s3->accel.port_slot4 = 0; + if (!s3->accel.setup_fifo_slot2) + temp |= 0x04; /*FIFO empty*/ + if (s3->accel.setup_fifo_slot2) + s3->accel.setup_fifo_slot2 = 0; + } + } + + s3->force_busy = 0; + if (s3->data_available) { + temp |= 0x01; /*Read Data available*/ + s3->data_available = 0; + } } - s3->force_busy = 0; - if (s3->data_available && (s3->chip <= S3_86C805)) { - temp |= 0x01; /*Read Data available*/ - s3->data_available = 0; - } - if (FIFO_FULL && s3->chip >= S3_VISION964) - temp |= 0xf8; /*FIFO full*/ } else { if (s3->force_busy) { temp |= 0x02; /*Hardware busy*/ @@ -3537,6 +3826,12 @@ s3_accel_in(uint16_t port, void *p) break; READ_PIXTRANS_BYTE_IO(0) if (s3->accel.cmd & 0x100) { + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -3631,6 +3926,10 @@ s3_accel_in(uint16_t port, void *p) return temp; } + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } + return 0xff; } @@ -3648,6 +3947,13 @@ s3_accel_in_w(uint16_t port, void *p) if (s3_cpu_dest(s3)) { READ_PIXTRANS_WORD + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -3668,6 +3974,10 @@ s3_accel_in_w(uint16_t port, void *p) s3_accel_start(2, 1, 0xffffffff, temp | (temp << 16), s3); break; } + + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } } return temp; } @@ -3686,6 +3996,13 @@ s3_accel_in_l(uint16_t port, void *p) if (s3_cpu_dest(s3)) { READ_PIXTRANS_LONG + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -3716,6 +4033,10 @@ s3_accel_in_l(uint16_t port, void *p) } break; } + + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } } return temp; @@ -3731,11 +4052,15 @@ s3_accel_write(uint32_t addr, uint8_t val, void *p) if (!s3->enable_8514) return; - if (s3_enable_fifo(s3)) { - if (svga->crtc[0x53] & 0x08) - s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_BYTE); - else - s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_BYTE); + if (s3_enable_fifo(s3)) { + if (s3->chip <= S3_86C805) { + s3_accel_write_fifo(s3, addr & 0xffff, val); + } else { + if (svga->crtc[0x53] & 0x08) + s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_BYTE); + else + s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_BYTE); + } } else s3_accel_write_fifo(s3, addr & 0xffff, val); } @@ -3750,10 +4075,14 @@ s3_accel_write_w(uint32_t addr, uint16_t val, void *p) return; if (s3_enable_fifo(s3)) { - if (svga->crtc[0x53] & 0x08) - s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_WORD); - else - s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_WORD); + if (s3->chip <= S3_86C805) { + s3_accel_write_fifo_w(s3, addr & 0xffff, val); + } else { + if (svga->crtc[0x53] & 0x08) + s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_WORD); + else + s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_WORD); + } } else s3_accel_write_fifo_w(s3, addr & 0xffff, val); } @@ -3768,10 +4097,14 @@ s3_accel_write_l(uint32_t addr, uint32_t val, void *p) return; if (s3_enable_fifo(s3)) { - if (svga->crtc[0x53] & 0x08) - s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_DWORD); - else - s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_DWORD); + if (s3->chip <= S3_86C805) { + s3_accel_write_fifo_l(s3, addr & 0xffff, val); + } else { + if (svga->crtc[0x53] & 0x08) + s3_queue(s3, addr & 0x1ffff, val, FIFO_WRITE_DWORD); + else + s3_queue(s3, addr & 0xffff, val, FIFO_WRITE_DWORD); + } } else s3_accel_write_fifo_l(s3, addr & 0xffff, val); } @@ -3818,6 +4151,13 @@ s3_accel_read(uint32_t addr, void *p) } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_BYTE_MM + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -3838,6 +4178,10 @@ s3_accel_read(uint32_t addr, void *p) s3_accel_start(2, 1, 0xffffffff, temp | (temp << 8) | (temp << 16) | (temp << 24), s3); break; } + + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } } } @@ -3869,6 +4213,13 @@ s3_accel_read_w(uint32_t addr, void *p) } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_WORD + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -3889,6 +4240,10 @@ s3_accel_read_w(uint32_t addr, void *p) s3_accel_start(2, 1, 0xffffffff, temp | (temp << 16), s3); break; } + + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } } } @@ -4027,6 +4382,13 @@ s3_accel_read_l(uint32_t addr, void *p) } else if (s3_cpu_dest(s3)) { READ_PIXTRANS_LONG + s3->accel.port_slot1++; + s3->accel.port_slot2++; + if (s3->accel.port_slot1 || s3->accel.port_slot2) + s3->accel.draw_fifo_slot++; + if (s3->accel.draw_fifo_slot > 8) + s3->accel.draw_fifo_slot = 1; + switch (s3->accel.cmd & 0x600) { case 0x000: if (((s3->accel.multifunc[0xa] & 0xc0) == 0x80) || (s3->accel.cmd & 2)) { @@ -4057,6 +4419,10 @@ s3_accel_read_l(uint32_t addr, void *p) } break; } + + if (s3_enable_fifo(s3) == 0) { + s3->accel.draw_fifo_slot = 0; + } } } @@ -4880,6 +5246,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ /*Bit 4 of the Command register is the draw yes bit, which enables writing to memory/reading from memory when enabled. When this bit is disabled, no writing to memory/reading from memory is allowed. (This bit is almost meaningless on the NOP command)*/ + switch (cmd) { case 0: /*NOP (Short Stroke Vectors)*/ @@ -5205,7 +5572,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.cy |= ~0xfff; } } - + s3->accel.dest = dstbase + s3->accel.cy * s3->width; if (s3_cpu_src(s3)) { @@ -5439,7 +5806,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ } } } - + s3->accel.src = srcbase + s3->accel.cy * s3->width; s3->accel.dest = dstbase + s3->accel.dy * s3->width; } @@ -5451,6 +5818,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ frgd_mix = (s3->accel.frgd_mix >> 5) & 3; bkgd_mix = (s3->accel.bkgd_mix >> 5) & 3; + if (!cpu_input && frgd_mix == 3 && !vram_mask && !compare_mode && (s3->accel.cmd & 0xa0) == 0xa0 && (s3->accel.frgd_mix & 0xf) == 7 && (s3->accel.bkgd_mix & 0xf) == 7) @@ -5478,7 +5846,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.cx -= (s3->accel.maj_axis_pcnt & 0xfff) + 1; s3->accel.dx -= (s3->accel.maj_axis_pcnt & 0xfff) + 1; s3->accel.sx = s3->accel.maj_axis_pcnt & 0xfff; - + s3->accel.cy++; s3->accel.dy++; @@ -5534,6 +5902,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ mix_dat <<= 1; mix_dat |= 1; + if (s3->bpp == 0) cpu_dat >>= 8; else cpu_dat >>= 16; @@ -5559,7 +5928,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ { s3->accel.cx += (s3->accel.maj_axis_pcnt & 0xfff) + 1; s3->accel.dx += (s3->accel.maj_axis_pcnt & 0xfff) + 1; - } + } s3->accel.sx = s3->accel.maj_axis_pcnt & 0xfff; @@ -5579,11 +5948,13 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.sy--; - if (cpu_input) + if (cpu_input) { return; + } - if (s3->accel.sy < 0) + if (s3->accel.sy < 0) { return; + } } } } @@ -5604,7 +5975,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ if (s3->accel.cur_x_bit12) s3->accel.cx |= ~0xfff; s3->accel.cy = s3->accel.cur_y & 0xfff; if (s3->accel.cur_y_bit12) s3->accel.cy |= ~0xfff; - + /*Align source with destination*/ s3->accel.pattern = (s3->accel.cy * s3->width) + s3->accel.cx; s3->accel.dest = dstbase + s3->accel.dy * s3->width; @@ -5704,9 +6075,12 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_ s3->accel.sy--; - if (cpu_input/* && (s3->accel.multifunc[0xa] & 0xc0) == 0x80*/) return; - if (s3->accel.sy < 0) + if (cpu_input) { return; + } + if (s3->accel.sy < 0) { + return; + } } } break; @@ -6126,7 +6500,7 @@ s3_pci_write(int func, int addr, uint8_t val, void *p) { s3_t *s3 = (s3_t *)p; svga_t *svga = &s3->svga; - + switch (addr) { case 0x00: case 0x01: case 0x02: case 0x03: @@ -6205,7 +6579,7 @@ static int vram_sizes[] = 0, 0, /*4 MB*/ 0, - 0, + 0, /*6 MB*/ 0, 3 /*8 MB*/ }; @@ -6268,6 +6642,11 @@ static void *s3_init(const device_t *info) else video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_86c801); break; + case S3_MIROCRYSTAL20SD_864: + bios_fn = ROM_MIROCRYSTAL20SD_864_VLB; + chip = S3_VISION864; + video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision864_vlb); + break; case S3_PARADISE_BAHAMAS64: bios_fn = ROM_PARADISE_BAHAMAS64; chip = S3_VISION864; @@ -6304,14 +6683,19 @@ static void *s3_init(const device_t *info) chip = S3_VISION964; if (info->flags & DEVICE_PCI) { bios_fn = ROM_MIROCRYSTAL20SV_964_PCI; - video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision864_pci); + video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision964_pci); } else { bios_fn = ROM_MIROCRYSTAL20SV_964_VLB; - video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision864_vlb); + video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision964_vlb); } break; - case S3_MIROVIDEO40SV_968: - bios_fn = ROM_MIROVIDEO40SV_968; + case S3_MIROVIDEO40SV_ERGO_968: + bios_fn = ROM_MIROVIDEO40SV_ERGO_968_PCI; + chip = S3_VISION968; + video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision968_pci); + break; + case S3_PHOENIX_VISION968: + bios_fn = ROM_PHOENIX_VISION968; chip = S3_VISION968; if (info->flags & DEVICE_PCI) video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_s3_vision968_pci); @@ -6419,7 +6803,7 @@ static void *s3_init(const device_t *info) memset(s3, 0, sizeof(s3_t)); - if (info->local == S3_MIROCRYSTAL10SD_805 || info->local == S3_SPEA_MIRAGE_86C801 || + if (info->local == S3_SPEA_MIRAGE_86C801 || info->local == S3_SPEA_MIRAGE_86C805) vram = 1; else @@ -6489,9 +6873,10 @@ static void *s3_init(const device_t *info) if (chip == S3_VISION964 && info->local != S3_ELSAWIN2KPROX_964) svga->dac_hwcursor_draw = bt48x_hwcursor_draw; - else if ((chip == S3_VISION964 && info->local == S3_ELSAWIN2KPROX_964) || (chip == S3_VISION968 && info->local == S3_ELSAWIN2KPROX)) + else if ((chip == S3_VISION964 && info->local == S3_ELSAWIN2KPROX_964) || (chip == S3_VISION968 && (info->local == S3_ELSAWIN2KPROX || + info->local == S3_PHOENIX_VISION968))) svga->dac_hwcursor_draw = ibm_rgb528_hwcursor_draw; - else if (chip == S3_VISION968 && (info->local == S3_MIROVIDEO40SV_968 || info->local == S3_SPEA_MERCURY_P64V)) + else if (chip == S3_VISION968 && (info->local == S3_SPEA_MERCURY_P64V || info->local == S3_MIROVIDEO40SV_ERGO_968)) svga->dac_hwcursor_draw = tvp3026_hwcursor_draw; if (chip >= S3_VISION964) { @@ -6602,7 +6987,7 @@ static void *s3_init(const device_t *info) case S3_SPEA_MIRAGE_86C801: case S3_SPEA_MIRAGE_86C805: - svga->decode_mask = (2 << 20) - 1; + svga->decode_mask = (1 << 20) - 1; stepping = 0xa0; /*86C801/86C805*/ s3->id = stepping; s3->id_ext = stepping; @@ -6646,6 +7031,7 @@ static void *s3_init(const device_t *info) case S3_PARADISE_BAHAMAS64: case S3_PHOENIX_VISION864: + case S3_MIROCRYSTAL20SD_864: svga->decode_mask = (8 << 20) - 1; if (info->local == S3_PARADISE_BAHAMAS64) stepping = 0xc0; /*Vision864*/ @@ -6678,11 +7064,11 @@ static void *s3_init(const device_t *info) svga->clock_gen = device_add(&icd2061_device); svga->getclock = icd2061_getclock; break; - case S3_ELSAWIN2KPROX: - case S3_MIROVIDEO40SV_968: case S3_SPEA_MERCURY_P64V: + case S3_MIROVIDEO40SV_ERGO_968: + case S3_PHOENIX_VISION968: svga->decode_mask = (8 << 20) - 1; s3->id = 0xe1; /*Vision968*/ s3->id_ext = s3->id_ext_pci = 0xf0; @@ -6698,8 +7084,8 @@ static void *s3_init(const device_t *info) svga->crtc[0x59] = 0x00; svga->crtc[0x5a] = 0x0a; } - - if (info->local == S3_ELSAWIN2KPROX) + + if (info->local == S3_ELSAWIN2KPROX || info->local == S3_PHOENIX_VISION968) svga->ramdac = device_add(&ibm_rgb528_ramdac_device); else svga->ramdac = device_add(&tvp3026_ramdac_device); @@ -6709,7 +7095,7 @@ static void *s3_init(const device_t *info) break; case S3_PHOENIX_VISION868: - svga->decode_mask = (8 << 20) - 1; + svga->decode_mask = (4 << 20) - 1; s3->id = 0xe1; /*Vision868*/ s3->id_ext = 0x90; s3->id_ext_pci = 0x80; @@ -6878,9 +7264,19 @@ static int s3_diamond_stealth64_964_available(void) return rom_present(ROM_DIAMOND_STEALTH64_964); } -static int s3_mirovideo_40sv_968_available(void) +static int s3_mirovideo_40sv_ergo_968_pci_available(void) { - return rom_present(ROM_MIROVIDEO40SV_968); + return rom_present(ROM_MIROVIDEO40SV_ERGO_968_PCI); +} + +static int s3_phoenix_vision968_available(void) +{ + return rom_present(ROM_PHOENIX_VISION968); +} + +static int s3_mirocrystal_20sd_864_vlb_available(void) +{ + return rom_present(ROM_MIROCRYSTAL20SD_864_VLB); } static int s3_spea_mercury_p64v_pci_available(void) @@ -7161,7 +7557,7 @@ const device_t s3_spea_mirage_86c805_vlb_device = const device_t s3_mirocrystal_10sd_805_vlb_device = { - "S3 86c805 VLB (MiroCrystal 10SD)", + "S3 86c805 VLB (MiroCRYSTAL 10SD)", DEVICE_VLB, S3_MIROCRYSTAL10SD_805, s3_init, @@ -7170,7 +7566,7 @@ const device_t s3_mirocrystal_10sd_805_vlb_device = { s3_mirocrystal_10sd_805_available }, s3_speed_changed, s3_force_redraw, - NULL + s3_9fx_config }; const device_t s3_phoenix_86c801_isa_device = @@ -7229,6 +7625,20 @@ const device_t s3_metheus_86c928_vlb_device = s3_standard_config }; +const device_t s3_mirocrystal_20sd_864_vlb_device = +{ + "S3 Vision864 VLB (MiroCRYSTAL 20SD)", + DEVICE_VLB, + S3_MIROCRYSTAL20SD_864, + s3_init, + s3_close, + NULL, + { s3_mirocrystal_20sd_864_vlb_available }, + s3_speed_changed, + s3_force_redraw, + s3_9fx_config +}; + const device_t s3_bahamas64_vlb_device = { "S3 Vision864 VLB (Paradise Bahamas 64)", @@ -7314,29 +7724,43 @@ const device_t s3_diamond_stealth64_964_pci_device = s3_standard_config }; -const device_t s3_mirovideo_40sv_968_vlb_device = +const device_t s3_phoenix_vision968_pci_device = { - "S3 Vision968 VLB (MiroVIDEO 40SV)", - DEVICE_VLB, - S3_MIROVIDEO40SV_968, + "S3 Vision968 PCI (Phoenix)", + DEVICE_PCI, + S3_PHOENIX_VISION968, s3_init, s3_close, NULL, - { s3_mirovideo_40sv_968_available }, + { s3_phoenix_vision968_available }, s3_speed_changed, s3_force_redraw, s3_standard_config }; -const device_t s3_mirovideo_40sv_968_pci_device = +const device_t s3_phoenix_vision968_vlb_device = { - "S3 Vision968 PCI (MiroVIDEO 40SV)", - DEVICE_PCI, - S3_MIROVIDEO40SV_968, + "S3 Vision968 VLB (Phoenix)", + DEVICE_VLB, + S3_PHOENIX_VISION968, s3_init, s3_close, NULL, - { s3_mirovideo_40sv_968_available }, + { s3_phoenix_vision968_available }, + s3_speed_changed, + s3_force_redraw, + s3_standard_config +}; + +const device_t s3_mirovideo_40sv_ergo_968_pci_device = +{ + "S3 Vision968 PCI (MiroVIDEO 40SV Ergo)", + DEVICE_PCI, + S3_MIROVIDEO40SV_ERGO_968, + s3_init, + s3_close, + NULL, + { s3_mirovideo_40sv_ergo_968_pci_available }, s3_speed_changed, s3_force_redraw, s3_standard_config diff --git a/src/video/vid_sigma.c b/src/video/vid_sigma.c index 88365b427..008232bc4 100644 --- a/src/video/vid_sigma.c +++ b/src/video/vid_sigma.c @@ -758,7 +758,7 @@ sigma_poll(void *p) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, sigma->firstline - 4, 0, (sigma->lastline - sigma->firstline) + 8, xsize, (sigma->lastline - sigma->firstline) + 8); + video_blit_memtoscreen_8(0, sigma->firstline - 4, xsize, (sigma->lastline - sigma->firstline) + 8); frames++; video_res_x = xsize - 16; diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 01afc2123..0960db8fd 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -43,7 +43,7 @@ #include <86box/vid_svga_render.h> -void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); +void svga_doblit(int wx, int wy, svga_t *svga); extern int cyc_total; extern uint8_t edatlookup[4][4]; @@ -929,10 +929,10 @@ svga_poll(void *p) if (!svga->override) { if (svga->vertical_linedbl) { wy = (svga->lastline - svga->firstline) << 1; - svga_doblit(svga->firstline_draw << 1, (svga->lastline_draw + 1) << 1, wx, wy, svga); + svga_doblit(wx, wy, svga); } else { wy = svga->lastline - svga->firstline; - svga_doblit(svga->firstline_draw, svga->lastline_draw + 1, wx, wy, svga); + svga_doblit(wx, wy, svga); } } @@ -1450,7 +1450,7 @@ svga_read_linear(uint32_t addr, void *p) void -svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) +svga_doblit(int wx, int wy, svga_t *svga) { int y_add, x_add, y_start, x_start, bottom; uint32_t *p; @@ -1469,15 +1469,8 @@ svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) bottom <<= 1; } - if ((wx <= 0) || (wy <= 0)) { - video_blit_memtoscreen(x_start, y_start, 0, 0, 0, 0); + if ((wx <= 0) || (wy <= 0)) return; - } - - if (y1 > y2) { - video_blit_memtoscreen(x_start, y_start, 0, 0, xsize + x_add, ysize + y_add); - return; - } if (svga->vertical_linedbl) svga->y_add <<= 1; @@ -1531,7 +1524,7 @@ svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga) } } - video_blit_memtoscreen(x_start, y_start, y1, y2 + y_add, xsize + x_add, ysize + y_add); + video_blit_memtoscreen(x_start, y_start, xsize + x_add, ysize + y_add); if (svga->vertical_linedbl) svga->vertical_linedbl >>= 1; diff --git a/src/video/vid_table.c b/src/video/vid_table.c index b16862b40..6eba7e4e1 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -147,7 +147,8 @@ video_cards[] = { { "n9_9fx_pci", &s3_9fx_pci_device }, { "px_trio64_pci", &s3_phoenix_trio64_pci_device }, { "elsawin2kprox_pci", &s3_elsa_winner2000_pro_x_pci_device }, - { "mirovideo40sv_pci", &s3_mirovideo_40sv_968_pci_device }, + { "mirovideo40sv_pci", &s3_mirovideo_40sv_ergo_968_pci_device }, + { "px_vision968_pci", &s3_phoenix_vision968_pci_device }, { "spea_mercury64p_pci", &s3_spea_mercury_p64v_pci_device }, { "px_vision868_pci", &s3_phoenix_vision868_pci_device }, { "px_trio64vplus_pci", &s3_phoenix_trio64vplus_pci_device }, @@ -191,6 +192,7 @@ video_cards[] = { { "px_s3_v7_805_vlb", &s3_spea_mirage_86c805_vlb_device }, { "stealth64v_vlb", &s3_diamond_stealth64_964_vlb_device }, { "mirocrystal20sv_vlb", &s3_mirocrystal_20sv_964_vlb_device }, + { "mirocrystal20sd_vlb", &s3_mirocrystal_20sd_864_vlb_device }, { "bahamas64_vlb", &s3_bahamas64_vlb_device }, { "px_vision864_vlb", &s3_phoenix_vision864_vlb_device }, { "stealthse_vlb", &s3_diamond_stealth_se_vlb_device }, @@ -199,6 +201,7 @@ video_cards[] = { { "n9_9fx_vlb", &s3_9fx_vlb_device }, { "px_trio64_vlb", &s3_phoenix_trio64_vlb_device }, { "spea_miragep64_vlb", &s3_spea_mirage_p64_vlb_device }, + { "px_vision968_vlb", &s3_phoenix_vision968_vlb_device }, { "px_vision868_vlb", &s3_phoenix_vision868_vlb_device }, { "ht216_32", &ht216_32_standalone_device }, { "virge325_vlb", &s3_virge_325_vlb_device }, diff --git a/src/video/vid_voodoo_display.c b/src/video/vid_voodoo_display.c index bfee8554c..a52249bee 100644 --- a/src/video/vid_voodoo_display.c +++ b/src/video/vid_voodoo_display.c @@ -655,7 +655,7 @@ skip_draw: thread_release_mutex(voodoo->force_blit_mutex); if (voodoo->dirty_line_high > voodoo->dirty_line_low || force_blit) - svga_doblit(0, voodoo->v_disp, voodoo->h_disp, voodoo->v_disp-1, voodoo->svga); + svga_doblit(voodoo->h_disp, voodoo->v_disp-1, voodoo->svga); if (voodoo->clutData_dirty) { voodoo->clutData_dirty = 0; diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index 0affbd58e..57faf5fdc 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -870,7 +870,7 @@ void wy700_poll(void *p) if (video_force_resize_get()) video_force_resize_set(0); } - video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize); + video_blit_memtoscreen_8(0, 0, xsize, ysize); frames++; /* Fixed 1280x800 resolution */ diff --git a/src/video/video.c b/src/video/video.c index 008228a00..a98f125cb 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -74,7 +74,6 @@ volatile int screenshots = 0; bitmap_t *buffer32 = NULL; -bitmap_t *render_buffer = NULL; uint8_t fontdat[2048][8]; /* IBM CGA font */ uint8_t fontdatm[2048][16]; /* IBM MDA font */ uint8_t fontdatw[512][32]; /* Wyse700 font */ @@ -245,7 +244,7 @@ const uint32_t shade[5][256] = static struct { - int x, y, y1, y2, w, h; + int x, y, w, h; int busy; int buffer_in_use; @@ -256,7 +255,7 @@ static struct { } blit_data; -static void (*blit_func)(int x, int y, int y1, int y2, int w, int h); +static void (*blit_func)(int x, int y, int w, int h); #ifdef ENABLE_VIDEO_LOG @@ -280,7 +279,7 @@ video_log(const char *fmt, ...) void -video_setblit(void(*blit)(int,int,int,int,int,int)) +video_setblit(void(*blit)(int,int,int,int)) { blit_func = blit; } @@ -318,7 +317,7 @@ static png_infop info_ptr; static void -video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, int w, int h) +video_take_screenshot(const char *fn) { int i, x, y; png_bytep *b_rgb = NULL; @@ -350,25 +349,26 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in png_init_io(png_ptr, fp); - png_set_IHDR(png_ptr, info_ptr, w, h, + png_set_IHDR(png_ptr, info_ptr, blit_data.w, blit_data.h, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * h); + b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * blit_data.h); if (b_rgb == NULL) { video_log("[video_take_screenshot] Unable to Allocate RGB Bitmap Memory"); fclose(fp); return; } - for (y = 0; y < h; ++y) { + for (y = 0; y < blit_data.h; ++y) { b_rgb[y] = (png_byte *) malloc(png_get_rowbytes(png_ptr, info_ptr)); - for (x = 0; x < w; ++x) { - temp = render_buffer->dat[(y * w) + x]; - - b_rgb[y][(x) * 3 + 0] = (temp >> 16) & 0xff; - b_rgb[y][(x) * 3 + 1] = (temp >> 8) & 0xff; - b_rgb[y][(x) * 3 + 2] = temp & 0xff; + for (x = 0; x < blit_data.w; ++x) { + if (buffer32 == NULL) + memset(&(b_rgb[y][x * 3]), 0x00, 3); + else { + temp = buffer32->line[blit_data.y + y][blit_data.x + x]; + memcpy(&(b_rgb[y][x * 3]), &temp, 3); + } } } @@ -379,7 +379,7 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in png_write_end(png_ptr, NULL); /* cleanup heap allocation */ - for (i = 0; i < h; i++) + for (i = 0; i < blit_data.h; i++) if (b_rgb[i]) free(b_rgb[i]); if (b_rgb) free(b_rgb); @@ -389,7 +389,7 @@ video_take_screenshot(const char *fn, int startx, int starty, int y1, int y2, in static void -video_screenshot(int x, int y, int y1, int y2, int w, int h) +video_screenshot(void) { char path[1024], fn[128]; @@ -408,7 +408,7 @@ video_screenshot(int x, int y, int y1, int y2, int w, int h) video_log("taking screenshot to: %s\n", path); - video_take_screenshot((const char *) path, x, y, y1, y2, w, h); + video_take_screenshot((const char *) path); png_destroy_write_struct(&png_ptr, &info_ptr); } @@ -418,10 +418,12 @@ video_transform_copy(uint32_t *dst, uint32_t *src, int len) { int i; - for (i = 0; i < len; i++) { - *dst = video_color_transform(*src); - dst++; - src++; + if ((dst != NULL) && (src != NULL)) { + for (i = 0; i < len; i++) { + *dst = video_color_transform(*src); + dst++; + src++; + } } } @@ -436,28 +438,22 @@ void blit_thread(void *param) thread_reset_event(blit_data.wake_blit_thread); MTR_BEGIN("video", "blit_thread"); - if (blit_data.y2 > 0) { - for (yy = blit_data.y1; yy < blit_data.y2; yy++) { + if ((video_grayscale || invert_display) && (blit_data.h > 0)) { + for (yy = 0; yy < blit_data.h; yy++) { if (((blit_data.y + yy) >= 0) && ((blit_data.y + yy) < buffer32->h)) { - if (video_grayscale || invert_display) - video_transform_copy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w); - else - memcpy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w << 2); + video_transform_copy(&(buffer32->line[blit_data.y + yy][blit_data.x]), &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w); } } } if (screenshots) { - if (render_buffer != NULL) - video_screenshot(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h); + video_screenshot(); screenshots--; video_log("screenshot taken, %i left\n", screenshots); } if (blit_func) - blit_func(blit_data.x, blit_data.y, - blit_data.y1, blit_data.y2, - blit_data.w, blit_data.h); + blit_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h); blit_data.busy = 0; @@ -468,7 +464,7 @@ void blit_thread(void *param) void -video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) +video_blit_memtoscreen(int x, int y, int w, int h) { MTR_BEGIN("video", "video_blit_memtoscreen"); @@ -481,8 +477,6 @@ video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) blit_data.buffer_in_use = 1; blit_data.x = x; blit_data.y = y; - blit_data.y1 = y1; - blit_data.y2 = y2; blit_data.w = w; blit_data.h = h; @@ -546,7 +540,7 @@ video_blend(int x, int y) void -video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h) +video_blit_memtoscreen_8(int x, int y, int w, int h) { int yy, xx; @@ -563,7 +557,7 @@ video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h) } } - video_blit_memtoscreen(x, y, y1, y2, w, h); + video_blit_memtoscreen(x, y, w, h); } @@ -833,7 +827,6 @@ video_init(void) /* Account for overscan. */ buffer32 = create_bitmap(2048 + 64, 2048 + 64); - render_buffer = create_bitmap(2048 + 64, 2048 + 64); for (c = 0; c < 64; c++) { cgapal[c + 64].r = (((c & 4) ? 2 : 0) | ((c & 0x10) ? 1 : 0)) * 21; @@ -902,7 +895,6 @@ video_close(void) free(video_8togs); free(video_6to8); - destroy_bitmap(render_buffer); destroy_bitmap(buffer32); if (fontdatksc5601) { diff --git a/src/vnc.c b/src/vnc.c index 09c00831f..f2f4655b0 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -167,16 +167,19 @@ vnc_display(rfbClientPtr cl) static void -vnc_blit(int x, int y, int y1, int y2, int w, int h) +vnc_blit(int x, int y, int w, int h) { uint32_t *p; int yy; - for (yy=y1; yyframeBuffer)[yy*VNC_MAX_X]); if ((y+yy) >= 0 && (y+yy) < VNC_MAX_Y) - memcpy(p, &(render_buffer->dat[yy * w]), w*4); + memcpy(p, &(buffer32->line[yy]), w*sizeof(uint32_t)); } video_blit_complete(); diff --git a/src/win/86Box.manifest b/src/win/86Box.manifest index 454e1df65..045e12dbf 100644 --- a/src/win/86Box.manifest +++ b/src/win/86Box.manifest @@ -32,4 +32,18 @@ UTF-8 + + + + + + + + + + + + + + diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index 9d44fc47e..7e92e40b8 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -808,21 +808,27 @@ static void opengl_main(void* param) CoUninitialize(); } -static void opengl_blit(int x, int y, int y1, int y2, int w, int h) +static void opengl_blit(int x, int y, int w, int h) { - if (y1 == y2 || h <= 0 || render_buffer == NULL || thread == NULL || + int yy; + + if ((h <= 0) || (buffer32 == NULL) || (thread == NULL) || atomic_flag_test_and_set(&blit_info[write_pos].in_use)) { video_blit_complete(); return; } - memcpy(blit_info[write_pos].buffer, &(render_buffer->dat)[y1 * w], w * (y2 - y1) * sizeof(uint32_t)); + for (yy = 0; yy < h; yy++) { + if ((y + yy) >= 0 && (y + yy) < buffer32->h) + memcpy(blit_info[write_pos].buffer + (yy * w * sizeof(uint32_t)), + &(((uint32_t *) buffer32->line[y + yy])[x]), w * sizeof(uint32_t)); + } video_blit_complete(); - blit_info[write_pos].y1 = y1; - blit_info[write_pos].y2 = y2; + blit_info[write_pos].y1 = 0; + blit_info[write_pos].y2 = h - 1; blit_info[write_pos].w = w; blit_info[write_pos].h = h; diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index 8a748fb2b..303fb5f69 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -229,29 +229,29 @@ sdl_stretch(int *w, int *h, int *x, int *y) static void -sdl_blit(int x, int y, int y1, int y2, int w, int h) +sdl_blit(int x, int y, int w, int h) { SDL_Rect r_src; int ret; - if (!sdl_enabled || (y1 == y2) || (h <= 0) || (render_buffer == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { + if (!sdl_enabled || (h <= 0) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { video_blit_complete(); return; } SDL_LockMutex(sdl_mutex); - r_src.x = 0; - r_src.y = y1; + r_src.x = x; + r_src.y = y; r_src.w = w; - r_src.h = y2 - y1; - SDL_UpdateTexture(sdl_tex, &r_src, &(render_buffer->dat)[y1 * w], w * 4); + r_src.h = h; + SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), (2048 + 64) * sizeof(uint32_t)); video_blit_complete(); SDL_RenderClear(sdl_render); - r_src.x = 0; - r_src.y = 0; + r_src.x = x; + r_src.y = y; r_src.w = w; r_src.h = h;