mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-23 04:30:10 +00:00
- added a few more emulated privileged instructions to NetBSD/m68k
- tried to make VOSF run under NetBSD/m68k, little success (shows stripes and sometimes crashes)
This commit is contained in:
parent
b6f3185c3b
commit
a1097b080d
@ -185,7 +185,7 @@ _ExceptionHandlerAsm
|
||||
pea 1$
|
||||
move.w _EmulatedSR,d0
|
||||
move.w d0,-(sp)
|
||||
or.w #$0100,d0 ;Set interrupt level in SR
|
||||
or.w #$2100,d0 ;Set interrupt level in SR, enter (virtual) supervisor mode
|
||||
move.w d0,_EmulatedSR
|
||||
move.l $64.w,-(sp) ;Jump to MacOS interrupt handler
|
||||
rts
|
||||
@ -474,7 +474,7 @@ doprivviol move.l d0,(sp) ;Save d0
|
||||
cmp.w #$40d0,d0 ;move sr,(a0)?
|
||||
beq movefromsra0
|
||||
cmp.w #$40d7,d0 ;move sr,(sp)?
|
||||
beq movefromsrsp ;+++jl+++
|
||||
beq movefromsrsp
|
||||
|
||||
cmp.w #$f327,d0 ;fsave -(sp)?
|
||||
beq fsavepush
|
||||
@ -889,21 +889,21 @@ movecfromcr move.w ([6,sp],2),d0 ;Get next instruction word
|
||||
beq.s movectcd0
|
||||
cmp.w #$1003,d0 ;movec tc,d1?
|
||||
beq.s movectcd1
|
||||
cmp.w #$1000,d0 ;movec SFC,d1?
|
||||
cmp.w #$1000,d0 ;movec sfc,d1?
|
||||
beq movecsfcd1
|
||||
cmp.w #$1001,d0 ;movec DFC,d1?
|
||||
cmp.w #$1001,d0 ;movec dfc,d1?
|
||||
beq movecdfcd1
|
||||
cmp.w #$0806,d0 ;movec URP,d0?
|
||||
cmp.w #$0806,d0 ;movec urp,d0?
|
||||
beq movecurpd0
|
||||
cmp.w #$0807,d0 ;movec SRP,d0?
|
||||
cmp.w #$0807,d0 ;movec srp,d0?
|
||||
beq.s movecsrpd0
|
||||
cmp.w #$0004,d0 ;movec ITT0,d0
|
||||
cmp.w #$0004,d0 ;movec itt0,d0
|
||||
beq.s movecitt0d0
|
||||
cmp.w #$0005,d0 ;movec ITT1,d0
|
||||
cmp.w #$0005,d0 ;movec itt1,d0
|
||||
beq.s movecitt1d0
|
||||
cmp.w #$0006,d0 ;movec DTT0,d0
|
||||
cmp.w #$0006,d0 ;movec dtt0,d0
|
||||
beq.s movecdtt0d0
|
||||
cmp.w #$0007,d0 ;movec DTT1,d0
|
||||
cmp.w #$0007,d0 ;movec dtt1,d0
|
||||
beq.s movecdtt1d0
|
||||
|
||||
bra pv_unhandled
|
||||
@ -950,24 +950,24 @@ movectcd1 move.l (sp)+,d0 ;Restore d0
|
||||
addq.l #4,2(sp)
|
||||
rte
|
||||
|
||||
; movec SFC,d1 +jl+
|
||||
; movec sfc,d1 +jl+
|
||||
movecsfcd1: move.l (sp)+,d0 ;Restore d0
|
||||
moveq #0,d1 ;MMU is always off
|
||||
moveq #0,d1
|
||||
addq.l #4,2(sp)
|
||||
rte
|
||||
|
||||
; movec DFC,d1 +jl+
|
||||
; movec dfc,d1 +jl+
|
||||
movecdfcd1: move.l (sp)+,d0 ;Restore d0
|
||||
moveq #0,d1 ;MMU is always off
|
||||
moveq #0,d1
|
||||
addq.l #4,2(sp)
|
||||
rte
|
||||
|
||||
movecurpd0: ; movec URP,d0 +jl+
|
||||
movecsrpd0: ; movec SRP,d0
|
||||
movecitt0d0: ; movec ITT0,d0
|
||||
movecitt1d0: ; movec ITT1,d0
|
||||
movecdtt0d0: ; movec DTT0,d0
|
||||
movecdtt1d0: ; movec DTT1,d0
|
||||
movecurpd0: ; movec urp,d0 +jl+
|
||||
movecsrpd0: ; movec srp,d0
|
||||
movecitt0d0: ; movec itt0,d0
|
||||
movecitt1d0: ; movec itt1,d0
|
||||
movecdtt0d0: ; movec dtt0,d0
|
||||
movecdtt1d0: ; movec dtt1,d0
|
||||
addq.l #4,sp
|
||||
moveq.l #0,d0 ;MMU is always off
|
||||
addq.l #4,2(sp) ;skip instruction
|
||||
@ -984,9 +984,9 @@ movectocr move.w ([6,sp],2),d0 ;Get next instruction word
|
||||
beq.s movectocacr
|
||||
cmp.w #$1002,d0 ;movec d1,cacr?
|
||||
beq.s movectocacr
|
||||
cmp.w #$1000,d0 ;movec d1,SFC?
|
||||
cmp.w #$1000,d0 ;movec d1,sfc?
|
||||
beq.s movectoxfc
|
||||
cmp.w #$1001,d0 ;movec d1,DFC?
|
||||
cmp.w #$1001,d0 ;movec d1,dfc?
|
||||
beq.s movectoxfc
|
||||
|
||||
bra pv_unhandled
|
||||
@ -1005,8 +1005,8 @@ movectocacr movem.l d1/a0-a1/a6,-(sp) ;Move to CACR, clear caches
|
||||
addq.l #4,2(sp)
|
||||
rte
|
||||
|
||||
; movec x,SFC
|
||||
; movec x,DFC
|
||||
; movec x,sfc
|
||||
; movec x,dfc
|
||||
movectoxfc move.l (sp)+,d0 ;Ignore moves to SFC, DFC
|
||||
addq.l #4,2(sp)
|
||||
rte
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* asm_support.s - Utility functions in assemmbly language
|
||||
* asm_support.s - Utility functions in assemmbly language (for native 68k support)
|
||||
*
|
||||
* Basilisk II (C) 1997-1999 Christian Bauer
|
||||
*
|
||||
|
@ -9,7 +9,7 @@ dnl Options.
|
||||
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
|
||||
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
|
||||
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
|
||||
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
|
||||
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
|
||||
AC_ARG_ENABLE(16bit-vidmode, [ --enable-16bit-vidmode enable 16-bit video if possible [default=yes]], [WANT_16BIT_VIDMODE=$enableval], [WANT_16BIT_VIDMODE=yes])
|
||||
AC_ARG_ENABLE(addressing,
|
||||
[ --enable-addressing=mode specify the addressing mode to use [default=fastest]],
|
||||
@ -204,7 +204,7 @@ ETHERSRC=../dummy/ether_dummy.cpp
|
||||
SCSISRC=../dummy/scsi_dummy.cpp
|
||||
AUDIOSRC=../dummy/audio_dummy.cpp
|
||||
EXTRASYSSRCS=
|
||||
SUPPORTS_NATIVE_M68K=no
|
||||
CAN_NATIVE_M68K=no
|
||||
case "$target_os" in
|
||||
linux*)
|
||||
ETHERSRC=Linux/ether_linux.cpp
|
||||
@ -252,7 +252,7 @@ freebsd*)
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
SUPPORTS_NATIVE_M68K=yes
|
||||
CAN_NATIVE_M68K=yes
|
||||
;;
|
||||
solaris*)
|
||||
AUDIOSRC=Solaris/audio_solaris.cpp
|
||||
@ -265,6 +265,13 @@ irix*)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Use 68k CPU natively?
|
||||
WANT_NATIVE_M68K=no
|
||||
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
|
||||
AC_DEFINE(ENABLE_NATIVE_M68K)
|
||||
WANT_NATIVE_M68K=yes
|
||||
fi
|
||||
|
||||
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
|
||||
dnl Serial, ethernet and audio support needs pthreads
|
||||
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
|
||||
@ -386,6 +393,43 @@ if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
|
||||
])
|
||||
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
if [[ "x$HAVE_M68K" = "xyes" ]]; then
|
||||
AC_CACHE_CHECK("whether we then have a subterfuge for your system",
|
||||
ac_cv_have_sigcontext_hack, [
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_RUN([
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
static volatile caddr_t mem = 0;
|
||||
static int zero_fd = -1;
|
||||
|
||||
static RETSIGTYPE segfault_handler(int, int code)
|
||||
{ if ((caddr_t)code != mem) exit(1);
|
||||
munmap(mem, getpagesize()); close(zero_fd); exit(0); }
|
||||
|
||||
int main()
|
||||
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
|
||||
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
|
||||
struct sigaction sa; sa.sa_flags = 0;
|
||||
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
|
||||
sigaction(SIGSEGV, &sa, 0);
|
||||
mem[0] = 0;
|
||||
exit(1); // should not be reached
|
||||
}
|
||||
],
|
||||
[ac_cv_have_sigcontext_hack=yes],
|
||||
[ac_cv_have_sigcontext_hack=no]
|
||||
)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@ -397,58 +441,62 @@ if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" =
|
||||
fi
|
||||
|
||||
dnl Determine the addressing mode to use
|
||||
ADDRESSING_MODE=""
|
||||
AC_MSG_CHECKING([for the addressing mode to use])
|
||||
for am in $ADDRESSING_TEST_ORDER; do
|
||||
case $am in
|
||||
real)
|
||||
dnl Requires ability to mmap Low Memory globals.
|
||||
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then
|
||||
dnl Requires only VOSF if 16-bit vidmode enable
|
||||
if [[ "x$WANT_16BIT_VIDMODE" = "xyes" ]]; then
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="real"
|
||||
else
|
||||
ADDRESSING_MODE=""
|
||||
AC_MSG_CHECKING([for the addressing mode to use])
|
||||
for am in $ADDRESSING_TEST_ORDER; do
|
||||
case $am in
|
||||
real)
|
||||
dnl Requires ability to mmap Low Memory globals.
|
||||
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then
|
||||
dnl Requires only VOSF if 16-bit vidmode enable
|
||||
if [[ "x$WANT_16BIT_VIDMODE" = "xyes" ]]; then
|
||||
if [[ "x$CAN_VOSF" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
else
|
||||
DEFINES="$DEFINES -DDISABLE_16BIT_VIDMODE"
|
||||
fi
|
||||
else
|
||||
dnl Requires VOSF
|
||||
if [[ "x$CAN_VOSF" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
else
|
||||
DEFINES="$DEFINES -DDISABLE_16BIT_VIDMODE"
|
||||
fi
|
||||
else
|
||||
dnl Requires VOSF
|
||||
if [[ "x$CAN_VOSF" = "xno" ]]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
dnl Real addressing will probably work
|
||||
ADDRESSING_MODE="real"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DREAL_ADDRESSING"
|
||||
break
|
||||
;;
|
||||
direct)
|
||||
dnl Requires VOSF
|
||||
if [[ "x$CAN_VOSF" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="direct"
|
||||
dnl Real addressing will probably work
|
||||
ADDRESSING_MODE="real"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DDIRECT_ADDRESSING"
|
||||
DEFINES="$DEFINES -DREAL_ADDRESSING"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
banks)
|
||||
dnl Default addressing mode
|
||||
;;
|
||||
direct)
|
||||
dnl Requires VOSF
|
||||
if [[ "x$CAN_VOSF" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="direct"
|
||||
WANT_VOSF=yes dnl we can use VOSF and we need it actually
|
||||
DEFINES="$DEFINES -DDIRECT_ADDRESSING"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
banks)
|
||||
dnl Default addressing mode
|
||||
ADDRESSING_MODE="memory banks"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
|
||||
esac
|
||||
done
|
||||
AC_MSG_RESULT($ADDRESSING_MODE)
|
||||
if [[ "x$ADDRESSING_MODE" = "x" ]]; then
|
||||
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
|
||||
ADDRESSING_MODE="memory banks"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
|
||||
esac
|
||||
done
|
||||
AC_MSG_RESULT($ADDRESSING_MODE)
|
||||
if [[ "x$ADDRESSING_MODE" = "x" ]]; then
|
||||
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
|
||||
ADDRESSING_MODE="memory banks"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Since real and direct addressing modes automatically activate VOSF,
|
||||
@ -489,7 +537,6 @@ fi
|
||||
|
||||
dnl Select appropriate CPU source and REGPARAM define.
|
||||
ASM_OPTIMIZATIONS=none
|
||||
WANT_NATIVE_M68K=no
|
||||
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
|
||||
FPUSRCS="../uae_cpu/fpp.cpp"
|
||||
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
|
||||
@ -524,20 +571,16 @@ elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xy
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then
|
||||
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||
dnl Native m68k, no emulation
|
||||
CPUSRCS=""
|
||||
AC_DEFINE(ENABLE_NATIVE_M68K)
|
||||
WANT_NATIVE_M68K=yes
|
||||
CPUINCLUDES="-I../native_cpu"
|
||||
CPUSRCS="asm_support.s"
|
||||
fi
|
||||
|
||||
dnl UAE CPU sources for all non-m68k-native architectures.
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
|
||||
CPUINCLUDES="-I../uae_cpu"
|
||||
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
|
||||
else
|
||||
CPUINCLUDES="-I../native_cpu"
|
||||
CPUSRCS="asm_support.s"
|
||||
fi
|
||||
|
||||
dnl Remove the "-g" option if set for GCC.
|
||||
|
@ -260,18 +260,46 @@ static inline void do_handle_screen_fault(uintptr addr)
|
||||
}
|
||||
|
||||
#if defined(HAVE_SIGINFO_T)
|
||||
|
||||
static void Screen_fault_handler(int, siginfo_t * sip, void *)
|
||||
{
|
||||
D(bug("Screen_fault_handler: ADDR=0x%08X\n", sip->si_addr));
|
||||
do_handle_screen_fault((uintptr)sip->si_addr);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_SIGCONTEXT_SUBTERFUGE)
|
||||
|
||||
# if defined(__i386__) && defined(__linux__)
|
||||
static void Screen_fault_handler(int, struct sigcontext scs)
|
||||
{
|
||||
D(bug("Screen_fault_handler: ADDR=0x%08X from IP=0x%08X\n", scs.cr2, scs.eip));
|
||||
do_handle_screen_fault((uintptr)scs.cr2);
|
||||
}
|
||||
|
||||
# elif defined(__m68k__) && defined(__NetBSD__)
|
||||
|
||||
# include <m68k/frame.h>
|
||||
static void Screen_fault_handler(int, int code, struct sigcontext *scp)
|
||||
{
|
||||
D(bug("Screen_fault_handler: ADDR=0x%08X\n", code));
|
||||
struct sigstate {
|
||||
int ss_flags;
|
||||
struct frame ss_frame;
|
||||
};
|
||||
struct sigstate *state = (struct sigstate *)scp->sc_ap;
|
||||
uintptr fault_addr;
|
||||
switch (state->ss_frame.f_format) {
|
||||
case 7: // 68040 access error
|
||||
// "code" is sometimes unreliable (i.e. contains NULL or a bogus address), reason unknown
|
||||
fault_addr = state->ss_frame.f_fmt7.f_fa;
|
||||
break;
|
||||
default:
|
||||
fault_addr = (uintptr)code;
|
||||
break;
|
||||
}
|
||||
do_handle_screen_fault(fault_addr);
|
||||
}
|
||||
|
||||
# else
|
||||
# error "No suitable subterfuge for Video on SEGV signals"
|
||||
# endif
|
||||
@ -344,40 +372,78 @@ static inline void update_display_window_vosf(void)
|
||||
|
||||
// Check for first column from left and first column
|
||||
// from right that have changed
|
||||
int x1 = VideoMonitor.x * bytes_per_pixel - 1;
|
||||
for (j = y1; j <= y2; j++) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = 0; i < x1; i++) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x1 = i;
|
||||
break;
|
||||
int x1, x2, width;
|
||||
if (depth == 1) {
|
||||
|
||||
x1 = VideoMonitor.x - 1;
|
||||
for (j = y1; j <= y2; j++) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = 0; i < (x1>>3); i++) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x1 = i << 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
x1 /= bytes_per_pixel;
|
||||
|
||||
int x2 = x1 * bytes_per_pixel;
|
||||
for (j = y2; j >= y1; j--) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = VideoMonitor.x * bytes_per_pixel - 1; i > x2; i--) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x2 = i;
|
||||
break;
|
||||
|
||||
x2 = x1;
|
||||
for (j = y2; j >= y1; j--) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = (VideoMonitor.x>>3) - 1; i > (x2>>3); i--) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x2 = i << 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
x2 /= bytes_per_pixel;
|
||||
width = x2 - x1 + 1;
|
||||
|
||||
// Update the_host_buffer and copy of the_buffer
|
||||
i = y1 * bytes_per_row + (x1 >> 3);
|
||||
for (j = y1; j <= y2; j++) {
|
||||
do_update_framebuffer(the_host_buffer + i, the_buffer + i, width >> 3);
|
||||
memcpy(the_buffer_copy + i, the_buffer + i, width >> 3);
|
||||
i += bytes_per_row;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
x1 = VideoMonitor.x * bytes_per_pixel - 1;
|
||||
for (j = y1; j <= y2; j++) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = 0; i < x1; i++) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x1 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
x1 /= bytes_per_pixel;
|
||||
|
||||
// Update the_host_buffer and copy of the_buffer
|
||||
// There is at least one pixel to copy
|
||||
const int width = x2 - x1 + 1;
|
||||
i = y1 * bytes_per_row + x1 * bytes_per_pixel;
|
||||
for (j = y1; j <= y2; j++) {
|
||||
do_update_framebuffer(the_host_buffer + i, the_buffer + i, bytes_per_pixel * width);
|
||||
memcpy(the_buffer_copy + i, the_buffer + i, bytes_per_pixel * width);
|
||||
i += bytes_per_row;
|
||||
x2 = x1 * bytes_per_pixel;
|
||||
for (j = y2; j >= y1; j--) {
|
||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
for (i = VideoMonitor.x * bytes_per_pixel - 1; i > x2; i--) {
|
||||
if (p1[i] != p2[i]) {
|
||||
x2 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
x2 /= bytes_per_pixel;
|
||||
width = x2 - x1 + 1;
|
||||
|
||||
// Update the_host_buffer and copy of the_buffer
|
||||
i = y1 * bytes_per_row + x1 * bytes_per_pixel;
|
||||
for (j = y1; j <= y2; j++) {
|
||||
do_update_framebuffer(the_host_buffer + i, the_buffer + i, bytes_per_pixel * width);
|
||||
memcpy(the_buffer_copy + i, the_buffer + i, bytes_per_pixel * width);
|
||||
i += bytes_per_row;
|
||||
}
|
||||
}
|
||||
|
||||
if (have_shm)
|
||||
|
@ -1745,7 +1745,7 @@ static void update_display_static(void)
|
||||
// Check for first column from left and first column from right that have changed
|
||||
if (high) {
|
||||
if (depth == 1) {
|
||||
x1 = VideoMonitor.x;
|
||||
x1 = VideoMonitor.x - 1;
|
||||
for (j=y1; j<=y2; j++) {
|
||||
p = &the_buffer[j * bytes_per_row];
|
||||
p2 = &the_buffer_copy[j * bytes_per_row];
|
||||
|
Loading…
Reference in New Issue
Block a user