[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[610] trunk
Brought to you by:
fredm
From: <fr...@us...> - 2009-08-02 10:35:46
|
Revision: 610 http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=610&view=rev Author: fredm Date: 2009-08-02 10:35:36 +0000 (Sun, 02 Aug 2009) Log Message: ----------- Merge up to vendor revision 4041. Revision Links: -------------- http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=4041&view=rev Modified Paths: -------------- trunk/FuseGenerator/libspectrum.h trunk/FuseImporter/libspectrum.h trunk/fuse/AUTHORS trunk/fuse/ChangeLog trunk/fuse/README trunk/fuse/disk/Makefile.am trunk/fuse/disk/beta.c trunk/fuse/disk/disk.c trunk/fuse/disk/fdd.c trunk/fuse/disk/plusd.c trunk/fuse/disk/wd_fdc.c trunk/fuse/disk/wd_fdc.h trunk/fuse/fuse.c trunk/fuse/fusepb/Credits.html trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj trunk/fuse/fusepb/controllers/FuseController.h trunk/fuse/fusepb/controllers/FuseController.m trunk/fuse/fusepb/controllers/PreferencesController.m trunk/fuse/fusepb/models/Emulator.h trunk/fuse/fusepb/models/Emulator.m trunk/fuse/fusepb/nibs/Preferences.nib/designable.nib trunk/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib trunk/fuse/fusepb/resources/Fuse Help/html/changelog.html trunk/fuse/fusepb/resources/Fuse Help/html/formats.html trunk/fuse/fusepb/resources/Fuse Help/html/menus.html trunk/fuse/fusepb/resources/Fuse Help/html/preferences.html trunk/fuse/fusepb/resources/Fuse Help/html/tocstart.html trunk/fuse/fusepb/views/DisplayOpenGLView.h trunk/fuse/fusepb/views/DisplayOpenGLView.m trunk/fuse/hacking/ChangeLog trunk/fuse/ide/divide.c trunk/fuse/ide/divide.h trunk/fuse/ide/ide.c trunk/fuse/ide/ide.h trunk/fuse/ide/simpleide.c trunk/fuse/ide/simpleide.h trunk/fuse/ide/zxatasp.c trunk/fuse/ide/zxatasp.h trunk/fuse/ide/zxcf.c trunk/fuse/ide/zxcf.h trunk/fuse/machines/pentagon1024.c trunk/fuse/machines/spec128.c trunk/fuse/machines/spec16.c trunk/fuse/machines/spec48.c trunk/fuse/machines/spec_se.c trunk/fuse/machines/specplus2.c trunk/fuse/machines/tc2048.c trunk/fuse/man/fuse.1 trunk/fuse/memory.c trunk/fuse/menu.c trunk/fuse/menu.h trunk/fuse/menu_data.dat trunk/fuse/periph.c trunk/fuse/periph.h trunk/fuse/roms/Makefile.am trunk/fuse/settings.dat trunk/fuse/tape.c trunk/fuse/ui/cocoa/cocoaui.m trunk/fuse/ui/options.dat trunk/fuse/ui/ui.h trunk/fuse/ui.c trunk/fuse/utils.c trunk/fuse/z80/coretest.c trunk/fuse/z80/z80_checks.h trunk/fuse/z80/z80_ops.c trunk/libspectrum/libspectrum/accessor.pl trunk/libspectrum/libspectrum/doc/libspectrum.txt trunk/libspectrum/libspectrum/hacking/ChangeLog trunk/libspectrum/libspectrum/libspectrum.c trunk/libspectrum/libspectrum/libspectrum.h.in trunk/libspectrum/libspectrum/sna.c trunk/libspectrum/libspectrum/snap_accessors.txt trunk/libspectrum/libspectrum/snapshot.c trunk/libspectrum/libspectrum/szx.c trunk/libspectrum/libspectrum/z80.c trunk/libspectrum/libspectrum.h Added Paths: ----------- trunk/fuse/disk/opus.c trunk/fuse/disk/opus.h trunk/fuse/fusepb/resources/Fuse Help/html/opus.html trunk/fuse/roms/opus.rom Property Changed: ---------------- trunk/fuse/ trunk/libspectrum/libspectrum/ Modified: trunk/FuseGenerator/libspectrum.h =================================================================== --- trunk/FuseGenerator/libspectrum.h 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/FuseGenerator/libspectrum.h 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ /* libspectrum.h: the library for dealing with ZX Spectrum emulator files Copyright (c) 2001-2007 Philip Kendall, Darren Salt, Fredrick Meunier - $Id: libspectrum.h.in 4039 2009-06-27 06:04:44Z fredm $ + $Id: libspectrum.h.in 4060 2009-07-30 13:21:38Z 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 @@ -343,6 +343,8 @@ LIBSPECTRUM_ID_DISK_SAD, /* .sad generic disk image */ LIBSPECTRUM_ID_DISK_TD0, /* .td0 generic disk image */ + LIBSPECTRUM_ID_DISK_OPD, /* .opu/.opd Opus Discovery disk image */ + LIBSPECTRUM_ID_SCREEN_SCR, /* .scr screen file */ } libspectrum_id_t; @@ -355,6 +357,7 @@ LIBSPECTRUM_CLASS_CARTRIDGE_TIMEX, /* Timex cartridges */ LIBSPECTRUM_CLASS_DISK_PLUS3, /* +3 disk */ LIBSPECTRUM_CLASS_DISK_TRDOS, /* TR-DOS disk */ + LIBSPECTRUM_CLASS_DISK_OPUS, /* Opus Discovery disk*/ LIBSPECTRUM_CLASS_RECORDING, /* Input recording */ LIBSPECTRUM_CLASS_SNAPSHOT, /* Snapshot */ LIBSPECTRUM_CLASS_TAPE, /* Tape */ @@ -679,6 +682,8 @@ void WIN32_DLL libspectrum_snap_set_beta_active( libspectrum_snap *snap, int beta_active ); int WIN32_DLL libspectrum_snap_beta_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_beta_paged( libspectrum_snap *snap, int beta_paged ); +int WIN32_DLL libspectrum_snap_beta_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_beta_drive_count( libspectrum_snap *snap, int beta_drive_count ); int WIN32_DLL libspectrum_snap_beta_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_beta_custom_rom( libspectrum_snap *snap, int beta_custom_rom ); int WIN32_DLL libspectrum_snap_beta_direction( libspectrum_snap *snap ); @@ -699,6 +704,8 @@ void WIN32_DLL libspectrum_snap_set_plusd_active( libspectrum_snap *snap, int plusd_active ); int WIN32_DLL libspectrum_snap_plusd_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_plusd_paged( libspectrum_snap *snap, int plusd_paged ); +int WIN32_DLL libspectrum_snap_plusd_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_plusd_drive_count( libspectrum_snap *snap, int plusd_drive_count ); int WIN32_DLL libspectrum_snap_plusd_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_plusd_custom_rom( libspectrum_snap *snap, int plusd_custom_rom ); int WIN32_DLL libspectrum_snap_plusd_direction( libspectrum_snap *snap ); @@ -717,6 +724,40 @@ void WIN32_DLL libspectrum_snap_set_plusd_rom( libspectrum_snap *snap, int idx, libspectrum_byte* plusd_rom ); libspectrum_byte WIN32_DLL * libspectrum_snap_plusd_ram( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_plusd_ram( libspectrum_snap *snap, int idx, libspectrum_byte* plusd_ram ); +int WIN32_DLL libspectrum_snap_opus_active( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_active( libspectrum_snap *snap, int opus_active ); +int WIN32_DLL libspectrum_snap_opus_paged( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_paged( libspectrum_snap *snap, int opus_paged ); +int WIN32_DLL libspectrum_snap_opus_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_drive_count( libspectrum_snap *snap, int opus_drive_count ); +int WIN32_DLL libspectrum_snap_opus_custom_rom( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_custom_rom( libspectrum_snap *snap, int opus_custom_rom ); +int WIN32_DLL libspectrum_snap_opus_direction( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_direction( libspectrum_snap *snap, int opus_direction ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_track( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_track( libspectrum_snap *snap, libspectrum_byte opus_track ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_sector( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_sector( libspectrum_snap *snap, libspectrum_byte opus_sector ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data( libspectrum_snap *snap, libspectrum_byte opus_data ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_status( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_status( libspectrum_snap *snap, libspectrum_byte opus_status ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_reg_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_reg_a( libspectrum_snap *snap, libspectrum_byte opus_data_reg_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_dir_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_dir_a( libspectrum_snap *snap, libspectrum_byte opus_data_dir_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_control_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_control_a( libspectrum_snap *snap, libspectrum_byte opus_control_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_reg_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_reg_b( libspectrum_snap *snap, libspectrum_byte opus_data_reg_b ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_dir_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_dir_b( libspectrum_snap *snap, libspectrum_byte opus_data_dir_b ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_control_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_control_b( libspectrum_snap *snap, libspectrum_byte opus_control_b ); +libspectrum_byte WIN32_DLL * libspectrum_snap_opus_rom( libspectrum_snap *snap, int idx ); +void WIN32_DLL libspectrum_snap_set_opus_rom( libspectrum_snap *snap, int idx, libspectrum_byte* opus_rom ); +libspectrum_byte WIN32_DLL * libspectrum_snap_opus_ram( libspectrum_snap *snap, int idx ); +void WIN32_DLL libspectrum_snap_set_opus_ram( libspectrum_snap *snap, int idx, libspectrum_byte* opus_ram ); int WIN32_DLL libspectrum_snap_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_custom_rom( libspectrum_snap *snap, int custom_rom ); size_t WIN32_DLL libspectrum_snap_custom_rom_pages( libspectrum_snap *snap ); Modified: trunk/FuseImporter/libspectrum.h =================================================================== --- trunk/FuseImporter/libspectrum.h 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/FuseImporter/libspectrum.h 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ /* libspectrum.h: the library for dealing with ZX Spectrum emulator files Copyright (c) 2001-2007 Philip Kendall, Darren Salt, Fredrick Meunier - $Id: libspectrum.h.in 4039 2009-06-27 06:04:44Z fredm $ + $Id: libspectrum.h.in 4060 2009-07-30 13:21:38Z 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 @@ -343,6 +343,8 @@ LIBSPECTRUM_ID_DISK_SAD, /* .sad generic disk image */ LIBSPECTRUM_ID_DISK_TD0, /* .td0 generic disk image */ + LIBSPECTRUM_ID_DISK_OPD, /* .opu/.opd Opus Discovery disk image */ + LIBSPECTRUM_ID_SCREEN_SCR, /* .scr screen file */ } libspectrum_id_t; @@ -355,6 +357,7 @@ LIBSPECTRUM_CLASS_CARTRIDGE_TIMEX, /* Timex cartridges */ LIBSPECTRUM_CLASS_DISK_PLUS3, /* +3 disk */ LIBSPECTRUM_CLASS_DISK_TRDOS, /* TR-DOS disk */ + LIBSPECTRUM_CLASS_DISK_OPUS, /* Opus Discovery disk*/ LIBSPECTRUM_CLASS_RECORDING, /* Input recording */ LIBSPECTRUM_CLASS_SNAPSHOT, /* Snapshot */ LIBSPECTRUM_CLASS_TAPE, /* Tape */ @@ -679,6 +682,8 @@ void WIN32_DLL libspectrum_snap_set_beta_active( libspectrum_snap *snap, int beta_active ); int WIN32_DLL libspectrum_snap_beta_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_beta_paged( libspectrum_snap *snap, int beta_paged ); +int WIN32_DLL libspectrum_snap_beta_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_beta_drive_count( libspectrum_snap *snap, int beta_drive_count ); int WIN32_DLL libspectrum_snap_beta_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_beta_custom_rom( libspectrum_snap *snap, int beta_custom_rom ); int WIN32_DLL libspectrum_snap_beta_direction( libspectrum_snap *snap ); @@ -699,6 +704,8 @@ void WIN32_DLL libspectrum_snap_set_plusd_active( libspectrum_snap *snap, int plusd_active ); int WIN32_DLL libspectrum_snap_plusd_paged( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_plusd_paged( libspectrum_snap *snap, int plusd_paged ); +int WIN32_DLL libspectrum_snap_plusd_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_plusd_drive_count( libspectrum_snap *snap, int plusd_drive_count ); int WIN32_DLL libspectrum_snap_plusd_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_plusd_custom_rom( libspectrum_snap *snap, int plusd_custom_rom ); int WIN32_DLL libspectrum_snap_plusd_direction( libspectrum_snap *snap ); @@ -717,6 +724,40 @@ void WIN32_DLL libspectrum_snap_set_plusd_rom( libspectrum_snap *snap, int idx, libspectrum_byte* plusd_rom ); libspectrum_byte WIN32_DLL * libspectrum_snap_plusd_ram( libspectrum_snap *snap, int idx ); void WIN32_DLL libspectrum_snap_set_plusd_ram( libspectrum_snap *snap, int idx, libspectrum_byte* plusd_ram ); +int WIN32_DLL libspectrum_snap_opus_active( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_active( libspectrum_snap *snap, int opus_active ); +int WIN32_DLL libspectrum_snap_opus_paged( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_paged( libspectrum_snap *snap, int opus_paged ); +int WIN32_DLL libspectrum_snap_opus_drive_count( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_drive_count( libspectrum_snap *snap, int opus_drive_count ); +int WIN32_DLL libspectrum_snap_opus_custom_rom( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_custom_rom( libspectrum_snap *snap, int opus_custom_rom ); +int WIN32_DLL libspectrum_snap_opus_direction( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_direction( libspectrum_snap *snap, int opus_direction ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_track( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_track( libspectrum_snap *snap, libspectrum_byte opus_track ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_sector( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_sector( libspectrum_snap *snap, libspectrum_byte opus_sector ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data( libspectrum_snap *snap, libspectrum_byte opus_data ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_status( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_status( libspectrum_snap *snap, libspectrum_byte opus_status ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_reg_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_reg_a( libspectrum_snap *snap, libspectrum_byte opus_data_reg_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_dir_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_dir_a( libspectrum_snap *snap, libspectrum_byte opus_data_dir_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_control_a( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_control_a( libspectrum_snap *snap, libspectrum_byte opus_control_a ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_reg_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_reg_b( libspectrum_snap *snap, libspectrum_byte opus_data_reg_b ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_data_dir_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_data_dir_b( libspectrum_snap *snap, libspectrum_byte opus_data_dir_b ); +libspectrum_byte WIN32_DLL libspectrum_snap_opus_control_b( libspectrum_snap *snap ); +void WIN32_DLL libspectrum_snap_set_opus_control_b( libspectrum_snap *snap, libspectrum_byte opus_control_b ); +libspectrum_byte WIN32_DLL * libspectrum_snap_opus_rom( libspectrum_snap *snap, int idx ); +void WIN32_DLL libspectrum_snap_set_opus_rom( libspectrum_snap *snap, int idx, libspectrum_byte* opus_rom ); +libspectrum_byte WIN32_DLL * libspectrum_snap_opus_ram( libspectrum_snap *snap, int idx ); +void WIN32_DLL libspectrum_snap_set_opus_ram( libspectrum_snap *snap, int idx, libspectrum_byte* opus_ram ); int WIN32_DLL libspectrum_snap_custom_rom( libspectrum_snap *snap ); void WIN32_DLL libspectrum_snap_set_custom_rom( libspectrum_snap *snap, int custom_rom ); size_t WIN32_DLL libspectrum_snap_custom_rom_pages( libspectrum_snap *snap ); Property changes on: trunk/fuse ___________________________________________________________________ Modified: svn:mergeinfo - /vendor/fuse-emulator/0.10.0/fuse:556-557 /vendor/fuse-emulator/0.10.0-pre1/fuse:545-546 /vendor/fuse-emulator/current/fuse:530-600 + /vendor/fuse-emulator/0.10.0/fuse:556-557 /vendor/fuse-emulator/0.10.0-pre1/fuse:545-546 /vendor/fuse-emulator/current/fuse:530-609 Modified: trunk/fuse/AUTHORS =================================================================== --- trunk/fuse/AUTHORS 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/AUTHORS 2009-08-02 10:35:36 UTC (rev 610) @@ -9,8 +9,8 @@ * Ian Collier: the original ZX Printer emulation (for xz80). -* John Elliott: for lib765, which provides Fuse's emulation of the +3's - FDC, and libdsk which provides support for more disk image formats: +* John Elliott: for lib765, which provided Fuse's original emulation of the + +3's FDC, and libdsk which provided support for more disk image formats: see http://www.seasip.demon.co.uk/Unix/LibDsk/ * Darren Salt: the original versions of the code for +3 emulation, @@ -34,15 +34,20 @@ * Marek Januszewski: Some patches making Fuse much closer to compiling under Win32, and fixing up the GTK+ 2.0 interface. -* Stuart Brady: for the Scorpion emulation and HP-UX sound support. +* Stuart Brady: for the Scorpion, +D interface emulation and HP-UX sound + support. * Garry Lancaster: the simple 8-bit IDE, ZXATASP and ZXCF support. -* Gergely Szasz: Interface I/microdrive emulation, the 'movie' code and the - ao sound driver. +* Gergely Szasz: +3, +D, Opus and Interface I/microdrive emulation, the 'movie' + code and the ao sound driver. * Bjoern Giesler: the original Wii port. +* Shay Green: the Blip_Buffer band pass filter for beeper and AY output. + +* Michael D Wynne: the Opus Discovery emulation (for EightyOne). + * Philip Kendall: everything else. -$Id: AUTHORS 3944 2009-01-10 18:17:04Z pak21 $ +$Id: AUTHORS 4060 2009-07-30 13:21:38Z fredm $ Modified: trunk/fuse/ChangeLog =================================================================== --- trunk/fuse/ChangeLog 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/ChangeLog 2009-08-02 10:35:36 UTC (rev 610) @@ -1,3 +1,43 @@ +2009-xx-xx Philip Kendall <phi...@sh...> + + * Fuse ?.??.? released + + FIXME: Just a start, mostly changes visible on Fuse for OS X at the + moment + * Add Opus Discovery disk interface support (Gergely Szasz and Fredrick + Meunier). + * Wii support. + * Many improvements to Win32 UI (Marek Januszewski). + * Add support for flipping disk images in single sided drives (Gergely + Szasz). + * Add support for automatically merging both both disk images where + they are in separate files named with the text [Ss]ide[ _][abAB12] + (Gergely Szasz). + * Switch to using Blip_Buffer (by Shay Green) for improved beeper and + AY output (Fredrick Meunier). + * Allow beeper and AY volumes to be set (Fredrick Meunier). + * Enable Beta 128 interface in 48K and TC2048 machines (thanks, + Omikron) (Fredrick Meunier). + * Add emulation of the Fuller Audio Box (Stuart Brady and Fredrick + Meunier). + * Allow sound to run from 2% speed up (Fredrick Meunier). + * Add emulation of the Melodik and similar 48K-compatible AY interfaces + that use the 128K sound ports (Fredrick Meunier). + * Add support for Pentagon 1024SL v2.2 16 colour mode (Fredrick + Meunier). + + * Miscellaneous improvements: + * Preformat new disks on +3 to allow the format command on +3 to work + (Gergely Szasz). + * Support non-standard TRD images with 41-83 tracks per side (Gergely + Szasz). + * Allow user to swap Kempston mouse buttons as some combinations of + physical hardware and Spectrum software make it hard to use the + standard mapping e.g. right clicking and moving the cursor on Mac + notebooks (thanks, Andrew Owen) (Fredrick Meunier). + * Fixes for speed estimation (Gergely Szasz). + * Fix border colour in Timex HiRes screenshots (Fredrick Meunier). + 2008-12-10 Philip Kendall <phi...@sh...> * Fuse 0.10.0.1 released @@ -941,4 +981,4 @@ * Version 0.1.0 released. -$Id: ChangeLog 3900 2008-12-10 19:31:31Z pak21 $ +$Id: ChangeLog 4060 2009-07-30 13:21:38Z fredm $ Modified: trunk/fuse/README =================================================================== --- trunk/fuse/README 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/README 2009-08-02 10:35:36 UTC (rev 610) @@ -25,7 +25,7 @@ * Support for the RZX input recording file format, including rollback and 'competition mode'. * Emulation of the DivIDE, Interface I, Kempston mouse, Spectrum +3e, - ZXATASP, ZXCF, Beta 128 and +D interfaces. + ZXATASP, ZXCF, Beta 128, Opus Discovery and +D interfaces. Help! <xyz> doesn't work ------------------------ @@ -180,4 +180,4 @@ Philip Kendall <phi...@sh...> 10 December 2008 -$Id: README 4021 2009-05-29 13:39:51Z fredm $ +$Id: README 4060 2009-07-30 13:21:38Z fredm $ Modified: trunk/fuse/disk/Makefile.am =================================================================== --- trunk/fuse/disk/Makefile.am 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/disk/Makefile.am 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in ## Copyright (c) 2007 Stuart Brady -## $Id: Makefile.am 3584 2008-03-25 10:27:30Z fredm $ +## $Id: Makefile.am 4060 2009-07-30 13:21:38Z 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 @@ -33,6 +33,7 @@ crc.c \ disk.c \ fdd.c \ + opus.c \ plusd.c \ upd_fdc.c \ wd_fdc.c @@ -41,6 +42,7 @@ crc.h \ disk.h \ fdd.h \ + opus.h \ plusd.h \ upd_fdc.h \ wd_fdc.h Modified: trunk/fuse/disk/beta.c =================================================================== --- trunk/fuse/disk/beta.c 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/disk/beta.c 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ /* beta.c: Routines for handling the Beta disk interface Copyright (c) 2004-2008 Stuart Brady - $Id: beta.c 4029 2009-06-05 13:50:55Z fredm $ + $Id: beta.c 4060 2009-07-30 13:21:38Z 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 @@ -708,6 +708,11 @@ 1 ) ) return; + /* ignore drive count for now, there will be an issue with loading snaps where + drives have been disabled + libspectrum_snap_beta_drive_count( snap ) + */ + beta_fdc->direction = libspectrum_snap_beta_direction( snap ); beta_cr_write ( 0x001f, 0 ); @@ -723,6 +728,7 @@ int attached; wd_fdc *f = beta_fdc; libspectrum_byte *buffer; + int drive_count = 0; if( !periph_beta128_active ) return; @@ -745,6 +751,12 @@ libspectrum_snap_set_beta_custom_rom( snap, 1 ); } + drive_count++; /* Drive A is not removable */ + if( option_enumerate_diskoptions_drive_beta128b_type() > 0 ) drive_count++; + if( option_enumerate_diskoptions_drive_beta128c_type() > 0 ) drive_count++; + if( option_enumerate_diskoptions_drive_beta128d_type() > 0 ) drive_count++; + libspectrum_snap_set_beta_drive_count( snap, drive_count ); + libspectrum_snap_set_beta_paged ( snap, beta_active ); libspectrum_snap_set_beta_direction( snap, beta_fdc->direction ); libspectrum_snap_set_beta_status( snap, beta_sr_read( 0x001f, &attached ) ); Modified: trunk/fuse/disk/disk.c =================================================================== --- trunk/fuse/disk/disk.c 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/disk/disk.c 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ /* disk.c: Routines for handling disk images Copyright (c) 2007 Gergely Szasz - $Id: disk.c 4037 2009-06-13 13:28:42Z fredm $ + $Id: disk.c 4061 2009-07-30 23:37:29Z 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 @@ -252,6 +252,7 @@ #define DISK_MFM_VARI 16 #define DISK_DDAM 32 #define DISK_CORRUPT_SECTOR 64 +#define DISK_UNFORMATTED_TRACK 128 static int guess_track_geom( disk_t *d, int head, int track, int *sector_base, @@ -295,7 +296,7 @@ static int check_disk_geom( disk_t *d, int *sector_base, int *sectors, - int *seclen, int *mfm ) + int *seclen, int *mfm, int *unf ) { int h, t, s, slen, sbase, m; int r = 0; @@ -306,6 +307,7 @@ *sectors = -1; *seclen = -1; *mfm = -1; + *unf = -1; for( t = 0; t < d->cylinders; t++ ) { for( h = 0; h < d->sides; h++ ) { r |= guess_track_geom( d, h, t, &sbase, &s, &slen, &m ); @@ -317,6 +319,12 @@ *seclen = slen; if( *mfm == -1 ) *mfm = m; + if( sbase == -1 ) { /* unformatted */ + if( *unf == -1 && h > 0 ) *unf = -2; + if( *unf == -1 ) *unf = t; + continue; + } + if( *unf > -1 ) *unf = -2; if( sbase != *sector_base ) { r |= DISK_SBASE_VARI; if( sbase < *sector_base ) @@ -338,6 +346,11 @@ } } } + if( *unf == -2 ) { + r |= DISK_UNFORMATTED_TRACK; + *unf = -1; + } + return r; } @@ -569,6 +582,7 @@ #define NO_INTERLEAVE 1 #define INTERLEAVE_2 2 +#define INTERLEAVE_OPUS 13 #define NO_PREINDEX 0 #define PREINDEX 1 @@ -593,15 +607,18 @@ idx = d->i; pos = i = 0; for( s = sector_base; s < sector_base + sectors; s++ ) { - d->i = idx + ( pos + i ) * slen; + d->i = idx + pos * slen; if( id_add( d, head, track, s, sector_length >> 8, gap, CRC_OK ) ) return 1; if( data_add( d, buffer, NULL, sector_length, NO_DDAM, gap, CRC_OK, autofill ) ) return 1; pos += interleave; - if( pos >= sectors ) { - pos = 0; - i++; + if( pos >= sectors ) { /* wrap around */ + pos -= sectors; + if( pos <= i ) { /* we fill this pos already */ + pos++; /* skip one more pos */ + i++; + } } } d->i = idx + sectors * slen; @@ -783,14 +800,16 @@ } static int -open_mgt_img( buffer_t *buffer, disk_t *d ) +open_img_mgt_opd( buffer_t *buffer, disk_t *d ) { int i, j, sectors, seclen; buffer->index = 0; /* guess geometry of disk: - * 2*80*10*512, 1*80*10*512 or 1*40*10*512 */ + * 2*80*10*512, 1*80*10*512, 1*40*10*512, 1*40*18*256, 1*80*18*256, + * 2*80*18*256 + */ if( buffer->file.length == 2*80*10*512 ) { d->sides = 2; d->cylinders = 80; sectors = 10; seclen = 512; } else if( buffer->file.length == 1*80*10*512 ) { @@ -799,6 +818,14 @@ d->sides = 1; d->cylinders = 80; sectors = 10; seclen = 512; } else if( buffer->file.length == 1*40*10*512 ) { d->sides = 1; d->cylinders = 40; sectors = 10; seclen = 512; + } else if( buffer->file.length == 1*40*18*256 ) { + d->sides = 1; d->cylinders = 40; sectors = 18; seclen = 256; + } else if( buffer->file.length == 1*80*18*256 ) { + /* we cannot distinguish between a single sided 80 track image + * and a double sided 40 track image (2*40*18*256) */ + d->sides = 1; d->cylinders = 80; sectors = 18; seclen = 256; + } else if( buffer->file.length == 2*80*18*256 ) { + d->sides = 2; d->cylinders = 80; sectors = 18; seclen = 256; } else { return d->status = DISK_GEOM; } @@ -816,11 +843,14 @@ return d->status = DISK_GEOM; } } - } else { /* MGT alt */ - for( i = 0; i < d->sides * d->cylinders; i++ ) { - if( trackgen( d, buffer, i % 2, i / 2, 1, sectors, seclen, - NO_PREINDEX, GAP_MGT_PLUSD, NO_INTERLEAVE, NO_AUTOFILL ) ) - return d->status = DISK_GEOM; + } else { /* MGT / OPD alt */ + for( i = 0; i < d->cylinders; i++ ) { + for( j = 0; j < d->sides; j++ ) { + if( trackgen( d, buffer, j, i, d->type == DISK_MGT ? 1 : 0, sectors, seclen, + NO_PREINDEX, GAP_MGT_PLUSD, + d->type == DISK_MGT ? NO_INTERLEAVE : INTERLEAVE_OPUS, NO_AUTOFILL ) ) + return d->status = DISK_GEOM; + } } } @@ -1072,7 +1102,7 @@ plus3_fix = CPC_ISSUE_NONE; } trlen += seclen; - if( seclen == 0x80 ) /* every 128byte length sector padded */ + if( seclen % 0x100 ) /* every? 128/384/...byte length sector padded */ sector_pad++; } if( i < 84 ) { @@ -1106,6 +1136,7 @@ preindex_add( d, gap ); postindex_add( d, gap ); + sector_pad = 0; for( j = 0; j < hdrb[0x15]; j++ ) { /* each sector */ seclen = d->type == DISK_ECPC ? hdrb[ 0x1e + 8 * j ] + /* data length in sector */ 256 * hdrb[ 0x1f + 8 * j ] @@ -1169,10 +1200,11 @@ /* ( ( N * len ) / len - 1 ) * len */ } } - if( seclen == 0x80 ) /* every 128byte length sector padded */ - buffer->index += 0x80; + if( seclen % 0x100 ) /* every? 128/384/...byte length sector padded */ + sector_pad++; } gap4_add( d, gap ); + buffer->index += sector_pad * 0x80; } return d->status = DISK_OK; } @@ -1504,11 +1536,13 @@ d->type = DISK_UDI; open_udi( &buffer, d ); break; + case LIBSPECTRUM_ID_DISK_OPD: + d->type = DISK_OPD; case LIBSPECTRUM_ID_DISK_MGT: - d->type = DISK_MGT; + if( d->type == DISK_TYPE_NONE) d->type = DISK_MGT; case LIBSPECTRUM_ID_DISK_IMG: if( d->type == DISK_TYPE_NONE) d->type = DISK_IMG; - open_mgt_img( &buffer, d ); + open_img_mgt_opd( &buffer, d ); break; case LIBSPECTRUM_ID_DISK_SAD: d->type = DISK_SAD; @@ -1733,25 +1767,31 @@ } static int -write_img_mgt( FILE *file, disk_t *d ) +write_img_mgt_opd( FILE *file, disk_t *d ) { - int i, j, sbase, sectors, seclen, mfm; + int i, j, sbase, sectors, seclen, mfm, cyl; - if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm ) || - sbase != 1 || seclen != 2 || sectors != 10 ) + if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm, &cyl ) || + ( d->type != DISK_OPD && ( sbase != 1 || seclen != 2 || sectors != 10 ) ) || + ( d->type == DISK_OPD && ( sbase != 0 || seclen != 1 || sectors != 18 ) ) ) return d->status = DISK_GEOM; + if( cyl == -1 ) cyl = d->cylinders; + if( cyl != 40 && cyl != 80 ) + return d->status = DISK_GEOM; + if( d->type == DISK_IMG ) { /* out-out */ for( j = 0; j < d->sides; j++ ) { - for( i = 0; i < d->cylinders; i++ ) { + for( i = 0; i < cyl; i++ ) { if( savetrack( d, file, j, i, 1, sectors, seclen ) ) return d->status = DISK_GEOM; } } } else { /* alt */ - for( i = 0; i < d->cylinders; i++ ) { /* MGT */ + for( i = 0; i < cyl; i++ ) { /* MGT */ for( j = 0; j < d->sides; j++ ) { - if( savetrack( d, file, j, i, 1, sectors, seclen ) ) + if( savetrack( d, file, j, i, d->type == DISK_MGT ? 1 : 0, + sectors, seclen ) ) return d->status = DISK_GEOM; } } @@ -1762,12 +1802,14 @@ static int write_trd( FILE *file, disk_t *d ) { - int i, j, sbase, sectors, seclen, mfm; + int i, j, sbase, sectors, seclen, mfm, cyl; - if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm ) || + if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm, &cyl ) || sbase != 1 || seclen != 1 || sectors != 16 ) return d->status = DISK_GEOM; - for( i = 0; i < d->cylinders; i++ ) { + + if( cyl == -1 ) cyl = d->cylinders; + for( i = 0; i < cyl; i++ ) { for( j = 0; j < d->sides; j++ ) { if( savetrack( d, file, j, i, 1, sectors, seclen ) ) return d->status = DISK_GEOM; @@ -1779,21 +1821,22 @@ static int write_sad( FILE *file, disk_t *d ) { - int i, j, sbase, sectors, seclen, mfm; + int i, j, sbase, sectors, seclen, mfm, cyl; - if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm ) || sbase != 1 ) + if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm, &cyl ) || sbase != 1 ) return d->status = DISK_GEOM; + if( cyl == -1 ) cyl = d->cylinders; memcpy( head, "Aley's disk backup", 18 ); head[18] = d->sides; - head[19] = d->cylinders; + head[19] = cyl; head[20] = sectors; head[21] = seclen * 4; if( fwrite( head, 22, 1, file ) != 1 ) /* SAD head */ return d->status = DISK_WRPART; for( j = 0; j < d->sides; j++ ) { /* OUT-OUT */ - for( i = 0; i < d->cylinders; i++ ) { + for( i = 0; i < cyl; i++ ) { if( savetrack( d, file, j, i, 1, sectors, seclen ) ) return d->status = DISK_GEOM; } @@ -1894,19 +1937,21 @@ static int write_cpc( FILE *file, disk_t *d ) { - int i, j, k, sbase, sectors, seclen, mfm; + int i, j, k, sbase, sectors, seclen, mfm, cyl; int h, t, s, b; size_t len; - i = check_disk_geom( d, &sbase, §ors, &seclen, &mfm ); + i = check_disk_geom( d, &sbase, §ors, &seclen, &mfm, &cyl ); if( i & DISK_SECLEN_VARI || i & DISK_SPT_VARI ) return d->status = DISK_GEOM; if( i & DISK_MFM_VARI ) mfm = -1; + if( cyl == -1 ) cyl = d->cylinders; + memset( head, 0, 256 ); memcpy( head, "MV - CPCEMU Disk-File\r\nDisk-Info\r\n", 34 ); - head[0x30] = d->cylinders; + head[0x30] = cyl; head[0x31] = d->sides; len = sectors * ( 0x80 << seclen ) + 256; head[0x32] = len & 0xff; @@ -1916,7 +1961,7 @@ memset( head, 0, 256 ); memcpy( head, "Track-Info\r\n", 12 ); - for( i = 0; i < d->cylinders; i++ ) { + for( i = 0; i < cyl; i++ ) { for( j = 0; j < d->sides; j++ ) { d->track = d->data + ( ( d->sides * i + j ) * d->tlen ); d->clocks = d->track + d->bpt; @@ -1952,11 +1997,11 @@ static int write_scl( FILE *file, disk_t *d ) { - int i, j, k, l, t, s, sbase, sectors, seclen, mfm, del; + int i, j, k, l, t, s, sbase, sectors, seclen, mfm, del, cyl; int entries; libspectrum_dword sum = 597; /* sum of "SINCLAIR" */ - if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm ) || + if( check_disk_geom( d, &sbase, §ors, &seclen, &mfm, &cyl ) || sbase != 1 || seclen != 1 || sectors != 16 ) return d->status = DISK_GEOM; @@ -2071,7 +2116,9 @@ { int i, j, k, del, rev; int h, t, s, b; + char str[17]; + str[16] = '\0'; fprintf( file, "DISK tracks log!\n" ); fprintf( file, "Sides: %d, cylinders: %d\n", d->sides, d->cylinders ); for( j = 0; j < d->cylinders; j++ ) { /* ALT :) */ @@ -2110,9 +2157,11 @@ if( !( k % 16 ) ) fprintf( file, "0x%08x:", k ); fprintf( file, " 0x%02x", d->track[ d->i ] ); + str[ k & 0x0f ] = d->track[ d->i ] >= 32 && + d->track[ d->i ] < 127 ? d->track[ d->i ] : '.'; k++; if( !( k % 16 ) ) - fprintf( file, "\n" ); + fprintf( file, " | %s\n", str ); d->i++; if( d->i >= d->bpt ) { d->i = 0; @@ -2170,6 +2219,8 @@ d->type = DISK_CPC; /* ALT side */ else if( !strcasecmp( ext, ".mgt" ) ) d->type = DISK_MGT; /* ALT side */ + else if( !strcasecmp( ext, ".opd" ) || !strcasecmp( ext, ".opu" ) ) + d->type = DISK_OPD; /* ALT side */ else if( !strcasecmp( ext, ".img" ) ) /* out-out */ d->type = DISK_IMG; else if( !strcasecmp( ext, ".trd" ) ) /* ALT */ @@ -2192,7 +2243,8 @@ break; case DISK_IMG: case DISK_MGT: - write_img_mgt( file, d ); + case DISK_OPD: + write_img_mgt_opd( file, d ); break; case DISK_TRD: write_trd( file, d ); Modified: trunk/fuse/disk/fdd.c =================================================================== --- trunk/fuse/disk/fdd.c 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/disk/fdd.c 2009-08-02 10:35:36 UTC (rev 610) @@ -1,7 +1,7 @@ /* fdd.c: Routines for emulating floppy disk drives Copyright (c) 2007 Gergely Szasz - $Id: fdd.c 4012 2009-04-16 12:42:14Z fredm $ + $Id: fdd.c 4045 2009-07-10 13:11:12Z 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 @@ -131,6 +131,7 @@ fdd_init( fdd_t *d, fdd_type_t type, int heads, int cyls, int reinit ) { int upsidedown = d->upsidedown; + int selected = d->selected; disk_t *disk = d->disk; d->fdd_heads = d->fdd_cylinders = d->c_head = d->c_cylinder = 0; @@ -148,6 +149,7 @@ d->auto_geom = 1; d->fdd_heads = heads; d->fdd_cylinders = cyls; + if( reinit ) d->selected = selected; if( reinit && disk ) { fdd_unload( d ); fdd_load( d, disk, upsidedown ); Copied: trunk/fuse/disk/opus.c (from rev 609, vendor/fuse-emulator/current/fuse/disk/opus.c) =================================================================== --- trunk/fuse/disk/opus.c (rev 0) +++ trunk/fuse/disk/opus.c 2009-08-02 10:35:36 UTC (rev 610) @@ -0,0 +1,725 @@ +/* opus.c: Routines for handling the Opus Discovery interface + Copyright (c) 1999-2009 Stuart Brady, Fredrick Meunier, Philip Kendall, + Dmitry Sanarin, Darren Salt, Michael D Wynne, Gergely Szasz + + $Id: opus.c 4012 2009-04-16 12:42:14Z 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 + 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: + + Philip: phi...@sh... + + Stuart: sd...@nt... + +*/ + +#include <config.h> + +#include <libspectrum.h> + +#include <string.h> + +#include "compat.h" +#include "machine.h" +#include "module.h" +#include "opus.h" +#include "printer.h" +#include "settings.h" +#include "ui/ui.h" +#include "wd_fdc.h" +#include "options.h" /* needed for get combo options */ +#include "z80/z80.h" + +#define DISK_TRY_MERGE(heads) ( option_enumerate_diskoptions_disk_try_merge() == 2 || \ + ( option_enumerate_diskoptions_disk_try_merge() == 1 && heads == 1 ) ) + +int opus_available = 0; +int opus_active = 0; + +static int opus_index_pulse; + +static int index_event; + +#define OPUS_NUM_DRIVES 2 + +static wd_fdc *opus_fdc; +static wd_fdc_drive opus_drives[ OPUS_NUM_DRIVES ]; + +static libspectrum_byte opus_ram[ 0x800 ]; + +/* 6821 PIA internal registers */ +static libspectrum_byte data_reg_a, data_dir_a, control_a; +static libspectrum_byte data_reg_b, data_dir_b, control_b; + +static void opus_reset( int hard_reset ); +static void opus_memory_map( void ); +static void opus_enabled_snapshot( libspectrum_snap *snap ); +static void opus_from_snapshot( libspectrum_snap *snap ); +static void opus_to_snapshot( libspectrum_snap *snap ); +static void opus_event_index( libspectrum_dword last_tstates, int type, + void *user_data ); + +static module_info_t opus_module_info = { + + opus_reset, + opus_memory_map, + opus_enabled_snapshot, + opus_from_snapshot, + opus_to_snapshot, + +}; + +void +opus_page( void ) +{ + opus_active = 1; + machine_current->ram.romcs = 1; + machine_current->memory_map(); +} + +void +opus_unpage( void ) +{ + opus_active = 0; + machine_current->ram.romcs = 0; + machine_current->memory_map(); +} + +static void +opus_memory_map( void ) +{ + if( !opus_active ) return; + + memory_map_read[ 0 ] = memory_map_write[ 0 ] = memory_map_romcs[ 0 ]; + memory_map_read[ 1 ] = memory_map_write[ 1 ] = memory_map_romcs[ 1 ]; +} + +static void +opus_set_datarq( struct wd_fdc *f ) +{ + event_add( 0, z80_nmi_event ); +} + +int +opus_init( void ) +{ + int i; + wd_fdc_drive *d; + + opus_fdc = wd_fdc_alloc_fdc( WD1770, 0, WD_FLAG_OPUS ); + + for( i = 0; i < OPUS_NUM_DRIVES; i++ ) { + d = &opus_drives[ i ]; + fdd_init( &d->fdd, FDD_SHUGART, 0, 0, 0 ); /* drive geometry 'autodetect' */ + d->disk.flag = DISK_FLAG_NONE; + } + + opus_fdc->current_drive = &opus_drives[ 0 ]; + fdd_select( &opus_drives[ 0 ].fdd, 1 ); + opus_fdc->dden = 1; + opus_fdc->set_intrq = NULL; + opus_fdc->reset_intrq = NULL; + opus_fdc->set_datarq = opus_set_datarq; + opus_fdc->reset_datarq = NULL; + opus_fdc->iface = NULL; + + index_event = event_register( opus_event_index, "Opus index" ); + + module_register( &opus_module_info ); + + return 0; +} + +static void +opus_reset( int hard_reset ) +{ + int i; + wd_fdc_drive *d; + const fdd_params_t *dt; + + opus_active = 0; + opus_available = 0; + + event_remove_type( index_event ); + + if( !periph_opus_active ) + return; + + machine_load_rom_bank( memory_map_romcs, 0, 0, + settings_current.rom_opus, + settings_default.rom_opus, 0x2000 ); + + memory_map_romcs[0].source = MEMORY_SOURCE_PERIPHERAL; + + memory_map_romcs[1].page = opus_ram; + memory_map_romcs[1].source = MEMORY_SOURCE_PERIPHERAL; + + machine_current->ram.romcs = 0; + + memory_map_romcs[ 0 ].writable = 0; + memory_map_romcs[ 1 ].writable = 1; + + data_reg_a = 0; + data_dir_a = 0; + control_a = 0; + data_reg_b = 0; + data_dir_b = 0; + control_b = 0; + + opus_available = 1; + opus_index_pulse = 0; + + if( hard_reset ) + memset( opus_ram, 0, 0x800 ); + + wd_fdc_master_reset( opus_fdc ); + + for( i = 0; i < OPUS_NUM_DRIVES; i++ ) { + d = &opus_drives[ i ]; + + d->index_pulse = 0; + d->index_interrupt = 0; + } + + /* We can eject disks only if they are currently present */ + dt = &fdd_params[ option_enumerate_diskoptions_drive_opus1_type() + 1 ]; /* +1 => there is no `Disabled' */ + fdd_init( &opus_drives[ OPUS_DRIVE_1 ].fdd, FDD_SHUGART, + dt->heads, dt->cylinders, 1 ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1, dt->enabled ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_EJECT, + opus_drives[ OPUS_DRIVE_1 ].fdd.loaded ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_FLIP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.upsidedown ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_WP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.wrprot ); + + + dt = &fdd_params[ option_enumerate_diskoptions_drive_opus2_type() ]; + fdd_init( &opus_drives[ OPUS_DRIVE_2 ].fdd, dt->enabled ? FDD_SHUGART : FDD_TYPE_NONE, + dt->heads, dt->cylinders, 1 ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2, dt->enabled ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_EJECT, + opus_drives[ OPUS_DRIVE_2 ].fdd.loaded ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_FLIP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.upsidedown ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_WP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.wrprot ); + + + opus_fdc->current_drive = &opus_drives[ 0 ]; + fdd_select( &opus_drives[ 0 ].fdd, 1 ); + machine_current->memory_map(); + opus_event_index( 0, index_event, NULL ); + + ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE ); +} + +void +opus_end( void ) +{ + opus_available = 0; +} + +/* + * opus_6821_access( reg, data, dir ) + * + * reg - register to access: + * + * data - if dir = 1 the value being written else ignored + * + * dir - direction of data. 0 = read, 1 = write + * + * returns: value of register if dir = 0 else 0 + * + * Mostly borrowed from EightyOne - A Windows ZX80/81/clone emulator + */ + +static libspectrum_byte +opus_6821_access( libspectrum_byte reg, libspectrum_byte data, + libspectrum_byte dir ) +{ + int drive, side; + int i; + + switch( reg & 0x03 ) { + case 0: + if( dir ) { + if( control_a & 0x04 ) { + data_reg_a = data; + + drive = ( data & 0x02 ) == 2 ? 1 : 0; + side = ( data & 0x10 )>>4 ? 1 : 0; + + for( i = 0; i < OPUS_NUM_DRIVES; i++ ) { + fdd_set_head( &opus_drives[ i ].fdd, side ); + } + + fdd_select( &opus_drives[ (!drive) ].fdd, 0 ); + fdd_select( &opus_drives[ drive ].fdd, 1 ); + + if( opus_fdc->current_drive != &opus_drives[ drive ] ) { + if( opus_fdc->current_drive->fdd.motoron ) { /* swap motoron */ + fdd_motoron( &opus_drives[ (!drive) ].fdd, 0 ); + fdd_motoron( &opus_drives[ drive ].fdd, 1 ); + } + opus_fdc->current_drive = &opus_drives[ drive ]; + } + } else { + data_dir_a = data; + } + } else { + if( control_a & 0x04 ) { + /* printer never busy (bit 6) */ + data_reg_a &= ~0x40; + return data_reg_a; + } else { + return data_dir_a; + } + } + break; + case 1: + if( dir ) { + control_a = data; + } else { + /* Always return bit 6 set to ACK parallel port actions */ + return control_a | 0x40; + } + break; + case 2: + if( dir ) { + if( control_b & 0x04 ) { + data_reg_b = data; + printer_parallel_write( 0x00, data ); + /* Don't worry about emulating the strobes from the ROM, they are + all bound up with checking current printer busy status which we + don't emulate, so just send the char now */ + printer_parallel_strobe_write( 0 ); + printer_parallel_strobe_write( 1 ); + printer_parallel_strobe_write( 0 ); + } else { + data_dir_b = data; + } + } else { + if( control_b & 0x04 ) { + return data_reg_b; + } else { + return data_dir_b; + } + } + break; + case 3: + if( dir ) { + control_b = data; + } else { + return control_b; + } + break; + } + + return 0; +} + +int +opus_disk_insert( opus_drive_number which, const char *filename, + int autoload ) +{ + int error; + wd_fdc_drive *d; + const fdd_params_t *dt; + + if( which >= OPUS_NUM_DRIVES ) { + ui_error( UI_ERROR_ERROR, "opus_disk_insert: unknown drive %d", + which ); + fuse_abort(); + } + + d = &opus_drives[ which ]; + + /* Eject any disk already in the drive */ + if( d->fdd.loaded ) { + /* Abort the insert if we want to keep the current disk */ + if( opus_disk_eject( which, 0 ) ) return 0; + } + + if( filename ) { + error = disk_open( &d->disk, filename, 0, DISK_TRY_MERGE( d->fdd.fdd_heads ) ); + if( error != DISK_OK ) { + ui_error( UI_ERROR_ERROR, "Failed to open disk image: %s", + disk_strerror( error ) ); + return 1; + } + } else { + switch( which ) { + case 0: + /* +1 => there is no `Disabled' */ + dt = &fdd_params[ option_enumerate_diskoptions_drive_opus1_type() + 1 ]; + break; + case 1: + default: + dt = &fdd_params[ option_enumerate_diskoptions_drive_opus2_type() ]; + break; + } + error = disk_new( &d->disk, dt->heads, dt->cylinders, DISK_DENS_AUTO, DISK_UDI ); + if( error != DISK_OK ) { + ui_error( UI_ERROR_ERROR, "Failed to create disk image: %s", + disk_strerror( error ) ); + return 1; + } + } + + fdd_load( &d->fdd, &d->disk, 0 ); + + /* Set the 'eject' item active */ + switch( which ) { + case OPUS_DRIVE_1: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_EJECT, 1 ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_FLIP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.upsidedown ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_WP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.wrprot ); + break; + case OPUS_DRIVE_2: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_EJECT, 1 ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_FLIP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.upsidedown ); + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_WP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.wrprot ); + break; + } + + if( filename && autoload ) { + /* XXX */ + } + + return 0; +} + +int +opus_disk_eject( opus_drive_number which, int write ) +{ + wd_fdc_drive *d; + + if( which >= OPUS_NUM_DRIVES ) + return 1; + + d = &opus_drives[ which ]; + + if( d->disk.type == DISK_TYPE_NONE ) + return 0; + + if( write ) { + + if( ui_opus_disk_write( which ) ) return 1; + + } else { + + if( d->disk.dirty ) { + + ui_confirm_save_t confirm = ui_confirm_save( + "Disk in Opus Discovery drive %c has been modified.\n" + "Do you want to save it?", + which == OPUS_DRIVE_1 ? '1' : '2' + ); + + switch( confirm ) { + + case UI_CONFIRM_SAVE_SAVE: + if( ui_opus_disk_write( which ) ) return 1; + break; + + case UI_CONFIRM_SAVE_DONTSAVE: break; + case UI_CONFIRM_SAVE_CANCEL: return 1; + + } + } + } + + fdd_unload( &d->fdd ); + disk_close( &d->disk ); + + /* Set the 'eject' item inactive */ + switch( which ) { + case OPUS_DRIVE_1: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_EJECT, 0 ); + break; + case OPUS_DRIVE_2: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_EJECT, 0 ); + break; + } + return 0; +} + +int +opus_disk_flip( opus_drive_number which, int flip ) +{ + wd_fdc_drive *d; + + if( which >= OPUS_NUM_DRIVES ) + return 1; + + d = &opus_drives[ which ]; + + if( !d->fdd.loaded ) + return 1; + + fdd_flip( &d->fdd, flip ); + + /* Update the 'write flip' menu item */ + switch( which ) { + case OPUS_DRIVE_1: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_FLIP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.upsidedown ); + break; + case OPUS_DRIVE_2: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_FLIP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.upsidedown ); + break; + } + return 0; +} + +int +opus_disk_writeprotect( opus_drive_number which, int wrprot ) +{ + wd_fdc_drive *d; + + if( which >= OPUS_NUM_DRIVES ) + return 1; + + d = &opus_drives[ which ]; + + if( !d->fdd.loaded ) + return 1; + + fdd_wrprot( &d->fdd, wrprot ); + + /* Update the 'write protect' menu item */ + switch( which ) { + case OPUS_DRIVE_1: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_1_WP_SET, + !opus_drives[ OPUS_DRIVE_1 ].fdd.wrprot ); + break; + case OPUS_DRIVE_2: + ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_OPUS_2_WP_SET, + !opus_drives[ OPUS_DRIVE_2 ].fdd.wrprot ); + break; + } + return 0; +} + +int +opus_disk_write( opus_drive_number which, const char *filename ) +{ + wd_fdc_drive *d = &opus_drives[ which ]; + int error; + + d->disk.type = DISK_TYPE_NONE; + error = disk_write( &d->disk, filename ); + + if( error != DISK_OK ) { + ui_error( UI_ERROR_ERROR, "couldn't write '%s' file: %s", filename, + disk_strerror( error ) ); + return 1; + } + + return 0; +} + +fdd_t * +opus_get_fdd( opus_drive_number which ) +{ + return &( opus_drives[ which ].fdd ); +} + +static void +opus_event_index( libspectrum_dword last_tstates, int type GCC_UNUSED, + void *user_data GCC_UNUSED ) +{ + int next_tstates; + int i; + + opus_index_pulse = !opus_index_pulse; + for( i = 0; i < OPUS_NUM_DRIVES; i++ ) { + wd_fdc_drive *d = &opus_drives[ i ]; + + d->index_pulse = opus_index_pulse; + if( !opus_index_pulse && d->index_interrupt ) { + wd_fdc_set_intrq( opus_fdc ); + d->index_interrupt = 0; + } + } + next_tstates = ( opus_index_pulse ? 10 : 190 ) * + machine_current->timings.processor_speed / 1000; + event_add( last_tstates + next_tstates, index_event ); +} + +libspectrum_byte +opus_read( libspectrum_word address ) +{ + libspectrum_byte data = 0xff; + + if( address >= 0x3800 ) data = 0xff; /* Undefined on Opus */ + else if( address >= 0x3000 ) /* 6821 PIA */ + data = opus_6821_access( address, 0, 0 ); + else if( address >= 0x2800 ) { /* WD1770 FDC */ + switch( address & 0x03 ) { + case 0: + data = wd_fdc_sr_read( opus_fdc ); + break; + case 1: + data = wd_fdc_tr_read( opus_fdc ); + break; + case 2: + data = wd_fdc_sec_read( opus_fdc ); + break; + case 3: + data = wd_fdc_dr_read( opus_fdc ); + break; + } + } + + return data; +} + +void +opus_write( libspectrum_word address, libspectrum_byte b ) +{ + if( address < 0x2000 ) return; + if( address >= 0x3800 ) return; + + if( address >= 0x3000 ) { + opus_6821_access( address, b, 1 ); + } else if( address >= 0x2800 ) { + switch( address & 0x03 ) { + case 0: + wd_fdc_cr_write( opus_fdc, b ); + break; + case 1: + wd_fdc_tr_write( opus_fdc, b ); + break; + case 2: + wd_fdc_sec_write( opus_fdc, b ); + break; + case 3: + wd_fdc_dr_write( opus_fdc, b ); + break; + } + } +} + +static libspectrum_byte * +alloc_and_copy_page( libspectrum_byte* source_page ) +{ + libspectrum_byte *buffer; + buffer = malloc( MEMORY_PAGE_SIZE ); + if( !buffer ) { + ui_error( UI_ERROR_ERROR, "Out of memory at %s:%d", __FILE__, + __LINE__ ); + return 0; + } + + memcpy( buffer, source_page, MEMORY_PAGE_SIZE ); + return buffer; +} + +static void +opus_enabled_snapshot( libspectrum_snap *snap ) +{ + if( libspectrum_snap_opus_active( snap ) ) + settings_current.opus = 1; +} + +static void +opus_from_snapshot( libspectrum_snap *snap ) +{ + if( !libspectrum_snap_opus_active( snap ) ) return; + + if( libspectrum_snap_opus_custom_rom( snap ) && + libspectrum_snap_opus_rom( snap, 0 ) && + machine_load_rom_bank_from_buffer( + memory_map_romcs, 0, 0, + libspectrum_snap_opus_rom( snap, 0 ), + MEMORY_PAGE_SIZE, + 1 ) ) + return; + + if( libspectrum_snap_opus_ram( snap, 0 ) ) { + memcpy( opus_ram, + libspectrum_snap_opus_ram( snap, 0 ), 0x800 ); + } + + /* ignore drive count for now, there will be an issue with loading snaps where + drives have been disabled + libspectrum_snap_opus_drive_count( snap ) + */ + + opus_fdc->direction = libspectrum_snap_opus_direction( snap ); + + wd_fdc_cr_write ( opus_fdc, libspectrum_snap_opus_status ( snap ) ); + wd_fdc_tr_write ( opus_fdc, libspectrum_snap_opus_track ( snap ) ); + wd_fdc_sec_write( opus_fdc, libspectrum_snap_opus_sector ( snap ) ); + wd_fdc_dr_write ( opus_fdc, libspectrum_snap_opus_data ( snap ) ); + data_reg_a = libspectrum_snap_opus_data_reg_a( snap ); + data_dir_a = libspectrum_snap_opus_data_dir_a( snap ); + control_a = libspectrum_snap_opus_control_a ( snap ); + data_reg_b = libspectrum_snap_opus_data_reg_b( snap ); + data_dir_b = libspectrum_snap_opus_data_dir_b( snap ); + control_b = libspectrum_snap_opus_control_b ( snap ); + + if( libspectrum_snap_opus_paged( snap ) ) { + opus_page(); + } else { + opus_unpage(); + } +} + +static void +opus_to_snapshot( libspectrum_snap *snap GCC_UNUSED ) +{ + libspectrum_byte *buffer; + int drive_count = 0; + + if( !periph_opus_active ) return; + + libspectrum_snap_set_opus_active( snap, 1 ); + + buffer = alloc_and_copy_page( memory_map_romcs[0].page ); + if( !buffer ) return; + libspectrum_snap_set_opus_rom( snap, 0, buffer ); + if( memory_map_romcs[0].source == MEMORY_SOURCE_CUSTOMROM ) + libspectrum_snap_set_opus_custom_rom( snap, 1 ); + + buffer = alloc_and_copy_page( opus_ram ); + if( !buffer ) return; + libspectrum_snap_set_opus_ram( snap, 0, buffer ); + + drive_count++; /* Drive 1 is not removable */ + if( option_enumerate_diskoptions_drive_opus2_type() > 0 ) drive_count++; + libspectrum_snap_set_opus_drive_count( snap, drive_count ); + + libspectrum_snap_set_opus_paged ( snap, opus_active ); + libspectrum_snap_set_opus_direction ( snap, opus_fdc->direction ); + libspectrum_snap_set_opus_status ( snap, opus_fdc->status_register ); + libspectrum_snap_set_opus_track ( snap, opus_fdc->track_register ); + libspectrum_snap_set_opus_sector ( snap, opus_fdc->sector_register ); + libspectrum_snap_set_opus_data ( snap, opus_fdc->data_register ); + libspectrum_snap_set_opus_data_reg_a( snap, data_reg_a ); + libspectrum_snap_set_opus_data_dir_a( snap, data_dir_a ); + libspectrum_snap_set_opus_control_a ( snap, control_a ); + libspectrum_snap_set_opus_data_reg_b( snap, data_reg_b ); + libspectrum_snap_set_opus_data_dir_b( snap, data_dir_b ); + libspectrum_snap_set_opus_control_b ( snap, control_b ); +} Copied: trunk/fuse/disk/opus.h (from rev 609, vendor/fuse-emulator/current/fuse/disk/opus.h) =================================================================== --- trunk/fuse/disk/opus.h (rev 0) +++ trunk/fuse/disk/opus.h 2009-08-02 10:35:36 UTC (rev 610) @@ -0,0 +1,65 @@ +/* opus.h: Routines for handling the Opus Discovery interface + Copyright (c) 2005-2009 Stuart Brady, Fredrick Meunier + + $Id: opus.h 4012 2009-04-16 12:42:14Z 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 + 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: + + Philip: phi...@sh... + + Stuart: sd...@nt... + +*/ + +#ifndef FUSE_OPUS_H +#define FUSE_OPUS_H + +#include <config.h> + +typedef enum opus_drive_number { + OPUS_DRIVE_1 = 0, + OPUS_DRIVE_2, +} opus_drive_number; + +#include <libspectrum.h> + +#include "periph.h" +#include "disk/fdd.h" + +extern int opus_available; /* Is the Opus available for use? */ +extern int opus_active; /* Opus enabled? */ + +int opus_init( void ); +void opus_end( void ); + +void opus_page( void ); +void opus_unpage( void ); + +libspectrum_byte opus_read( libspectrum_word address ); +void opus_write( libspectrum_word address, libspectrum_byte b ); + +libspectrum_byte opus_joy_read( libspectrum_word port, int *attached ); + +int opus_disk_insert( opus_drive_number which, const char *filename, + int autoload ); +int opus_disk_eject( opus_drive_number which, int write ); +int opus_disk_write( opus_drive_number which, const char *filename ); +int opus_disk_flip( opus_drive_number which, int flip ); +int opus_disk_writeprotect( opus_drive_number which, int wrprot ); +fdd_t *opus_get_fdd( opus_drive_number which ); + +#endif /* #ifndef FUSE_OPUS_H */ Modified: trunk/fuse/disk/plusd.c =================================================================== --- trunk/fuse/disk/plusd.c 2009-08-01 14:03:19 UTC (rev 609) +++ trunk/fuse/disk/plusd.c 2009-08-02 10:35:36 UTC (rev 610) @@ -2,7 +2,7 @@ Copyright (c) 1999-2007 Stuart Brady, Fredrick Meunier, Philip Kendall, Dmitry Sanarin, Darren Salt - $Id: plusd.c 4012 2009-04-16 12:42:14Z fredm $ + $Id: plusd.c 4060 2009-07-30 13:21:38Z 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 @@ -654,8 +654,13 @@ libspectrum_snap_plusd_ram( snap, 0 ), 0x2000 ); } - plusd_fdc->direction = libspectrum_snap_beta_direction( snap ); + /* ignore drive count for now, there will be an issue with loading snaps where + drives have been disabled + libspectrum_snap_plusd_drive_count( snap ) + */ + plusd_fdc->direction = libspectrum_snap_plusd_direction( snap ); + plusd_cr_write ( 0x00e3, libspectrum_snap_plusd_status ( snap ) ); plusd_tr_write ( 0x00eb, libspectrum_snap_plusd_track ( snap ) ); plusd_sec_write( 0x00f3, libspectrum_snap_plusd_sector ( snap ) ); @@ -673,6 +678,7 @@ pl... [truncated message content] |