[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[813] vendor/fuse-emulator/current
Brought to you by:
fredm
From: <fr...@us...> - 2016-07-17 12:20:12
|
Revision: 813 http://sourceforge.net/p/fuse-for-macosx/code/813 Author: fredm Date: 2016-07-17 12:20:07 +0000 (Sun, 17 Jul 2016) Log Message: ----------- Load . into vendor/fuse-emulator/current. Modified Paths: -------------- vendor/fuse-emulator/current/fuse/ChangeLog vendor/fuse-emulator/current/fuse/Makefile.am vendor/fuse-emulator/current/fuse/README vendor/fuse-emulator/current/fuse/compat/Makefile.am vendor/fuse-emulator/current/fuse/configure.ac vendor/fuse-emulator/current/fuse/data/fuse.desktop.in vendor/fuse-emulator/current/fuse/debugger/Makefile.am vendor/fuse-emulator/current/fuse/debugger/command.c vendor/fuse-emulator/current/fuse/debugger/commandl.l vendor/fuse-emulator/current/fuse/debugger/commandy.y vendor/fuse-emulator/current/fuse/debugger/debugger.c vendor/fuse-emulator/current/fuse/debugger/debugger.h vendor/fuse-emulator/current/fuse/debugger/debugger_internals.h vendor/fuse-emulator/current/fuse/debugger/event.c vendor/fuse-emulator/current/fuse/debugger/expression.c vendor/fuse-emulator/current/fuse/display.c vendor/fuse-emulator/current/fuse/display.h vendor/fuse-emulator/current/fuse/event.c vendor/fuse-emulator/current/fuse/event.h vendor/fuse-emulator/current/fuse/fuse.c vendor/fuse-emulator/current/fuse/hacking/ChangeLog vendor/fuse-emulator/current/fuse/machine.c vendor/fuse-emulator/current/fuse/machine.h vendor/fuse-emulator/current/fuse/machines/machines_periph.c vendor/fuse-emulator/current/fuse/machines/machines_periph.h vendor/fuse-emulator/current/fuse/man/fuse.1 vendor/fuse-emulator/current/fuse/memory.c vendor/fuse-emulator/current/fuse/memory.h vendor/fuse-emulator/current/fuse/mempool.c vendor/fuse-emulator/current/fuse/mempool.h vendor/fuse-emulator/current/fuse/peripherals/ay.c vendor/fuse-emulator/current/fuse/peripherals/ay.h vendor/fuse-emulator/current/fuse/peripherals/disk/beta.c vendor/fuse-emulator/current/fuse/peripherals/disk/beta.h vendor/fuse-emulator/current/fuse/peripherals/disk/didaktik.c vendor/fuse-emulator/current/fuse/peripherals/disk/didaktik.h vendor/fuse-emulator/current/fuse/peripherals/disk/disciple.c vendor/fuse-emulator/current/fuse/peripherals/disk/disciple.h vendor/fuse-emulator/current/fuse/peripherals/disk/fdd.c vendor/fuse-emulator/current/fuse/peripherals/disk/fdd.h vendor/fuse-emulator/current/fuse/peripherals/disk/opus.c vendor/fuse-emulator/current/fuse/peripherals/disk/opus.h vendor/fuse-emulator/current/fuse/peripherals/disk/plusd.c vendor/fuse-emulator/current/fuse/peripherals/disk/plusd.h vendor/fuse-emulator/current/fuse/peripherals/fuller.c vendor/fuse-emulator/current/fuse/peripherals/fuller.h vendor/fuse-emulator/current/fuse/peripherals/ide/divide.c vendor/fuse-emulator/current/fuse/peripherals/ide/divide.h vendor/fuse-emulator/current/fuse/peripherals/ide/simpleide.c vendor/fuse-emulator/current/fuse/peripherals/ide/simpleide.h vendor/fuse-emulator/current/fuse/peripherals/ide/zxatasp.c vendor/fuse-emulator/current/fuse/peripherals/ide/zxatasp.h vendor/fuse-emulator/current/fuse/peripherals/ide/zxcf.c vendor/fuse-emulator/current/fuse/peripherals/ide/zxcf.h vendor/fuse-emulator/current/fuse/peripherals/if1.c vendor/fuse-emulator/current/fuse/peripherals/if1.h vendor/fuse-emulator/current/fuse/peripherals/if2.c vendor/fuse-emulator/current/fuse/peripherals/if2.h vendor/fuse-emulator/current/fuse/peripherals/joystick.c vendor/fuse-emulator/current/fuse/peripherals/kempmouse.c vendor/fuse-emulator/current/fuse/peripherals/kempmouse.h vendor/fuse-emulator/current/fuse/peripherals/melodik.c vendor/fuse-emulator/current/fuse/peripherals/melodik.h vendor/fuse-emulator/current/fuse/peripherals/printer.c vendor/fuse-emulator/current/fuse/peripherals/printer.h vendor/fuse-emulator/current/fuse/peripherals/scld.c vendor/fuse-emulator/current/fuse/peripherals/scld.h vendor/fuse-emulator/current/fuse/peripherals/speccyboot.c vendor/fuse-emulator/current/fuse/peripherals/speccyboot.h vendor/fuse-emulator/current/fuse/peripherals/specdrum.c vendor/fuse-emulator/current/fuse/peripherals/specdrum.h vendor/fuse-emulator/current/fuse/peripherals/spectranet.c vendor/fuse-emulator/current/fuse/peripherals/spectranet.h vendor/fuse-emulator/current/fuse/peripherals/ula.c vendor/fuse-emulator/current/fuse/peripherals/ula.h vendor/fuse-emulator/current/fuse/peripherals/usource.c vendor/fuse-emulator/current/fuse/peripherals/usource.h vendor/fuse-emulator/current/fuse/profile.c vendor/fuse-emulator/current/fuse/profile.h vendor/fuse-emulator/current/fuse/psg.c vendor/fuse-emulator/current/fuse/psg.h vendor/fuse-emulator/current/fuse/rzx.c vendor/fuse-emulator/current/fuse/rzx.h vendor/fuse-emulator/current/fuse/settings-header.pl vendor/fuse-emulator/current/fuse/settings.pl vendor/fuse-emulator/current/fuse/slt.c vendor/fuse-emulator/current/fuse/slt.h vendor/fuse-emulator/current/fuse/sound/alsasound.c vendor/fuse-emulator/current/fuse/sound.c vendor/fuse-emulator/current/fuse/sound.h vendor/fuse-emulator/current/fuse/spectrum.c vendor/fuse-emulator/current/fuse/spectrum.h vendor/fuse-emulator/current/fuse/tape.c vendor/fuse-emulator/current/fuse/tape.h vendor/fuse-emulator/current/fuse/timer/timer.c vendor/fuse-emulator/current/fuse/timer/timer.h vendor/fuse-emulator/current/fuse/ui/widget/menu.c vendor/fuse-emulator/current/fuse/ui/widget/query.c vendor/fuse-emulator/current/fuse/unittests/unittests.c vendor/fuse-emulator/current/fuse/utils.c vendor/fuse-emulator/current/fuse/utils.h vendor/fuse-emulator/current/fuse/z80/Makefile.am vendor/fuse-emulator/current/fuse/z80/coretest.c vendor/fuse-emulator/current/fuse/z80/z80.c vendor/fuse-emulator/current/fuse/z80/z80.h vendor/fuse-emulator/current/libspectrum/ChangeLog vendor/fuse-emulator/current/libspectrum/Makefile.am vendor/fuse-emulator/current/libspectrum/README vendor/fuse-emulator/current/libspectrum/configure.ac vendor/fuse-emulator/current/libspectrum/doc/libspectrum.3 vendor/fuse-emulator/current/libspectrum/doc/libspectrum.txt vendor/fuse-emulator/current/libspectrum/hacking/ChangeLog vendor/fuse-emulator/current/libspectrum/make-perl.c vendor/fuse-emulator/current/libspectrum/myglib/garray.c Added Paths: ----------- vendor/fuse-emulator/current/fuse/debugger/system_variable.c vendor/fuse-emulator/current/fuse/infrastructure/ vendor/fuse-emulator/current/fuse/infrastructure/Makefile.am vendor/fuse-emulator/current/fuse/infrastructure/startup_manager.c vendor/fuse-emulator/current/fuse/infrastructure/startup_manager.h vendor/fuse-emulator/current/fuse/z80/z80_debugger_variables.c vendor/fuse-emulator/current/fuse/z80/z80_internals.h Removed Paths: ------------- vendor/fuse-emulator/current/fuse/compat/mkstemp.c Modified: vendor/fuse-emulator/current/fuse/ChangeLog =================================================================== --- vendor/fuse-emulator/current/fuse/ChangeLog 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/ChangeLog 2016-07-17 12:20:07 UTC (rev 813) @@ -1,3 +1,33 @@ +2016-07-?? Philip Kendall <phi...@sh...> + + * Fuse 1.2.1 released. + + * Emulation core improvements: + * Fix bugs when the detect loaders feature is being used (thanks, Lee + Tonks and windale) (Fredrick Meunier). + + * Debugger improvements: + * Remove the need for "%" when accessing system variables (Philip + Kendall). + * Add Z80 registers as debugger variables (Philip Kendall). + * Expose last byte written to the ULA, tstates since interrupt, + primary and secondary memory control ports as debugger system + variables (Philip Kendall). + * Make breakpoints on events honour lifetime (Sergio Baldoví). + * Extend breakpoints on paging events to more peripherals: Beta 128, + +D, Didaktik 80, DISCiPLE, Opus Discovery and SpeccyBoot (Sergio + Baldoví). + * Split +D memory sources into RAM and ROM sections (Sergio Baldoví). + * Coalesce +D and DISCiPLE RAM pages so they show as 8K pages (Sergio + Baldoví). + + * Miscellaneous improvements: + * Update GNOME .desktop file (Alberto Garcia). + * Add an emulator module startup manager to automatically handle + dependency issues (Philip Kendall). + * Fix crash on widget UIs when hitting the close icon on the title bar + several times (Sergio Baldoví). + 2016-06-06 Philip Kendall <phi...@sh...> * Fuse 1.2.0 released. @@ -1295,4 +1325,4 @@ * Version 0.1.0 released. -$Id: ChangeLog 5594 2016-06-06 10:46:46Z fredm $ +$Id: ChangeLog 5677 2016-07-09 13:58:02Z fredm $ Modified: vendor/fuse-emulator/current/fuse/Makefile.am =================================================================== --- vendor/fuse-emulator/current/fuse/Makefile.am 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/Makefile.am 2016-07-17 12:20:07 UTC (rev 813) @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in ## Copyright (c) 1999-2015 Philip Kendall -## $Id: Makefile.am 5537 2016-05-29 06:17:00Z sbaldovi $ +## $Id: Makefile.am 5677 2016-07-09 13:58:02Z fredm $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -170,6 +170,7 @@ include data/Makefile.am include debugger/Makefile.am include hacking/Makefile.am +include infrastructure/Makefile.am include lib/Makefile.am include machines/Makefile.am include man/Makefile.am Modified: vendor/fuse-emulator/current/fuse/README =================================================================== --- vendor/fuse-emulator/current/fuse/README 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/README 2016-07-17 12:20:07 UTC (rev 813) @@ -1,4 +1,4 @@ -The Free Unix Spectrum Emulator (Fuse) 1.2.0 +The Free Unix Spectrum Emulator (Fuse) 1.2.1 ============================================ Fuse (the Free Unix Spectrum Emulator) was originally, and somewhat @@ -108,6 +108,6 @@ <http://www.worldofspectrum.org/forums/>. Philip Kendall <phi...@sh...> -6th June, 2016 +10th July, 2016 -$Id: README 5594 2016-06-06 10:46:46Z fredm $ +$Id: README 5681 2016-07-10 13:06:44Z fredm $ Modified: vendor/fuse-emulator/current/fuse/compat/Makefile.am =================================================================== --- vendor/fuse-emulator/current/fuse/compat/Makefile.am 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/compat/Makefile.am 2016-07-17 12:20:07 UTC (rev 813) @@ -2,7 +2,7 @@ ## Copyright (c) 2003-2013 Philip Kendall ## Copyright (c) 2015 Sergio Baldoví -## $Id: Makefile.am 5434 2016-05-01 04:22:45Z fredm $ +## $Id: Makefile.am 5677 2016-07-09 13:58:02Z fredm $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -32,10 +32,6 @@ fuse_SOURCES += compat/getopt.c compat/getopt1.c endif -if COMPAT_MKSTEMP -fuse_SOURCES += compat/mkstemp.c -endif - ## Amiga routines if COMPAT_AMIGA fuse_SOURCES += \ Deleted: vendor/fuse-emulator/current/fuse/compat/mkstemp.c =================================================================== --- vendor/fuse-emulator/current/fuse/compat/mkstemp.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/compat/mkstemp.c 2016-07-17 12:20:07 UTC (rev 813) @@ -1,108 +0,0 @@ -/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - Modifications (c) 2003 Philip Kendall - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA. */ - -#include <config.h> - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <unistd.h> - -#include <libspectrum.h> - -#define uint64_t libspectrum_qword - -/* These are the characters used in temporary filenames. */ -static const char letters[] = -"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - -/* Generate a temporary file name based on TMPL. TMPL must match the - rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed - does not exist at the time of the call to __gen_tempname. TMPL is - overwritten with the result. - - We use a clever algorithm to get hard-to-predict names. */ -int -mkstemp (char *tmpl) -{ - int len; - char *XXXXXX; - static uint64_t value; - unsigned int count; - int fd = -1; - int save_errno = errno; - - /* A lower bound on the number of temporary files to attempt to - generate. The maximum total number of temporary file names that - can exist for a given template is 62**6. It should never be - necessary to try all these combinations. Instead if a reasonable - number of names is tried (we define reasonable as 62**3) fail to - give the system administrator the chance to remove the problems. */ - unsigned int attempts = 62 * 62 * 62; - - len = strlen (tmpl); - if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) - { - errno = EINVAL; - return -1; - } - - /* This is where the Xs start. */ - XXXXXX = &tmpl[len - 6]; - - /* Get some more or less random data. */ - value += time (NULL) ^ getpid (); - - for (count = 0; count < attempts; value += 7777, ++count) - { - uint64_t v = value; - - /* Fill in the random bits. */ - XXXXXX[0] = letters[v % 62]; - v /= 62; - XXXXXX[1] = letters[v % 62]; - v /= 62; - XXXXXX[2] = letters[v % 62]; - v /= 62; - XXXXXX[3] = letters[v % 62]; - v /= 62; - XXXXXX[4] = letters[v % 62]; - v /= 62; - XXXXXX[5] = letters[v % 62]; - - fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | O_BINARY, S_IRUSR | S_IWUSR); - - if (fd >= 0) - { - errno = save_errno; - return fd; - } - else if (errno != EEXIST) - return -1; - } - - /* We got out of the loop because we ran out of combinations to try. */ - errno = EEXIST; - return -1; -} Modified: vendor/fuse-emulator/current/fuse/configure.ac =================================================================== --- vendor/fuse-emulator/current/fuse/configure.ac 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/configure.ac 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Id: configure.ac 5594 2016-06-06 10:46:46Z fredm $ +dnl $Id: configure.ac 5681 2016-07-10 13:06:44Z fredm $ dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -20,12 +20,12 @@ dnl E-mail: phi...@sh... dnl Package version -m4_define([fuse_version], [1.2.0]) +m4_define([fuse_version], [1.2.1-pre1]) dnl Product full version m4_define([fuse_major_version], [1]) m4_define([fuse_minor_version], [2]) -m4_define([fuse_micro_version], [0]) +m4_define([fuse_micro_version], [1]) m4_define([fuse_nano_version], [0]) m4_define([fuse_full_version], [fuse_major_version.fuse_minor_version.fuse_micro_version.fuse_nano_version]) m4_define([fuse_rc_version], [fuse_major_version,fuse_minor_version,fuse_micro_version,fuse_nano_version]) @@ -104,7 +104,7 @@ AC_C_INLINE dnl Checks for library functions. -AC_CHECK_FUNCS(dirname geteuid getopt_long mkstemp fsync) +AC_CHECK_FUNCS(dirname geteuid getopt_long fsync) AC_CHECK_LIB([m],[cos]) dnl Allow the user to say that various libraries are in one place @@ -834,10 +834,6 @@ esac fi AM_CONDITIONAL(COMPAT_GETOPT, test "$compat_getopt" = yes) -if test "$ac_cv_func_mkstemp" = no; then - missing_routines="$missing_routines"'mkstemp ' -fi -AM_CONDITIONAL(COMPAT_MKSTEMP, test "$ac_cv_func_mkstemp" = no) if test "x$missing_routines" = x; then missing_routines='(none)' fi Modified: vendor/fuse-emulator/current/fuse/data/fuse.desktop.in =================================================================== --- vendor/fuse-emulator/current/fuse/data/fuse.desktop.in 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/data/fuse.desktop.in 2016-07-17 12:20:07 UTC (rev 813) @@ -2,9 +2,10 @@ Version=1.0 Type=Application Categories=Game;Emulator;GTK; -Name=Fuse Spectrum Emulator +Name=Fuse +GenericName=Spectrum Emulator Comment=Emulator of the 1980s ZX Spectrum home computer and its various clones MimeType=@MIME_TYPES@ Exec=fuse %f Icon=fuse - +Keywords=sinclair;zx;game;retro; Modified: vendor/fuse-emulator/current/fuse/debugger/Makefile.am =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/Makefile.am 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/Makefile.am 2016-07-17 12:20:07 UTC (rev 813) @@ -1,8 +1,8 @@ ## Process this file with automake to produce Makefile.in -## Copyright (c) 2001-2008 Philip Kendall +## Copyright (c) 2001-2016 Philip Kendall ## Copyright (c) 2015 Sergio Baldoví -## $Id: Makefile.am 5434 2016-05-01 04:22:45Z fredm $ +## $Id: Makefile.am 5677 2016-07-09 13:58:02Z fredm $ ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ debugger/disassemble.c \ debugger/event.c \ debugger/expression.c \ + debugger/system_variable.c \ debugger/variable.c debugger/commandl.c: debugger/commandy.c Modified: vendor/fuse-emulator/current/fuse/debugger/command.c =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/command.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/command.c 2016-07-17 12:20:07 UTC (rev 813) @@ -95,51 +95,6 @@ } } -/* Convert a register name to a useful index value */ -int -debugger_register_hash( const char *name ) -{ - int hash = 0x0000, primed = 0; - size_t length; - const char *ptr; - - length = strlen( name ); - - if( name[ length - 1 ] == '\'' ) { primed = 1; length--; } - - for( ptr = name; ptr < name + length; ptr++ ) { - hash <<= 8; hash |= tolower( *ptr ); - } - - if( primed ) hash |= 0x8000; - - switch( hash ) { - case 0x0061: case 0x8061: /* A, A' */ - case 0x0066: case 0x8066: /* F, F' */ - case 0x0062: case 0x8062: /* B, B' */ - case 0x0063: case 0x8063: /* C, C' */ - case 0x0064: case 0x8064: /* D, D' */ - case 0x0065: case 0x8065: /* E, E' */ - case 0x0068: case 0x8068: /* H, H' */ - case 0x006c: case 0x806c: /* L, L' */ - case 0x0069: case 0x0072: /* I, R */ - case 0x6166: case 0xe166: /* AF, AF' */ - case 0x6263: case 0xe263: /* BC, BC' */ - case 0x6465: case 0xe465: /* DE, DE' */ - case 0x686c: case 0xe86c: /* HL, HL' */ - case 0x7370: /* SP */ - case 0x7063: /* PC */ - case 0x6978: /* IX */ - case 0x6979: /* IY */ - case 0x696d: /* IM */ - case 0x69666631: /* IFF1 */ - case 0x69666632: /* IFF2 */ - return hash; - - default: return -1; - } -} - /* Utility functions called by the bison parser */ /* The error callback if yyparse finds an error */ @@ -149,161 +104,13 @@ ui_error( UI_ERROR_ERROR, "Invalid debugger command: %s", s ); } -/* Get the value of a register */ -libspectrum_word -debugger_register_get( int which ) -{ - switch( which ) { - - /* 8-bit registers */ - case 0x0061: return A; - case 0x8061: return A_; - case 0x0066: return F; - case 0x8066: return F_; - case 0x0062: return B; - case 0x8062: return B_; - case 0x0063: return C; - case 0x8063: return C_; - case 0x0064: return D; - case 0x8064: return D_; - case 0x0065: return E; - case 0x8065: return E_; - case 0x0068: return H; - case 0x8068: return H_; - case 0x006c: return L; - case 0x806c: return L_; - - case 0x0069: return I; - case 0x0072: return ( R7 & 0x80 ) | ( R & 0x7f ); - - /* 16-bit registers */ - case 0x6166: return AF; - case 0xe166: return AF_; - case 0x6263: return BC; - case 0xe263: return BC_; - case 0x6465: return DE; - case 0xe465: return DE_; - case 0x686c: return HL; - case 0xe86c: return HL_; - - case 0x7370: return SP; - case 0x7063: return PC; - case 0x6978: return IX; - case 0x6979: return IY; - - /* interrupt flags */ - case 0x696d: return IM; - case 0x69666631: return IFF1; - case 0x69666632: return IFF2; - - default: - ui_error( UI_ERROR_ERROR, "attempt to get unknown register '%d'", which ); - return 0; - } -} - -/* Set the value of a register */ +/* Set the value of a register + + Now just a pass through to the appropriate system variable. + This function should be removed in Fuse 1.4 */ void -debugger_register_set( int which, libspectrum_word value ) +debugger_register_set( const char *which, libspectrum_word value ) { - switch( which ) { - - /* 8-bit registers */ - case 0x0061: A = value; break; - case 0x8061: A_ = value; break; - case 0x0066: F = value; break; - case 0x8066: F_ = value; break; - case 0x0062: B = value; break; - case 0x8062: B_ = value; break; - case 0x0063: C = value; break; - case 0x8063: C_ = value; break; - case 0x0064: D = value; break; - case 0x8064: D_ = value; break; - case 0x0065: E = value; break; - case 0x8065: E_ = value; break; - case 0x0068: H = value; break; - case 0x8068: H_ = value; break; - case 0x006c: L = value; break; - case 0x806c: L_ = value; break; - - case 0x0069: I = value; break; - case 0x0072: R = R7 = value; break; - - /* 16-bit registers */ - case 0x6166: AF = value; break; - case 0xe166: AF_ = value; break; - case 0x6263: BC = value; break; - case 0xe263: BC_ = value; break; - case 0x6465: DE = value; break; - case 0xe465: DE_ = value; break; - case 0x686c: HL = value; break; - case 0xe86c: HL_ = value; break; - - case 0x7370: SP = value; break; - case 0x7063: PC = value; break; - case 0x6978: IX = value; break; - case 0x6979: IY = value; break; - - /* interrupt flags */ - case 0x696d: if( value >= 0 && value <=2 ) IM = value; break; - case 0x69666631: IFF1 = !!value; break; - case 0x69666632: IFF2 = !!value; break; - - default: - ui_error( UI_ERROR_ERROR, "attempt to set unknown register '%d'", which ); - break; - } + debugger_system_variable_set( debugger_z80_system_variable_type, which, + value ); } - -/* Get the textual representation of a register */ -const char * -debugger_register_text( int which ) -{ - switch( which ) { - - /* 8-bit registers */ - case 0x0061: return "A"; - case 0x8061: return "A'"; - case 0x0066: return "F"; - case 0x8066: return "F'"; - case 0x0062: return "B"; - case 0x8062: return "B'"; - case 0x0063: return "C"; - case 0x8063: return "C'"; - case 0x0064: return "D"; - case 0x8064: return "D'"; - case 0x0065: return "E"; - case 0x8065: return "E'"; - case 0x0068: return "H"; - case 0x8068: return "H'"; - case 0x006c: return "L"; - case 0x806c: return "L'"; - - case 0x0069: return "I"; - case 0x0072: return "R"; - - /* 16-bit registers */ - case 0x6166: return "AF"; - case 0xe166: return "AF'"; - case 0x6263: return "BC"; - case 0xe263: return "BC'"; - case 0x6465: return "DE"; - case 0xe465: return "DE'"; - case 0x686c: return "HL"; - case 0xe86c: return "HL'"; - - case 0x7370: return "SP"; - case 0x7063: return "PC"; - case 0x6978: return "IX"; - case 0x6979: return "IY"; - - /* interrupt flags */ - case 0x696d: return "IM"; - case 0x69666631: return "IFF1"; - case 0x69666632: return "IFF2"; - - default: - ui_error( UI_ERROR_ERROR, "attempt to get unknown register '%d'", which ); - return "(invalid)"; - } -} Modified: vendor/fuse-emulator/current/fuse/debugger/commandl.l =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/commandl.l 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/commandl.l 2016-07-17 12:20:07 UTC (rev 813) @@ -1,8 +1,8 @@ /* commandl.l: Debugger command lexical scanner - Copyright (c) 2002-2013 Philip Kendall + Copyright (c) 2002-2016 Philip Kendall Copyright (c) 2015 Sergio Baldoví - $Id: commandl.l 5539 2016-05-29 10:49:51Z fredm $ + $Id: commandl.l 5677 2016-07-09 13:58:02Z fredm $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ %} -ID [a-z]([a-z0-9]|\\[ ])+ +ID [a-z]([a-z0-9]|\\[ ])* %option caseless @@ -83,23 +83,10 @@ ti|tim|time { return TIME; } w|wr|wri|writ|write { return WRITE; } -a|b|c|d|e|f|h|l { yylval.reg = debugger_register_hash( yytext ); - return DEBUGGER_REGISTER; } +a|b|c|d|e|f|h|l|af|bc|de|hl|sp|pc|ix|iy|i|r|im|iff1|iff2|"a'"|"b'"|"c'"|"d'"|"e'"|"f'"|"h'"|"l'"|"af\'"|"bc\'"|"de\'"|"hl\'" { + yylval.string = mempool_strdup( debugger_memory_pool, yytext ); + return DEBUGGER_REGISTER; } -"a'"|"b'"|"c'"|"d'"|"e'"|"f'"|"h'"|"l'" { - yylval.reg = debugger_register_hash( yytext ); - return DEBUGGER_REGISTER; } - -af|bc|de|hl|"af\'"|"bc\'"|"de\'"|"hl\'" { - yylval.reg = debugger_register_hash( yytext ); - return DEBUGGER_REGISTER; } - -sp|pc|ix|iy|i|r { yylval.reg = debugger_register_hash( yytext ); - return DEBUGGER_REGISTER; } - -im|iff1|iff2 { yylval.reg = debugger_register_hash( yytext ); - return DEBUGGER_REGISTER; } - "(" { return '('; } ")" { return ')'; } Modified: vendor/fuse-emulator/current/fuse/debugger/commandy.y =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/commandy.y 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/commandy.y 2016-07-17 12:20:07 UTC (rev 813) @@ -1,8 +1,8 @@ /* commandy.y: Parse a debugger command - Copyright (c) 2002-2015 Philip Kendall + Copyright (c) 2002-2016 Philip Kendall Copyright (c) 2015 Sergio Baldoví - $Id: commandy.y 5539 2016-05-29 10:49:51Z fredm $ + $Id: commandy.y 5677 2016-07-09 13:58:02Z fredm $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,6 @@ %union { int token; - int reg; libspectrum_dword integer; char *string; @@ -98,7 +97,7 @@ %token TIME %token WRITE -%token <reg> DEBUGGER_REGISTER +%token <string> DEBUGGER_REGISTER %token <integer> NUMBER @@ -192,6 +191,10 @@ | SET NUMBER number { debugger_poke( $2, $3 ); } | SET DEBUGGER_REGISTER number { debugger_register_set( $2, $3 ); } | SET VARIABLE number { debugger_variable_set( $2, $3 ); } + | SET STRING ':' STRING number { debugger_system_variable_set( $2, $4, $5 ); } + /* Temporary hack while we deprecate the old unprefixed style + of register access. This should be removed in Fuse 1.4 */ + | SET STRING ':' DEBUGGER_REGISTER number { debugger_system_variable_set( $2, $4, $5 ); } | STEP { debugger_step(); } ; @@ -246,6 +249,14 @@ | DEBUGGER_REGISTER { $$ = debugger_expression_new_register( $1, debugger_memory_pool ); if( !$$ ) YYABORT; } + | STRING ':' STRING { $$ = debugger_expression_new_system_variable( $1, $3, debugger_memory_pool ); + if( !$$ ) YYABORT; + } + /* Temporary hack while we deprecate the old unprefixed style + of register access. This should be removed in Fuse 1.4 */ + | STRING ':' DEBUGGER_REGISTER { $$ = debugger_expression_new_system_variable( $1, $3, debugger_memory_pool ); + if( !$$ ) YYABORT; + } | VARIABLE { $$ = debugger_expression_new_variable( $1, debugger_memory_pool ); if( !$$ ) YYABORT; } Modified: vendor/fuse-emulator/current/fuse/debugger/debugger.c =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/debugger.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/debugger.c 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ /* debugger.c: Fuse's monitor/debugger - Copyright (c) 2002-2011 Philip Kendall + Copyright (c) 2002-2016 Philip Kendall $Id$ @@ -29,6 +29,7 @@ #include "debugger_internals.h" #include "event.h" #include "fuse.h" +#include "infrastructure/startup_manager.h" #include "memory.h" #include "mempool.h" #include "periph.h" @@ -48,8 +49,11 @@ /* The event type used for time breakpoints */ int debugger_breakpoint_event; -void -debugger_init( void ) +/* The system variable type used for Z80 registers */ +const char *debugger_z80_system_variable_type = "z80"; + +static int +debugger_init( void *context ) { debugger_breakpoints = NULL; debugger_output_base = 16; @@ -59,8 +63,11 @@ debugger_breakpoint_event = event_register( debugger_breakpoint_time_fn, "Breakpoint" ); debugger_event_init(); + debugger_system_variable_init(); debugger_variable_init(); debugger_reset(); + + return 0; } void @@ -70,14 +77,26 @@ debugger_mode = DEBUGGER_MODE_INACTIVE; } -int +static void debugger_end( void ) { debugger_breakpoint_remove_all(); debugger_variable_end(); + debugger_system_variable_end(); debugger_event_end(); +} - return 0; +void +debugger_register_startup( void ) +{ + startup_manager_module dependencies[] = { + STARTUP_MANAGER_MODULE_EVENT, + STARTUP_MANAGER_MODULE_MEMPOOL, + STARTUP_MANAGER_MODULE_SETUID, + }; + startup_manager_register( STARTUP_MANAGER_MODULE_DEBUGGER, dependencies, + ARRAY_SIZE( dependencies ), debugger_init, NULL, + debugger_end ); } /* Activate the debugger */ Modified: vendor/fuse-emulator/current/fuse/debugger/debugger.h =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/debugger.h 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/debugger.h 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ /* debugger.h: Fuse's monitor/debugger - Copyright (c) 2002-2013 Philip Kendall + Copyright (c) 2002-2016 Philip Kendall $Id$ @@ -49,11 +49,10 @@ /* Which base should we display things in */ extern int debugger_output_base; -void debugger_init( void ); +void debugger_register_startup( void ); + void debugger_reset( void ); -int debugger_end( void ); - int debugger_trap( void ); /* Activate the debugger */ int debugger_step( void ); /* Single step */ @@ -85,4 +84,13 @@ /* Exit the emulator */ void debugger_exit_emulator( void ); +/* Debugger system variables */ +typedef libspectrum_dword (*debugger_get_system_variable_fn_t)( void ); +typedef void (*debugger_set_system_variable_fn_t)( libspectrum_dword value ); + +void debugger_system_variable_register( + const char *type, const char *detail, + debugger_get_system_variable_fn_t get, + debugger_set_system_variable_fn_t set ); + #endif /* #ifndef FUSE_DEBUGGER_H */ Modified: vendor/fuse-emulator/current/fuse/debugger/debugger_internals.h =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/debugger_internals.h 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/debugger_internals.h 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ /* debugger_internals.h: The internals of Fuse's monitor/debugger - Copyright (c) 2002-2011 Philip Kendall + Copyright (c) 2002-2016 Philip Kendall $Id$ @@ -34,6 +34,9 @@ /* The event type used to trigger time breakpoints */ extern int debugger_breakpoint_event; +/* The system variable type used for Z80 registers */ +extern const char *debugger_z80_system_variable_type; + void debugger_breakpoint_time_fn( libspectrum_dword tstates, int type, void *user_data ); int debugger_breakpoint_remove( size_t id ); @@ -49,10 +52,7 @@ int debugger_poke( libspectrum_word address, libspectrum_byte value ); int debugger_port_write( libspectrum_word address, libspectrum_byte value ); -int debugger_register_hash( const char *reg ); -libspectrum_word debugger_register_get( int which ); -void debugger_register_set( int which, libspectrum_word value ); -const char* debugger_register_text( int which ); +void debugger_register_set( const char *which, libspectrum_word value ); void debugger_exit_emulator( void ); @@ -85,13 +85,16 @@ debugger_expression* debugger_expression_new_number( libspectrum_dword number, int pool ); -debugger_expression* debugger_expression_new_register( int which, int pool ); +debugger_expression* debugger_expression_new_register( const char *which, int pool ); debugger_expression* debugger_expression_new_unaryop( int operation, debugger_expression *operand, int pool ); debugger_expression* debugger_expression_new_binaryop( int operation, debugger_expression *operand1, debugger_expression *operand2, int pool ); debugger_expression* +debugger_expression_new_system_variable( const char *type, const char *detail, + int pool ); +debugger_expression* debugger_expression_new_variable( const char *name, int pool ); debugger_expression* debugger_expression_copy( debugger_expression *src ); @@ -106,6 +109,17 @@ int debugger_event_is_registered( const char *type, const char *detail ); void debugger_event_end( void ); +/* System variables handling */ + +void debugger_system_variable_init( void ); +void debugger_system_variable_end( void ); +int debugger_system_variable_find( const char *type, const char *detail ); +libspectrum_dword debugger_system_variable_get( int system_variable ); +void debugger_system_variable_set( const char *type, const char *detail, + libspectrum_dword value ); +void debugger_system_variable_text( char *buffer, size_t length, + int system_variable ); + /* Variables handling */ void debugger_variable_init( void ); Modified: vendor/fuse-emulator/current/fuse/debugger/event.c =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/event.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/event.c 2016-07-17 12:20:07 UTC (rev 813) @@ -88,8 +88,11 @@ debugger_event( int event_code ) { debugger_event_t event; - GSList *ptr; + debugger_breakpoint *bp; + GSList *ptr, *ptr_next; + int signal_breakpoints_updated = 0; + if( event_code >= registered_events->len ) { ui_error( UI_ERROR_ERROR, "internal error: invalid debugger event %d", event_code ); @@ -98,16 +101,28 @@ event = g_array_index( registered_events, debugger_event_t, event_code ); - for( ptr = debugger_breakpoints; ptr; ptr = ptr->next ) { - debugger_breakpoint *bp = ptr->data; + for( ptr = debugger_breakpoints; ptr; ptr = ptr_next ) { + + bp = ptr->data; + ptr_next = ptr->next; + if( bp->type != DEBUGGER_BREAKPOINT_TYPE_EVENT ) continue; if( event_matches( &bp->value.event, event.type, event.detail ) && debugger_breakpoint_trigger( bp ) ) { debugger_mode = DEBUGGER_MODE_HALTED; debugger_command_evaluate( bp->commands ); + + if( bp->life == DEBUGGER_BREAKPOINT_LIFE_ONESHOT ) { + debugger_breakpoints = g_slist_remove( debugger_breakpoints, bp ); + libspectrum_free( bp ); + signal_breakpoints_updated = 1; + } } } + + if( signal_breakpoints_updated ) + ui_breakpoints_updated(); } /* Tidy-up function called at end of emulation */ Modified: vendor/fuse-emulator/current/fuse/debugger/expression.c =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/expression.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/debugger/expression.c 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ /* expression.c: A numeric expression - Copyright (c) 2003-2015 Philip Kendall + Copyright (c) 2003-2016 Philip Kendall $Id$ @@ -38,9 +38,9 @@ typedef enum expression_type { DEBUGGER_EXPRESSION_TYPE_INTEGER, - DEBUGGER_EXPRESSION_TYPE_REGISTER, DEBUGGER_EXPRESSION_TYPE_UNARYOP, DEBUGGER_EXPRESSION_TYPE_BINARYOP, + DEBUGGER_EXPRESSION_TYPE_SYSVAR, DEBUGGER_EXPRESSION_TYPE_VARIABLE, } expression_type; @@ -86,10 +86,10 @@ union { int integer; - int reg; struct unaryop_type unaryop; struct binaryop_type binaryop; char *variable; + int system_variable; } types; }; @@ -163,18 +163,15 @@ return exp; } +/* Create a new expression representing a Z80 register + + Now just a pass through to the appropriate system variable. + This function should be removed in Fuse 1.4 */ debugger_expression* -debugger_expression_new_register( int which, int pool ) +debugger_expression_new_register( const char *which, int pool ) { - debugger_expression *exp; - - exp = mempool_new( pool, debugger_expression, 1 ); - - exp->type = DEBUGGER_EXPRESSION_TYPE_REGISTER; - exp->precedence = PRECEDENCE_ATOMIC; - exp->types.reg = which; - - return exp; + return debugger_expression_new_system_variable( + debugger_z80_system_variable_type, which, pool ); } debugger_expression* @@ -195,7 +192,6 @@ return exp; } - debugger_expression* debugger_expression_new_unaryop( int operation, debugger_expression *operand, int pool ) @@ -214,6 +210,29 @@ } debugger_expression* +debugger_expression_new_system_variable( const char *type, const char *detail, + int pool ) +{ + debugger_expression *exp; + int system_variable; + + system_variable = debugger_system_variable_find( type, detail ); + if( system_variable == -1 ) { + ui_error( UI_ERROR_WARNING, "System variable %s:%s not known", type, + detail ); + return NULL; + } + + exp = mempool_new( pool, debugger_expression, 1 ); + + exp->type = DEBUGGER_EXPRESSION_TYPE_SYSVAR; + exp->precedence = PRECEDENCE_ATOMIC; + exp->types.system_variable = system_variable; + + return exp; +} + +debugger_expression* debugger_expression_new_variable( const char *name, int pool ) { debugger_expression *exp; @@ -233,7 +252,7 @@ switch( exp->type ) { case DEBUGGER_EXPRESSION_TYPE_INTEGER: - case DEBUGGER_EXPRESSION_TYPE_REGISTER: + case DEBUGGER_EXPRESSION_TYPE_SYSVAR: break; case DEBUGGER_EXPRESSION_TYPE_UNARYOP: @@ -270,10 +289,6 @@ dest->types.integer = src->types.integer; break; - case DEBUGGER_EXPRESSION_TYPE_REGISTER: - dest->types.reg = src->types.reg; - break; - case DEBUGGER_EXPRESSION_TYPE_UNARYOP: dest->types.unaryop.operation = src->types.unaryop.operation; dest->types.unaryop.op = debugger_expression_copy( src->types.unaryop.op ); @@ -300,10 +315,13 @@ } break; + case DEBUGGER_EXPRESSION_TYPE_SYSVAR: + dest->types.system_variable = src->types.system_variable; + break; + case DEBUGGER_EXPRESSION_TYPE_VARIABLE: dest->types.variable = utils_safe_strdup( src->types.variable ); break; - } return dest; @@ -317,15 +335,15 @@ case DEBUGGER_EXPRESSION_TYPE_INTEGER: return exp->types.integer; - case DEBUGGER_EXPRESSION_TYPE_REGISTER: - return debugger_register_get( exp->types.reg ); - case DEBUGGER_EXPRESSION_TYPE_UNARYOP: return evaluate_unaryop( &( exp->types.unaryop ) ); case DEBUGGER_EXPRESSION_TYPE_BINARYOP: return evaluate_binaryop( &( exp->types.binaryop ) ); + case DEBUGGER_EXPRESSION_TYPE_SYSVAR: + return debugger_system_variable_get( exp->types.system_variable ); + case DEBUGGER_EXPRESSION_TYPE_VARIABLE: return debugger_variable_get( exp->types.variable ); @@ -435,16 +453,16 @@ } return 0; - case DEBUGGER_EXPRESSION_TYPE_REGISTER: - snprintf( buffer, length, "%s", debugger_register_text( exp->types.reg ) ); - return 0; - case DEBUGGER_EXPRESSION_TYPE_UNARYOP: return deparse_unaryop( buffer, length, &( exp->types.unaryop ) ); case DEBUGGER_EXPRESSION_TYPE_BINARYOP: return deparse_binaryop( buffer, length, &( exp->types.binaryop ) ); + case DEBUGGER_EXPRESSION_TYPE_SYSVAR: + debugger_system_variable_text( buffer, length, exp->types.system_variable ); + return 0; + case DEBUGGER_EXPRESSION_TYPE_VARIABLE: snprintf( buffer, length, "$%s", exp->types.variable ); return 0; Added: vendor/fuse-emulator/current/fuse/debugger/system_variable.c =================================================================== --- vendor/fuse-emulator/current/fuse/debugger/system_variable.c (rev 0) +++ vendor/fuse-emulator/current/fuse/debugger/system_variable.c 2016-07-17 12:20:07 UTC (rev 813) @@ -0,0 +1,160 @@ +/* event.c: Debugger system variables + Copyright (c) 2016 Philip Kendall + + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Author contact information: + + E-mail: phi...@sh... + +*/ + +#include <config.h> + +#include <string.h> + +#ifdef HAVE_LIB_GLIB +#include <glib.h> +#endif /* #ifdef HAVE_LIB_GLIB */ + +#include <libspectrum.h> + +#include "debugger_internals.h" +#include "fuse.h" +#include "ui/ui.h" +#include "utils.h" + +typedef struct system_variable_t { + char *type; + char *detail; + debugger_get_system_variable_fn_t get; + debugger_set_system_variable_fn_t set; +} system_variable_t; + +static GArray *system_variables; + +void +debugger_system_variable_init( void ) +{ + system_variables = g_array_new( FALSE, FALSE, sizeof( system_variable_t ) ); +} + +void +debugger_system_variable_register( const char *type, const char *detail, + debugger_get_system_variable_fn_t get, + debugger_set_system_variable_fn_t set ) +{ + system_variable_t sysvar; + + sysvar.type = utils_safe_strdup( type ); + sysvar.detail = utils_safe_strdup( detail ); + sysvar.get = get; + sysvar.set = set; + + g_array_append_val( system_variables, sysvar ); +} + +static int +system_variable_matches( system_variable_t *sysvar, const char *type, const char *detail ) +{ + return strcasecmp( type, sysvar->type ) == 0 && + strcasecmp( detail, sysvar->detail ) == 0; +} + +static int +find_system_variable( const char *type, const char *detail, system_variable_t *out ) +{ + size_t i; + + for( i = 0; i < system_variables->len; i++ ) { + system_variable_t sysvar = + g_array_index( system_variables, system_variable_t, i ); + + if( system_variable_matches( &sysvar, type, detail ) ) { + if( out != NULL ) *out = sysvar; + return i; + } + } + + return -1; +} + +int +debugger_system_variable_find( const char *type, const char *detail ) +{ + return find_system_variable( type, detail, NULL ); +} + +libspectrum_dword +debugger_system_variable_get( int system_variable ) +{ + system_variable_t sysvar = + g_array_index( system_variables, system_variable_t, system_variable ); + + return sysvar.get(); +} + +void +debugger_system_variable_set( const char *type, const char *detail, + libspectrum_dword value ) +{ + int index; + system_variable_t sysvar; + + index = find_system_variable( type, detail, &sysvar ); + if( index == -1 ) { + ui_error( UI_ERROR_ERROR, "Unknown system variable %s:%s", type, detail ); + return; + } + + if (sysvar.set == NULL) { + ui_error( UI_ERROR_ERROR, "System variable %s:%s cannot be set", type, + detail ); + return; + } + + sysvar.set( value ); +} + +void +debugger_system_variable_text( char *buffer, size_t length, + int system_variable ) +{ + system_variable_t sysvar = + g_array_index( system_variables, system_variable_t, system_variable ); + + snprintf( buffer, length, "%s:%s", sysvar.type, sysvar.detail ); +} + +/* Tidy-up function called at end of emulation */ +void +debugger_system_variable_end( void ) +{ + int i; + system_variable_t sysvar; + + if( !system_variables ) return; + + for( i = 0; i < system_variables->len; i++ ) { + sysvar = g_array_index( system_variables, system_variable_t, i ); + libspectrum_free( sysvar.detail ); + libspectrum_free( sysvar.type ); + } + + g_array_free( system_variables, TRUE ); + system_variables = NULL; +} Modified: vendor/fuse-emulator/current/fuse/display.c =================================================================== --- vendor/fuse-emulator/current/fuse/display.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/display.c 2016-07-17 12:20:07 UTC (rev 813) @@ -32,8 +32,8 @@ #include <string.h> #include "display.h" -#include "event.h" #include "fuse.h" +#include "infrastructure/startup_manager.h" #include "machine.h" #include "movie.h" #include "peripherals/scld.h" @@ -207,6 +207,26 @@ return 0; } +static int +display_init_wrapper( void *context ) +{ + display_startup_context *typed_context = + (display_startup_context*) context; + + return display_init( typed_context->argc, typed_context->argv ); +} + +void +display_register_startup( display_startup_context *context ) +{ + /* The Wii has an explicit call to display_init for now */ +#ifndef GEKKO + startup_manager_register_no_dependencies( STARTUP_MANAGER_MODULE_DISPLAY, + display_init_wrapper, context, + NULL ); +#endif /* #ifndef GEKKO */ +} + /* Mark as 'dirty' the pixels which have been changed by a write to 'offset' within the RAM page containing the screen */ void Modified: vendor/fuse-emulator/current/fuse/display.h =================================================================== --- vendor/fuse-emulator/current/fuse/display.h 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/display.h 2016-07-17 12:20:07 UTC (rev 813) @@ -75,7 +75,13 @@ extern libspectrum_word display_line_start[ DISPLAY_HEIGHT ]; extern libspectrum_word display_attr_start[ DISPLAY_HEIGHT ]; -int display_init(int *argc, char ***argv); +typedef struct display_startup_context { + int *argc; + char ***argv; +} display_startup_context; + +int display_init( int *argc, char ***argv ); +void display_register_startup( display_startup_context *context ); void display_line(void); typedef void (*display_dirty_fn)( libspectrum_word offset ); Modified: vendor/fuse-emulator/current/fuse/event.c =================================================================== --- vendor/fuse-emulator/current/fuse/event.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/event.c 2016-07-17 12:20:07 UTC (rev 813) @@ -30,6 +30,7 @@ #include <libspectrum.h> #include "event.h" +#include "infrastructure/startup_manager.h" #include "fuse.h" #include "ui/ui.h" #include "utils.h" @@ -56,14 +57,16 @@ static GArray *registered_events; -void -event_init( void ) +static int +event_init( void *context ) { registered_events = g_array_new( FALSE, FALSE, sizeof( event_descriptor_t ) ); event_type_null = event_register( NULL, "[Deleted event]" ); event_next_event = event_no_events; + + return 0; } int @@ -272,9 +275,18 @@ } /* Tidy-up function called at end of emulation */ -void +static void event_end( void ) { event_reset(); registered_events_free(); } + +void +event_register_startup( void ) +{ + startup_manager_module dependencies[] = { STARTUP_MANAGER_MODULE_SETUID }; + startup_manager_register( STARTUP_MANAGER_MODULE_EVENT, dependencies, + ARRAY_SIZE( dependencies ), event_init, NULL, + event_end ); +} Modified: vendor/fuse-emulator/current/fuse/event.h =================================================================== --- vendor/fuse-emulator/current/fuse/event.h 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/event.h 2016-07-17 12:20:07 UTC (rev 813) @@ -48,9 +48,6 @@ /* When will the next event happen? */ extern libspectrum_dword event_next_event; -/* Set up the event list */ -void event_init( void ); - /* Register a new event type */ int event_register( event_fn_t fn, const char *description ); @@ -88,7 +85,7 @@ /* A textual representation of each event type */ const char *event_name( int type ); -/* Called on exit to clean up */ -void event_end( void ); +/* Register the init and end functions */ +void event_register_startup( void ); #endif /* #ifndef FUSE_EVENT_H */ Modified: vendor/fuse-emulator/current/fuse/fuse.c =================================================================== --- vendor/fuse-emulator/current/fuse/fuse.c 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/fuse.c 2016-07-17 12:20:07 UTC (rev 813) @@ -1,5 +1,5 @@ /* fuse.c: The Free Unix Spectrum Emulator - Copyright (c) 1999-2015 Philip Kendall and others + Copyright (c) 1999-2016 Philip Kendall and others $Id$ @@ -59,6 +59,7 @@ #include "display.h" #include "event.h" #include "fuse.h" +#include "infrastructure/startup_manager.h" #include "keyboard.h" #include "machine.h" #include "machines/machines_periph.h" @@ -145,9 +146,13 @@ } start_files_t; +/* Context for the display startup routine */ +static display_startup_context display_context; + static int fuse_init(int argc, char **argv); -static int creator_init( void ); +static void creator_register_startup( void ); + static void fuse_show_copyright(void); static void fuse_show_version( void ); static void fuse_show_help( void ); @@ -199,6 +204,139 @@ } +static int +fuse_libspectrum_init( void *context ) +{ + if( libspectrum_check_version( LIBSPECTRUM_MIN_VERSION ) ) { + if( libspectrum_init() ) return 1; + } else { + ui_error( UI_ERROR_ERROR, + "libspectrum version %s found, but %s required", + libspectrum_version(), LIBSPECTRUM_MIN_VERSION ); + return 1; + } + + return 0; +} + +static void +libspectrum_register_startup( void ) +{ + startup_manager_module dependencies[] = { + STARTUP_MANAGER_MODULE_DISPLAY + }; + startup_manager_register( STARTUP_MANAGER_MODULE_LIBSPECTRUM, dependencies, + ARRAY_SIZE( dependencies ), fuse_libspectrum_init, + NULL, NULL ); +} + +static int +libxml2_init( void *context ) +{ +#ifdef HAVE_LIB_XML2 + LIBXML_TEST_VERSION +#endif + + return 0; +} + +static void +libxml2_register_startup( void ) +{ + startup_manager_module dependencies[] = { STARTUP_MANAGER_MODULE_SETUID }; + startup_manager_register( STARTUP_MANAGER_MODULE_LIBXML2, dependencies, + ARRAY_SIZE( dependencies ), libxml2_init, NULL, + NULL ); +} + +static int +setuid_init( void *context ) +{ +#ifdef HAVE_GETEUID + int error; + + /* Drop root privs if we have them */ + if( !geteuid() ) { + error = setuid( getuid() ); + if( error ) { + ui_error( UI_ERROR_ERROR, "Could not drop root privileges" ); + return 1; + } + } +#endif /* #ifdef HAVE_GETEUID */ + + return 0; +} + +static void +setuid_register_startup() +{ + startup_manager_module dependencies[] = { + STARTUP_MANAGER_MODULE_DISPLAY, + STARTUP_MANAGER_MODULE_LIBSPECTRUM, + }; + startup_manager_register( STARTUP_MANAGER_MODULE_SETUID, dependencies, + ARRAY_SIZE( dependencies ), setuid_init, NULL, + NULL ); +} + +static int +run_startup_manager( int *argc, char ***argv ) +{ + startup_manager_init(); + + display_context.argc = argc; + display_context.argv = argv; + + /* Get every module to register its init function */ + ay_register_startup(); + beta_register_startup(); + creator_register_startup(); + debugger_register_startup(); + didaktik80_register_startup(); + disciple_register_startup(); + display_register_startup( &display_context ); + divide_register_startup(); + event_register_startup(); + fdd_register_startup(); + fuller_register_startup(); + if1_register_startup(); + if2_register_startup(); + kempmouse_register_startup(); + libspectrum_register_startup(); + libxml2_register_startup(); + machine_register_startup(); + machines_periph_register_startup(); + melodik_register_startup(); + memory_register_startup(); + mempool_register_startup(); + opus_register_startup(); + plusd_register_startup(); + printer_register_startup(); + profile_register_startup(); + psg_register_startup(); + rzx_register_startup(); + scld_register_startup(); + settings_register_startup(); + setuid_register_startup(); + simpleide_register_startup(); + slt_register_startup(); + sound_register_startup(); + speccyboot_register_startup(); + specdrum_register_startup(); + spectranet_register_startup(); + spectrum_register_startup(); + tape_register_startup(); + timer_register_startup(); + ula_register_startup(); + usource_register_startup(); + z80_register_startup(); + zxatasp_register_startup(); + zxcf_register_startup(); + + return startup_manager_run(); +} + static int fuse_init(int argc, char **argv) { int error, first_arg; @@ -241,96 +379,14 @@ fuse_show_copyright(); #endif - /* FIXME: order of these initialisation calls. Work out what depends on - what */ - /* FIXME FIXME 20030407: really do this soon. This is getting *far* too - hairy */ - fuse_joystick_init (); + fuse_joystick_init(); fuse_keyboard_init(); - event_init(); - -#ifndef GEKKO - if( display_init(&argc,&argv) ) return 1; -#endif + if( run_startup_manager( &argc, &argv ) ) return 1; - if( libspectrum_check_version( LIBSPECTRUM_MIN_VERSION ) ) { - if( libspectrum_init() ) return 1; - } else { - ui_error( UI_ERROR_ERROR, - "libspectrum version %s found, but %s required", - libspectrum_version(), LIBSPECTRUM_MIN_VERSION ); - return 1; - } - - /* Must be called after libspectrum_init() so we can get the gcrypt - version */ - if( creator_init() ) return 1; - -#ifdef HAVE_GETEUID - /* Drop root privs if we have them */ - if( !geteuid() ) { - error = setuid( getuid() ); - if( error ) { - ui_error( UI_ERROR_ERROR, "Could not drop root privileges" ); - return 1; - } - } -#endif /* #ifdef HAVE_GETEUID */ - - mempool_init(); - memory_init(); - -#ifdef HAVE_LIB_XML2 -LIBXML_TEST_VERSION -#endif - - debugger_init(); - - spectrum_init(); - printer_init(); - rzx_init(); - psg_init(); - beta_init(); - opus_init(); - plusd_init(); - didaktik80_init(); - disciple_init(); - fdd_init_events(); - if( simpleide_init() ) return 1; - if( zxatasp_init() ) return 1; - if( zxcf_init() ) return 1; - if1_init(); - if2_init(); - if( divide_init() ) return 1; - scld_init(); - ula_init(); - ay_init(); - slt_init(); - profile_init(); - kempmouse_init(); - fuller_init(); - melodik_init(); - speccyboot_init(); - specdrum_init(); - spectranet_init(); - usource_init(); - machines_periph_init(); - - z80_init(); - - if( timer_init() ) return 1; - - error = timer_estimate_reset(); if( error ) return error; - - error = machine_init_machines(); - if( error ) return error; - error = machine_select_id( settings_current.start_machine ); if( error ) return error; - tape_init(); - error = scaler_select_id( start_scaler ); libspectrum_free( start_scaler ); if( error ) return error; @@ -349,8 +405,8 @@ return 0; } -static -int creator_init( void ) +static int +creator_init( void *context ) { size_t i; unsigned int version[4] = { 0, 0, 0, 0 }; @@ -402,6 +458,21 @@ return 0; } +static void +creator_end( void ) +{ + libspectrum_creator_free( fuse_creator ); +} + +static void +creator_register_startup( void ) +{ + startup_manager_module dependencies[] = { STARTUP_MANAGER_MODULE_SETUID }; + startup_manager_register( STARTUP_MANAGER_MODULE_CREATOR, dependencies, + ARRAY_SIZE( dependencies ), creator_init, NULL, + creator_end ); +} + static void fuse_show_copyright(void) { printf( "\n" ); @@ -855,51 +926,19 @@ static int fuse_end(void) { movie_stop(); /* stop movie recording */ - /* Must happen before memory is deallocated as we read the character - set from memory for the text output */ - printer_end(); - /* also required before memory is deallocated on Fuse for OS X where - settings need to look up machine names etc. */ - settings_end(); + startup_manager_run_end(); - psg_end(); - rzx_end(); - tape_end(); - debugger_end(); - simpleide_end(); - zxatasp_end(); - zxcf_end(); - if1_end(); - divide_end(); - beta_end(); - opus_end(); - plusd_end(); - didaktik80_end(); - disciple_end(); - spectranet_end(); - speccyboot_end(); - usource_end(); - - machine_end(); - - timer_end(); - - sound_end(); - event_end(); periph_end(); fuse_keyboard_end(); fuse_joystick_end(); ui_end(); ui_media_drive_end(); - memory_end(); - mempool_end(); module_end(); pokemem_end(); svg_capture_end(); - libspectrum_creator_free( fuse_creator ); libspectrum_end(); return 0; Modified: vendor/fuse-emulator/current/fuse/hacking/ChangeLog =================================================================== --- vendor/fuse-emulator/current/fuse/hacking/ChangeLog 2016-06-18 13:46:18 UTC (rev 812) +++ vendor/fuse-emulator/current/fuse/hacking/ChangeLog 2016-07-17 12:20:07 UTC (rev 813) @@ -5024,6 +5024,7 @@ Release-1_1_0-branch changes onto trunk (Fred). 20160424 ChangeLog,README,configure.ac,man/fuse.1: bump version number for 1.2.0 release (Fred). +20160425 tape.c: whitespace fix (Fred). 20160425 memory.c: use tape traps if we are using a custom ROM if the instructions at the entry points have been preserved (feature request #83) (thanks, Alberto Garcia) (Fred). @@ -5099,9 +5100,14 @@ 20160503 z80/z80c: complete revert accurate emulation of the HALT instruction in [r5160] as it causes [bugs:#329] and there is no current resolution (Fred). +20160503 machine.c: standardise setting of custom ROM field to 1 or 0 (Fred). 20160508 peripherals/disk/beta.c: don't enable the Beta128 interface when loa... [truncated message content] |