From: <fr...@us...> - 2016-05-03 10:56:49
|
Revision: 5447 http://sourceforge.net/p/fuse-emulator/code/5447 Author: fredm Date: 2016-05-03 10:56:47 +0000 (Tue, 03 May 2016) Log Message: ----------- Add skeleton of support for Currah uSource snapshots (patch #363) (Fred and Sergio). Modified Paths: -------------- trunk/libspectrum/accessor.pl trunk/libspectrum/doc/libspectrum.txt trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/sna.c trunk/libspectrum/snap_accessors.txt trunk/libspectrum/snapshot.c trunk/libspectrum/szx.c trunk/libspectrum/z80.c Modified: trunk/libspectrum/accessor.pl =================================================================== --- trunk/libspectrum/accessor.pl 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/accessor.pl 2016-05-03 10:56:47 UTC (rev 5447) @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # accessor.pl: generate accessor functions -# Copyright (c) 2003-2015 Philip Kendall +# Copyright (c) 2003-2016 Philip Kendall # $Id$ @@ -240,6 +240,13 @@ /* Printer emulation */ int zx_printer_active; + + /* uSource emulation */ + int usource_active; + int usource_paged; + int usource_custom_rom; + libspectrum_byte* usource_rom[1]; + size_t usource_rom_length[1]; /* Length of the ROM */ }; /* Initialise a libspectrum_snap structure */ Modified: trunk/libspectrum/doc/libspectrum.txt =================================================================== --- trunk/libspectrum/doc/libspectrum.txt 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/doc/libspectrum.txt 2016-05-03 10:56:47 UTC (rev 5447) @@ -712,6 +712,12 @@ * int zx_printer_active +* int usource_active +* int usource_paged +* int usource_custom_rom +* libspectrum_byte* usource_rom[1] +* size_t usource_rom_length[1] + Most of those should be fairly self-explanatory; those which may not be are: Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/hacking/ChangeLog 2016-05-03 10:56:47 UTC (rev 5447) @@ -1045,3 +1045,6 @@ 20160430 README,doc/libspectrum.3: list more disk formats (Sergio). 20160501 Makefile.am,memory.c: don't use g_mem_set_vtable on newer GLib and distribute missing macro files (Sergio). +20160503 accessor.pl,doc/libspectrum.txt,sna.c,snap_accessors.txt,snapshot.c, + szx.c,z80.c: add skeleton of support for Currah uSource snapshots + (patch #363) (Fred and Sergio). Modified: trunk/libspectrum/sna.c =================================================================== --- trunk/libspectrum/sna.c 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/sna.c 2016-05-03 10:56:47 UTC (rev 5447) @@ -1,5 +1,6 @@ /* sna.c: Routines for handling .sna snapshots Copyright (c) 2001-2002 Philip Kendall + Copyright (c) 2016 Fredrick Meunier $Id$ @@ -335,6 +336,10 @@ if( libspectrum_snap_spectranet_active( snap ) ) *out_flags |= LIBSPECTRUM_FLAG_SNAPSHOT_MAJOR_INFO_LOSS; + /* We don't save the uSource state at all */ + if( libspectrum_snap_usource_active( snap ) ) + *out_flags |= LIBSPECTRUM_FLAG_SNAPSHOT_MAJOR_INFO_LOSS; + ptr = *buffer; write_header( buffer, &ptr, length, snap ); Modified: trunk/libspectrum/snap_accessors.txt =================================================================== --- trunk/libspectrum/snap_accessors.txt 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/snap_accessors.txt 2016-05-03 10:56:47 UTC (rev 5447) @@ -1,5 +1,5 @@ # snap_accessors.txt: simple accessors for libspectrum_snap -# Copyright (c) 2003-2009 Philip Kendall +# Copyright (c) 2003-2016 Philip Kendall # $Id$ @@ -194,3 +194,9 @@ int late_timings int zx_printer_active + +int usource_active +int usource_paged +int usource_custom_rom +libspectrum_byte* usource_rom 1 +size_t usource_rom_length 1 Modified: trunk/libspectrum/snapshot.c =================================================================== --- trunk/libspectrum/snapshot.c 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/snapshot.c 2016-05-03 10:56:47 UTC (rev 5447) @@ -223,6 +223,12 @@ libspectrum_snap_set_zx_printer_active( snap, 0 ); + libspectrum_snap_set_usource_active( snap, 0 ); + libspectrum_snap_set_usource_paged( snap, 0 ); + libspectrum_snap_set_usource_custom_rom( snap, 0 ); + libspectrum_snap_set_usource_rom( snap, 0, NULL ); + libspectrum_snap_set_usource_rom_length( snap, 0, 0 ); + return snap; } @@ -271,6 +277,9 @@ if( libspectrum_snap_spectranet_ram( snap, 0 ) ) libspectrum_free( libspectrum_snap_spectranet_ram( snap, 0 ) ); + if( libspectrum_snap_usource_rom( snap, 0 ) ) + libspectrum_free( libspectrum_snap_usource_rom( snap, 0 ) ); + libspectrum_free( snap ); return LIBSPECTRUM_ERROR_NONE; Modified: trunk/libspectrum/szx.c =================================================================== --- trunk/libspectrum/szx.c 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/szx.c 2016-05-03 10:56:47 UTC (rev 5447) @@ -1,5 +1,5 @@ /* szx.c: Routines for .szx snapshots - Copyright (c) 1998-2015 Philip Kendall, Fredrick Meunier, Stuart Brady + Copyright (c) 1998-2016 Philip Kendall, Fredrick Meunier, Stuart Brady $Id$ @@ -2428,6 +2428,10 @@ *out_flags = 0; + /* We don't save the uSource state at all */ + if( libspectrum_snap_usource_active( snap ) ) + *out_flags |= LIBSPECTRUM_FLAG_SNAPSHOT_MAJOR_INFO_LOSS; + capabilities = libspectrum_machine_capabilities( libspectrum_snap_machine( snap ) ); @@ -2458,7 +2462,6 @@ if( error ) return error; } - error = write_ram_pages( buffer, &ptr, length, snap, compress ); if( error ) return error; Modified: trunk/libspectrum/z80.c =================================================================== --- trunk/libspectrum/z80.c 2016-05-02 12:42:26 UTC (rev 5446) +++ trunk/libspectrum/z80.c 2016-05-03 10:56:47 UTC (rev 5447) @@ -1,5 +1,5 @@ /* z80.c: Routines for handling .z80 snapshots - Copyright (c) 2001-2015 Philip Kendall, Darren Salt, Fredrick Meunier + Copyright (c) 2001-2016 Philip Kendall, Darren Salt, Fredrick Meunier $Id$ @@ -1182,6 +1182,10 @@ if( libspectrum_snap_spectranet_active( snap ) ) *out_flags |= LIBSPECTRUM_FLAG_SNAPSHOT_MAJOR_INFO_LOSS; + /* .z80 format doesn't save the uSource state at all */ + if( libspectrum_snap_usource_active( snap ) ) + *out_flags |= LIBSPECTRUM_FLAG_SNAPSHOT_MAJOR_INFO_LOSS; + error = write_header( buffer, &ptr, length, out_flags, snap ); if( error != LIBSPECTRUM_ERROR_NONE ) return error; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |