mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-11 10:30:09 +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$
|
pea 1$
|
||||||
move.w _EmulatedSR,d0
|
move.w _EmulatedSR,d0
|
||||||
move.w d0,-(sp)
|
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.w d0,_EmulatedSR
|
||||||
move.l $64.w,-(sp) ;Jump to MacOS interrupt handler
|
move.l $64.w,-(sp) ;Jump to MacOS interrupt handler
|
||||||
rts
|
rts
|
||||||
@ -474,7 +474,7 @@ doprivviol move.l d0,(sp) ;Save d0
|
|||||||
cmp.w #$40d0,d0 ;move sr,(a0)?
|
cmp.w #$40d0,d0 ;move sr,(a0)?
|
||||||
beq movefromsra0
|
beq movefromsra0
|
||||||
cmp.w #$40d7,d0 ;move sr,(sp)?
|
cmp.w #$40d7,d0 ;move sr,(sp)?
|
||||||
beq movefromsrsp ;+++jl+++
|
beq movefromsrsp
|
||||||
|
|
||||||
cmp.w #$f327,d0 ;fsave -(sp)?
|
cmp.w #$f327,d0 ;fsave -(sp)?
|
||||||
beq fsavepush
|
beq fsavepush
|
||||||
@ -889,21 +889,21 @@ movecfromcr move.w ([6,sp],2),d0 ;Get next instruction word
|
|||||||
beq.s movectcd0
|
beq.s movectcd0
|
||||||
cmp.w #$1003,d0 ;movec tc,d1?
|
cmp.w #$1003,d0 ;movec tc,d1?
|
||||||
beq.s movectcd1
|
beq.s movectcd1
|
||||||
cmp.w #$1000,d0 ;movec SFC,d1?
|
cmp.w #$1000,d0 ;movec sfc,d1?
|
||||||
beq movecsfcd1
|
beq movecsfcd1
|
||||||
cmp.w #$1001,d0 ;movec DFC,d1?
|
cmp.w #$1001,d0 ;movec dfc,d1?
|
||||||
beq movecdfcd1
|
beq movecdfcd1
|
||||||
cmp.w #$0806,d0 ;movec URP,d0?
|
cmp.w #$0806,d0 ;movec urp,d0?
|
||||||
beq movecurpd0
|
beq movecurpd0
|
||||||
cmp.w #$0807,d0 ;movec SRP,d0?
|
cmp.w #$0807,d0 ;movec srp,d0?
|
||||||
beq.s movecsrpd0
|
beq.s movecsrpd0
|
||||||
cmp.w #$0004,d0 ;movec ITT0,d0
|
cmp.w #$0004,d0 ;movec itt0,d0
|
||||||
beq.s movecitt0d0
|
beq.s movecitt0d0
|
||||||
cmp.w #$0005,d0 ;movec ITT1,d0
|
cmp.w #$0005,d0 ;movec itt1,d0
|
||||||
beq.s movecitt1d0
|
beq.s movecitt1d0
|
||||||
cmp.w #$0006,d0 ;movec DTT0,d0
|
cmp.w #$0006,d0 ;movec dtt0,d0
|
||||||
beq.s movecdtt0d0
|
beq.s movecdtt0d0
|
||||||
cmp.w #$0007,d0 ;movec DTT1,d0
|
cmp.w #$0007,d0 ;movec dtt1,d0
|
||||||
beq.s movecdtt1d0
|
beq.s movecdtt1d0
|
||||||
|
|
||||||
bra pv_unhandled
|
bra pv_unhandled
|
||||||
@ -950,24 +950,24 @@ movectcd1 move.l (sp)+,d0 ;Restore d0
|
|||||||
addq.l #4,2(sp)
|
addq.l #4,2(sp)
|
||||||
rte
|
rte
|
||||||
|
|
||||||
; movec SFC,d1 +jl+
|
; movec sfc,d1 +jl+
|
||||||
movecsfcd1: move.l (sp)+,d0 ;Restore d0
|
movecsfcd1: move.l (sp)+,d0 ;Restore d0
|
||||||
moveq #0,d1 ;MMU is always off
|
moveq #0,d1
|
||||||
addq.l #4,2(sp)
|
addq.l #4,2(sp)
|
||||||
rte
|
rte
|
||||||
|
|
||||||
; movec DFC,d1 +jl+
|
; movec dfc,d1 +jl+
|
||||||
movecdfcd1: move.l (sp)+,d0 ;Restore d0
|
movecdfcd1: move.l (sp)+,d0 ;Restore d0
|
||||||
moveq #0,d1 ;MMU is always off
|
moveq #0,d1
|
||||||
addq.l #4,2(sp)
|
addq.l #4,2(sp)
|
||||||
rte
|
rte
|
||||||
|
|
||||||
movecurpd0: ; movec URP,d0 +jl+
|
movecurpd0: ; movec urp,d0 +jl+
|
||||||
movecsrpd0: ; movec SRP,d0
|
movecsrpd0: ; movec srp,d0
|
||||||
movecitt0d0: ; movec ITT0,d0
|
movecitt0d0: ; movec itt0,d0
|
||||||
movecitt1d0: ; movec ITT1,d0
|
movecitt1d0: ; movec itt1,d0
|
||||||
movecdtt0d0: ; movec DTT0,d0
|
movecdtt0d0: ; movec dtt0,d0
|
||||||
movecdtt1d0: ; movec DTT1,d0
|
movecdtt1d0: ; movec dtt1,d0
|
||||||
addq.l #4,sp
|
addq.l #4,sp
|
||||||
moveq.l #0,d0 ;MMU is always off
|
moveq.l #0,d0 ;MMU is always off
|
||||||
addq.l #4,2(sp) ;skip instruction
|
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
|
beq.s movectocacr
|
||||||
cmp.w #$1002,d0 ;movec d1,cacr?
|
cmp.w #$1002,d0 ;movec d1,cacr?
|
||||||
beq.s movectocacr
|
beq.s movectocacr
|
||||||
cmp.w #$1000,d0 ;movec d1,SFC?
|
cmp.w #$1000,d0 ;movec d1,sfc?
|
||||||
beq.s movectoxfc
|
beq.s movectoxfc
|
||||||
cmp.w #$1001,d0 ;movec d1,DFC?
|
cmp.w #$1001,d0 ;movec d1,dfc?
|
||||||
beq.s movectoxfc
|
beq.s movectoxfc
|
||||||
|
|
||||||
bra pv_unhandled
|
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)
|
addq.l #4,2(sp)
|
||||||
rte
|
rte
|
||||||
|
|
||||||
; movec x,SFC
|
; movec x,sfc
|
||||||
; movec x,DFC
|
; movec x,dfc
|
||||||
movectoxfc move.l (sp)+,d0 ;Ignore moves to SFC, DFC
|
movectoxfc move.l (sp)+,d0 ;Ignore moves to SFC, DFC
|
||||||
addq.l #4,2(sp)
|
addq.l #4,2(sp)
|
||||||
rte
|
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
|
* 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-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(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(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(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,
|
AC_ARG_ENABLE(addressing,
|
||||||
[ --enable-addressing=mode specify the addressing mode to use [default=fastest]],
|
[ --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
|
SCSISRC=../dummy/scsi_dummy.cpp
|
||||||
AUDIOSRC=../dummy/audio_dummy.cpp
|
AUDIOSRC=../dummy/audio_dummy.cpp
|
||||||
EXTRASYSSRCS=
|
EXTRASYSSRCS=
|
||||||
SUPPORTS_NATIVE_M68K=no
|
CAN_NATIVE_M68K=no
|
||||||
case "$target_os" in
|
case "$target_os" in
|
||||||
linux*)
|
linux*)
|
||||||
ETHERSRC=Linux/ether_linux.cpp
|
ETHERSRC=Linux/ether_linux.cpp
|
||||||
@ -252,7 +252,7 @@ freebsd*)
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
netbsd*)
|
netbsd*)
|
||||||
SUPPORTS_NATIVE_M68K=yes
|
CAN_NATIVE_M68K=yes
|
||||||
;;
|
;;
|
||||||
solaris*)
|
solaris*)
|
||||||
AUDIOSRC=Solaris/audio_solaris.cpp
|
AUDIOSRC=Solaris/audio_solaris.cpp
|
||||||
@ -265,6 +265,13 @@ irix*)
|
|||||||
;;
|
;;
|
||||||
esac
|
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
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
|
||||||
dnl Serial, ethernet and audio support needs pthreads
|
dnl Serial, ethernet and audio support needs pthreads
|
||||||
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
|
||||||
@ -387,6 +394,43 @@ if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
|
|||||||
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
|
||||||
fi
|
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -397,6 +441,9 @@ if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" =
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Determine the addressing mode to use
|
dnl Determine the addressing mode to use
|
||||||
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||||
|
ADDRESSING_MODE="real"
|
||||||
|
else
|
||||||
ADDRESSING_MODE=""
|
ADDRESSING_MODE=""
|
||||||
AC_MSG_CHECKING([for the addressing mode to use])
|
AC_MSG_CHECKING([for the addressing mode to use])
|
||||||
for am in $ADDRESSING_TEST_ORDER; do
|
for am in $ADDRESSING_TEST_ORDER; do
|
||||||
@ -450,6 +497,7 @@ if [[ "x$ADDRESSING_MODE" = "x" ]]; then
|
|||||||
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
|
||||||
ADDRESSING_MODE="memory banks"
|
ADDRESSING_MODE="memory banks"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Since real and direct addressing modes automatically activate VOSF,
|
dnl Since real and direct addressing modes automatically activate VOSF,
|
||||||
dnl I put this test here.
|
dnl I put this test here.
|
||||||
@ -489,7 +537,6 @@ fi
|
|||||||
|
|
||||||
dnl Select appropriate CPU source and REGPARAM define.
|
dnl Select appropriate CPU source and REGPARAM define.
|
||||||
ASM_OPTIMIZATIONS=none
|
ASM_OPTIMIZATIONS=none
|
||||||
WANT_NATIVE_M68K=no
|
|
||||||
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
|
||||||
FPUSRCS="../uae_cpu/fpp.cpp"
|
FPUSRCS="../uae_cpu/fpp.cpp"
|
||||||
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
|
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
|
||||||
;;
|
;;
|
||||||
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
|
dnl Native m68k, no emulation
|
||||||
CPUSRCS=""
|
CPUINCLUDES="-I../native_cpu"
|
||||||
AC_DEFINE(ENABLE_NATIVE_M68K)
|
CPUSRCS="asm_support.s"
|
||||||
WANT_NATIVE_M68K=yes
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl UAE CPU sources for all non-m68k-native architectures.
|
dnl UAE CPU sources for all non-m68k-native architectures.
|
||||||
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
|
||||||
CPUINCLUDES="-I../uae_cpu"
|
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"
|
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
|
fi
|
||||||
|
|
||||||
dnl Remove the "-g" option if set for GCC.
|
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)
|
#if defined(HAVE_SIGINFO_T)
|
||||||
|
|
||||||
static void Screen_fault_handler(int, siginfo_t * sip, void *)
|
static void Screen_fault_handler(int, siginfo_t * sip, void *)
|
||||||
{
|
{
|
||||||
D(bug("Screen_fault_handler: ADDR=0x%08X\n", sip->si_addr));
|
D(bug("Screen_fault_handler: ADDR=0x%08X\n", sip->si_addr));
|
||||||
do_handle_screen_fault((uintptr)sip->si_addr);
|
do_handle_screen_fault((uintptr)sip->si_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_SIGCONTEXT_SUBTERFUGE)
|
#elif defined(HAVE_SIGCONTEXT_SUBTERFUGE)
|
||||||
|
|
||||||
# if defined(__i386__) && defined(__linux__)
|
# if defined(__i386__) && defined(__linux__)
|
||||||
static void Screen_fault_handler(int, struct sigcontext scs)
|
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));
|
D(bug("Screen_fault_handler: ADDR=0x%08X from IP=0x%08X\n", scs.cr2, scs.eip));
|
||||||
do_handle_screen_fault((uintptr)scs.cr2);
|
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
|
# else
|
||||||
# error "No suitable subterfuge for Video on SEGV signals"
|
# error "No suitable subterfuge for Video on SEGV signals"
|
||||||
# endif
|
# endif
|
||||||
@ -344,7 +372,45 @@ static inline void update_display_window_vosf(void)
|
|||||||
|
|
||||||
// Check for first column from left and first column
|
// Check for first column from left and first column
|
||||||
// from right that have changed
|
// from right that have changed
|
||||||
int x1 = VideoMonitor.x * bytes_per_pixel - 1;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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++) {
|
for (j = y1; j <= y2; j++) {
|
||||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||||
@ -357,7 +423,7 @@ static inline void update_display_window_vosf(void)
|
|||||||
}
|
}
|
||||||
x1 /= bytes_per_pixel;
|
x1 /= bytes_per_pixel;
|
||||||
|
|
||||||
int x2 = x1 * bytes_per_pixel;
|
x2 = x1 * bytes_per_pixel;
|
||||||
for (j = y2; j >= y1; j--) {
|
for (j = y2; j >= y1; j--) {
|
||||||
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
uint8 * const p1 = &the_buffer[j * bytes_per_row];
|
||||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||||
@ -369,16 +435,16 @@ static inline void update_display_window_vosf(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
x2 /= bytes_per_pixel;
|
x2 /= bytes_per_pixel;
|
||||||
|
width = x2 - x1 + 1;
|
||||||
|
|
||||||
// Update the_host_buffer and copy of the_buffer
|
// 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;
|
i = y1 * bytes_per_row + x1 * bytes_per_pixel;
|
||||||
for (j = y1; j <= y2; j++) {
|
for (j = y1; j <= y2; j++) {
|
||||||
do_update_framebuffer(the_host_buffer + i, the_buffer + i, bytes_per_pixel * width);
|
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);
|
memcpy(the_buffer_copy + i, the_buffer + i, bytes_per_pixel * width);
|
||||||
i += bytes_per_row;
|
i += bytes_per_row;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (have_shm)
|
if (have_shm)
|
||||||
XShmPutImage(x_display, the_win, the_gc, img, x1, y1, x1, y1, width, height, 0);
|
XShmPutImage(x_display, the_win, the_gc, img, x1, y1, x1, y1, width, height, 0);
|
||||||
|
@ -1745,7 +1745,7 @@ static void update_display_static(void)
|
|||||||
// Check for first column from left and first column from right that have changed
|
// Check for first column from left and first column from right that have changed
|
||||||
if (high) {
|
if (high) {
|
||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
x1 = VideoMonitor.x;
|
x1 = VideoMonitor.x - 1;
|
||||||
for (j=y1; j<=y2; j++) {
|
for (j=y1; j<=y2; j++) {
|
||||||
p = &the_buffer[j * bytes_per_row];
|
p = &the_buffer[j * bytes_per_row];
|
||||||
p2 = &the_buffer_copy[j * bytes_per_row];
|
p2 = &the_buffer_copy[j * bytes_per_row];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user