[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [405] trunk
Brought to you by:
fredm
|
From: <fr...@us...> - 2007-06-29 12:55:32
|
Revision: 405
http://svn.sourceforge.net/fuse-for-macosx/?rev=405&view=rev
Author: fredm
Date: 2007-06-29 05:55:24 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
Merge up to vendor revision 3018.
Revision Links:
--------------
http://svn.sourceforge.net/fuse-for-macosx/?rev=3018&view=rev
Modified Paths:
--------------
trunk/FuseImporter/libspectrum.h
trunk/fuse/Makefile.am
trunk/fuse/ay.c
trunk/fuse/ay.h
trunk/fuse/configure.in
trunk/fuse/dck.c
trunk/fuse/divide.c
trunk/fuse/divide.h
trunk/fuse/event.c
trunk/fuse/event.h
trunk/fuse/fuse.cpp
trunk/fuse/fusepb/Credits.html
trunk/fuse/fusepb/English.lproj/InfoPlist.strings
trunk/fuse/fusepb/Fuse.xcodeproj/project.pbxproj
trunk/fuse/fusepb/Info-Fuse.plist
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/MainMenu.nib/classes.nib
trunk/fuse/fusepb/nibs/MainMenu.nib/info.nib
trunk/fuse/fusepb/nibs/MainMenu.nib/keyedobjects.nib
trunk/fuse/fusepb/nibs/Preferences.nib/info.nib
trunk/fuse/fusepb/nibs/Preferences.nib/keyedobjects.nib
trunk/fuse/fusepb/resources/Fuse Help/html/about.html
trunk/fuse/fusepb/resources/Fuse Help/html/compressed.html
trunk/fuse/fusepb/resources/Fuse Help/html/divide.html
trunk/fuse/fusepb/resources/Fuse Help/html/emulation.html
trunk/fuse/fusepb/resources/Fuse Help/html/filters.html
trunk/fuse/fusepb/resources/Fuse Help/html/mappings.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/printer.html
trunk/fuse/fusepb/resources/Fuse Help/html/spotlight.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/if1.c
trunk/fuse/if1.h
trunk/fuse/if2.c
trunk/fuse/if2.h
trunk/fuse/joystick.c
trunk/fuse/joystick.h
trunk/fuse/keysyms.pl
trunk/fuse/machine.c
trunk/fuse/machine.h
trunk/fuse/machines/pentagon.c
trunk/fuse/machines/scorpion.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/specplus2a.c
trunk/fuse/machines/specplus3.c
trunk/fuse/machines/specplus3.h
trunk/fuse/machines/specplus3e.c
trunk/fuse/machines/tc2048.c
trunk/fuse/machines/tc2068.c
trunk/fuse/machines/ts2068.c
trunk/fuse/man/fuse.1
trunk/fuse/memory.c
trunk/fuse/memory.h
trunk/fuse/menu.c
trunk/fuse/menu_data.dat
trunk/fuse/periph.c
trunk/fuse/periph.h
trunk/fuse/printer.c
trunk/fuse/printer.h
trunk/fuse/roms/Makefile.am
trunk/fuse/rzx.c
trunk/fuse/rzx.h
trunk/fuse/scld.c
trunk/fuse/scld.h
trunk/fuse/settings.dat
trunk/fuse/simpleide.c
trunk/fuse/simpleide.h
trunk/fuse/slt.c
trunk/fuse/slt.h
trunk/fuse/snapshot.c
trunk/fuse/sound/alsasound.c
trunk/fuse/spectrum.c
trunk/fuse/spectrum.h
trunk/fuse/tape.c
trunk/fuse/trdos.c
trunk/fuse/trdos.h
trunk/fuse/ui/cocoa/cocoadisplay.h
trunk/fuse/ui/cocoa/cocoadisplay.m
trunk/fuse/ui/cocoa/cocoaerror.m
trunk/fuse/ui/cocoa/cocoajoystick.c
trunk/fuse/ui/cocoa/cocoascreenshot.h
trunk/fuse/ui/cocoa/cocoascreenshot.m
trunk/fuse/ui/cocoa/cocoastatusbar.m
trunk/fuse/ui/cocoa/cocoaui.h
trunk/fuse/ui/cocoa/cocoaui.m
trunk/fuse/ui/cocoa/keysyms.m
trunk/fuse/ui/gtk/gtkui.c
trunk/fuse/ui/options.dat
trunk/fuse/ui/svga/svgadisplay.c
trunk/fuse/ui/svga/svgakeyboard.c
trunk/fuse/ui/ui.h
trunk/fuse/ui/win32/win32ui.c
trunk/fuse/ui/xlib/xdisplay.c
trunk/fuse/ui/xlib/xui.c
trunk/fuse/ui.c
trunk/fuse/ula.c
trunk/fuse/ula.h
trunk/fuse/utils.c
trunk/fuse/widget/error.c
trunk/fuse/widget/memory.c
trunk/fuse/widget/menu.c
trunk/fuse/widget/options.pl
trunk/fuse/widget/pokefinder.c
trunk/fuse/widget/widget.c
trunk/fuse/widget/widget_internals.h
trunk/fuse/z80/coretest.c
trunk/fuse/z80/z80.c
trunk/fuse/z80/z80.h
trunk/fuse/z80/z80.pl
trunk/fuse/z80/z80_macros.h
trunk/fuse/z80/z80_ops.c
trunk/fuse/zxatasp.c
trunk/fuse/zxatasp.h
trunk/fuse/zxcf.c
trunk/fuse/zxcf.h
trunk/libspectrum/libspectrum/hacking/ChangeLog
trunk/libspectrum/libspectrum/libspectrum.c
trunk/libspectrum/libspectrum/libspectrum.h.in
trunk/libspectrum/libspectrum.h
Added Paths:
-----------
trunk/fuse/disk/
trunk/fuse/disk/Makefile.am
trunk/fuse/disk/plusd.c
trunk/fuse/disk/plusd.h
trunk/fuse/disk/wd1770.c
trunk/fuse/disk/wd1770.h
trunk/fuse/fusepb/resources/Fuse Help/html/plusd.html
trunk/fuse/module.c
trunk/fuse/module.h
trunk/fuse/roms/plusd.rom
Removed Paths:
-------------
trunk/fuse/disk/Makefile.am
trunk/fuse/disk/plusd.c
trunk/fuse/disk/plusd.h
trunk/fuse/disk/wd1770.c
trunk/fuse/disk/wd1770.h
Modified: trunk/FuseImporter/libspectrum.h
===================================================================
--- trunk/FuseImporter/libspectrum.h 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/FuseImporter/libspectrum.h 2007-06-29 12:55:24 UTC (rev 405)
@@ -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,v 1.141 2007/02/02 16:35:42 pak21 Exp $
+ $Id: libspectrum.h.in 3008 2007-06-17 18:54:58Z zubzero $
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
@@ -274,10 +274,10 @@
/* Below here, present only in x.x.x and later */
LIBSPECTRUM_ID_TAPE_WAV, /* .wav tape image */
+ LIBSPECTRUM_ID_COMPRESSED_XFD, /* xfdmaster (Amiga) compressed file */
+ LIBSPECTRUM_ID_DISK_IMG, /* .img +D disk image */
+ LIBSPECTRUM_ID_DISK_MGT, /* .mgt +D disk image */
- /* Amiga entry for improved compressed file support */
- LIBSPECTRUM_ID_COMPRESSED_XFD, /* xfdmaster compressed file */
-
LIBSPECTRUM_ID_SCREEN_SCR, /* .scr screen file */
} libspectrum_id_t;
@@ -307,6 +307,10 @@
LIBSPECTRUM_CLASS_MICRODRIVE, /* Microdrive cartridges */
+ /* Below here, present only in x.x.x and later */
+
+ LIBSPECTRUM_CLASS_DISK_PLUSD, /* +D disk image */
+
LIBSPECTRUM_CLASS_SCREENSHOT, /* Screenshot */
} libspectrum_class_t;
Modified: trunk/fuse/Makefile.am
===================================================================
--- trunk/fuse/Makefile.am 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/Makefile.am 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
## Copyright (c) 1999-2004 Philip Kendall
-## $Id: Makefile.am 2920 2007-06-02 02:06:05Z fredm $
+## $Id: Makefile.am 3007 2007-06-17 18:50:48Z zubzero $
## 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
@@ -27,6 +27,7 @@
SUBDIRS = compat \
debugger \
+ @DISK@ \
hacking \
lib \
machines \
@@ -41,6 +42,7 @@
DIST_SUBDIRS = compat \
debugger \
+ disk \
hacking \
lib \
machines \
@@ -70,6 +72,7 @@
machine.c \
memory.c \
menu.c \
+ module.c \
periph.c \
printer.c \
profile.c \
@@ -98,6 +101,7 @@
fuse_LDADD = debugger/libdebugger.a \
@UI_LIBS@ \
+@DISK_LIBS@ \
machines/libmachines.a \
pokefinder/libpokefinder.a \
sound/libsound.a \
@@ -119,11 +123,12 @@
@WINDRES_OBJ@
fuse_DEPENDENCIES = @UI_LIBS@ \
+ @DISK_LIBS@ \
debugger/libdebugger.a \
machines/libmachines.a \
sound/libsound.a \
- z80/libz80.a \
- @WINDRES_OBJ@
+ z80/libz80.a \
+ @WINDRES_OBJ@
BUILT_SOURCES = settings.c settings.h
@@ -156,6 +161,7 @@
machine.h \
memory.h \
menu.h \
+ module.h \
periph.h \
psg.h \
rzx.h \
Modified: trunk/fuse/ay.c
===================================================================
--- trunk/fuse/ay.c 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/ay.c 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,7 +1,7 @@
/* ay.c: AY-8-3912 routines
Copyright (c) 1999-2004 Philip Kendall
- $Id: ay.c 2889 2007-05-26 17:45:08Z zubzero $
+ $Id: ay.c 2993 2007-06-17 13:54:49Z pak21 $
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
@@ -27,6 +27,7 @@
#include "compat.h"
#include "machine.h"
+#include "module.h"
#include "printer.h"
#include "psg.h"
#include "sound.h"
@@ -40,6 +41,26 @@
};
+static void ay_from_snapshot( libspectrum_snap *snap );
+static void ay_to_snapshot( libspectrum_snap *snap );
+
+static module_info_t ay_module_info = {
+
+ NULL,
+ NULL,
+ ay_from_snapshot,
+ ay_to_snapshot,
+
+};
+
+int
+ay_init( void )
+{
+ module_register( &ay_module_info );
+
+ return 0;
+}
+
/* What happens when the AY register port (traditionally 0xfffd on the 128K
machines) is read from */
libspectrum_byte
@@ -97,12 +118,12 @@
if( current == 14 ) printer_serial_write( b );
}
-int
-ay_from_snapshot( libspectrum_snap *snap, int capabilities )
+static void
+ay_from_snapshot( libspectrum_snap *snap )
{
size_t i;
- if( capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_AY ) {
+ if( machine_current->capabilities & LIBSPECTRUM_MACHINE_CAPABILITY_AY ) {
ay_registerport_write( 0xfffd,
libspectrum_snap_out_ay_registerport( snap ) );
@@ -114,11 +135,9 @@
}
}
-
- return 0;
}
-int
+static void
ay_to_snapshot( libspectrum_snap *snap )
{
size_t i;
@@ -130,6 +149,4 @@
for( i = 0; i < AY_REGISTERS; i++ )
libspectrum_snap_set_ay_registers( snap, i,
machine_current->ay.registers[i] );
-
- return 0;
}
Modified: trunk/fuse/ay.h
===================================================================
--- trunk/fuse/ay.h 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/ay.h 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,7 +1,7 @@
/* ay.h: AY-8-3912 routines
Copyright (c) 1999-2004 Philip Kendall
- $Id: ay.h 2889 2007-05-26 17:45:08Z zubzero $
+ $Id: ay.h 2993 2007-06-17 13:54:49Z pak21 $
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
@@ -35,12 +35,11 @@
libspectrum_byte registers[ AY_REGISTERS ];
} ayinfo;
+int ay_init( void );
+
libspectrum_byte ay_registerport_read( libspectrum_word port, int *attached );
void ay_registerport_write( libspectrum_word port, libspectrum_byte b );
void ay_dataport_write( libspectrum_word port, libspectrum_byte b );
-int ay_from_snapshot( libspectrum_snap *snap, int capabilities );
-int ay_to_snapshot( libspectrum_snap *snap );
-
#endif /* #ifndef FUSE_AY_H */
Modified: trunk/fuse/configure.in
===================================================================
--- trunk/fuse/configure.in 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/configure.in 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-dnl $Id: configure.in,v 1.155 2007/02/02 16:21:50 pak21 Exp $
+dnl $Id: configure.in 3007 2007-06-17 18:50:48Z zubzero $
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
@@ -358,6 +358,14 @@
lib/tape_se.szx
lib/tape_ts2068.szx])
+dnl LibDsk/lib765 prefix
+AC_ARG_WITH(disk-prefix,
+[ --with-disk-prefix=PFX where the LibDsk and/or lib765 libraries are installed (optional)],
+DSK_CFLAGS=-I$withval/include; DSKLIBS=-L$withval/lib,
+DSK_CFLAGS=""; DSK_LIBS="")
+ac_save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $DSK_CFLAGS"
+
dnl Do we want +3 disk support?
AC_MSG_CHECKING(whether +3 disk support requested)
AC_ARG_WITH(plus3-disk,
@@ -366,21 +374,27 @@
plus3disk=yes)
AC_MSG_RESULT($plus3disk)
if test "$plus3disk" = yes; then
- AC_ARG_WITH(plus3-disk-prefix,
- [ --with-plus3-disk-prefix=PFX where the +3 libraries are installed (optional)],
- DSK_CFLAGS=-I$withval/include; DSKLIBS=-L$withval/lib,
- DSK_CFLAGS=""; DSK_LIBS="")
- ac_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $DSK_CFLAGS"
AC_CHECK_HEADERS(765.h, DSKLIBS="$DSKLIBS -l765"; lib765=yes,
- AC_MSG_WARN(765.h not found - disk support disabled))
- if test "$lib765" = yes; then
- AC_CHECK_HEADERS(libdsk.h, DSKLIBS="$DSKLIBS -ldsk")
- fi
- CPPFLAGS="$ac_save_CPPFLAGS"
+ AC_MSG_WARN(765.h not found - +3 disk support disabled))
fi
+
+dnl Do we want LibDsk support?
+AC_ARG_WITH(libdsk,
+ [ --without-libdsk disable LibDsk support],
+ if test "$withval" = no; then libdsk=no; else libdsk=yes; fi,
+ libdsk=yes)
+AC_MSG_RESULT($libdsk)
+if test "$libdsk" = yes; then
+ AC_CHECK_HEADERS(libdsk.h, DSKLIBS="$DSKLIBS -ldsk";
+ DISK_LIBS="disk/libdisk.a"; DISK="disk",
+ AC_MSG_WARN(libdsk.h not found - LibDsk support disabled))
+fi
+
+CPPFLAGS="$ac_save_CPPFLAGS"
AC_SUBST(DSK_CFLAGS)
AC_SUBST(DSKLIBS)
+AC_SUBST(DISK_LIBS)
+AC_SUBST(DISK)
dnl Check if a version of libpng which supplies png_write_png is available
AC_CHECK_LIB( png, png_write_png,
@@ -568,6 +582,7 @@
AC_OUTPUT(Makefile \
compat/Makefile \
debugger/Makefile \
+disk/Makefile \
hacking/Makefile \
lib/Makefile \
machines/Makefile \
Modified: trunk/fuse/dck.c
===================================================================
--- trunk/fuse/dck.c 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/dck.c 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,7 +1,7 @@
/* dck.c: dock snapshot (Warajevo .DCK) handling routines
Copyright (c) 2003-2004 Darren Salt, Fredrick Meunier, Philip Kendall
- $Id: dck.c 2889 2007-05-26 17:45:08Z zubzero $
+ $Id: dck.c 2995 2007-06-17 14:31:36Z pak21 $
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
@@ -61,7 +61,7 @@
error = settings_set_string( &settings_current.dck_file, filename );
if( error ) return error;
- machine_reset();
+ machine_reset( 0 );
return 0;
}
@@ -82,7 +82,7 @@
ui_menu_activate( UI_MENU_ITEM_MEDIA_CARTRIDGE_DOCK_EJECT, 0 );
- machine_reset();
+ machine_reset( 0 );
}
int
Copied: trunk/fuse/disk (from rev 404, vendor/fuse-emulator/current/fuse/disk)
Deleted: trunk/fuse/disk/Makefile.am
===================================================================
--- vendor/fuse-emulator/current/fuse/disk/Makefile.am 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/disk/Makefile.am 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,34 +0,0 @@
-## Process this file with automake to produce Makefile.in
-## Copyright (c) 2007 Stuart Brady
-
-## $Id: Makefile.am 2889 2007-05-26 17:45:08Z zubzero $
-
-## 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...
-
-AUTOMAKE_OPTIONS = foreign
-
-noinst_LIBRARIES = libdisk.a
-
-INCLUDES = @LIBSPEC_CFLAGS@ @GTK_CFLAGS@ @GLIB_CFLAGS@
-
-libdisk_a_SOURCES = plusd.c \
- wd1770.c
-
-noinst_HEADERS = plusd.h \
- wd1770.h
Copied: trunk/fuse/disk/Makefile.am (from rev 404, vendor/fuse-emulator/current/fuse/disk/Makefile.am)
===================================================================
--- trunk/fuse/disk/Makefile.am (rev 0)
+++ trunk/fuse/disk/Makefile.am 2007-06-29 12:55:24 UTC (rev 405)
@@ -0,0 +1,34 @@
+## Process this file with automake to produce Makefile.in
+## Copyright (c) 2007 Stuart Brady
+
+## $Id: Makefile.am 2889 2007-05-26 17:45:08Z zubzero $
+
+## 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...
+
+AUTOMAKE_OPTIONS = foreign
+
+noinst_LIBRARIES = libdisk.a
+
+INCLUDES = @LIBSPEC_CFLAGS@ @GTK_CFLAGS@ @GLIB_CFLAGS@
+
+libdisk_a_SOURCES = plusd.c \
+ wd1770.c
+
+noinst_HEADERS = plusd.h \
+ wd1770.h
Deleted: trunk/fuse/disk/plusd.c
===================================================================
--- vendor/fuse-emulator/current/fuse/disk/plusd.c 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/disk/plusd.c 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,571 +0,0 @@
-/* plusd.c: Routines for handling the +D interface
- Copyright (c) 1999-2007 Stuart Brady, Fredrick Meunier, Philip Kendall,
- Dmitry Sanarin, Darren Salt
-
- $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:
-
- Philip: phi...@sh...
-
- Stuart: sd...@nt...
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h> /* Needed for strncasecmp() on QNX6 */
-#endif /* #ifdef HAVE_STRINGS_H */
-#include <limits.h>
-#include <sys/stat.h>
-
-#include <libdsk.h>
-
-#include <libspectrum.h>
-
-#include "compat.h"
-#include "event.h"
-#include "machine.h"
-#include "module.h"
-#include "plusd.h"
-#include "printer.h"
-#include "settings.h"
-#include "ui/ui.h"
-#include "utils.h"
-#include "wd1770.h"
-#include "z80/z80.h"
-
-int plusd_available = 0;
-int plusd_active = 0;
-int plusd_index_pulse = 0;
-
-wd1770_fdc plusd_fdc;
-wd1770_drive plusd_drives[ PLUSD_NUM_DRIVES ];
-
-static const char *plusd_template = "fuse.plusd.XXXXXX";
-
-static void plusd_reset( int hard_reset );
-static void plusd_memory_map( void );
-static void plusd_from_snapshot( libspectrum_snap *snap );
-static void plusd_to_snapshot( libspectrum_snap *snap );
-
-static module_info_t plusd_module_info = {
-
- plusd_reset,
- plusd_memory_map,
- plusd_from_snapshot,
- plusd_to_snapshot,
-
-};
-
-void
-plusd_page( void )
-{
- plusd_active = 1;
- machine_current->ram.romcs = 1;
- machine_current->memory_map();
-}
-
-void
-plusd_unpage( void )
-{
- plusd_active = 0;
- machine_current->ram.romcs = 0;
- machine_current->memory_map();
-}
-
-static void
-plusd_memory_map( void )
-{
- if( !plusd_active ) return;
-
- memory_map_read[ 0 ] = memory_map_write[ 0 ] = memory_map_romcs[ 0 ];
- memory_map_read[ 1 ] = memory_map_write[ 1 ] = memory_map_ram[ 16 * 2 ];
-}
-
-void
-plusd_set_cmdint( wd1770_fdc *f )
-{
- z80_interrupt();
-}
-
-const periph_t plusd_peripherals[] = {
- /* ---- ---- 1110 0011 */
- { 0x00ff, 0x00e3, plusd_sr_read, plusd_cr_write },
- /* ---- ---- 1110 1011 */
- { 0x00ff, 0x00eb, plusd_tr_read, plusd_tr_write },
- /* ---- ---- 1111 0011 */
- { 0x00ff, 0x00f3, plusd_sec_read, plusd_sec_write },
- /* ---- ---- 1111 1011 */
- { 0x00ff, 0x00fb, plusd_dr_read, plusd_dr_write },
-
- /* ---- ---- 1110 1111 */
- { 0x00ff, 0x00ef, NULL, plusd_cn_write },
- /* ---- ---- 1110 0111 */
- { 0x00ff, 0x00e7, plusd_mem_read, plusd_mem_write },
- /* 0000 0000 1111 0111 */
- { 0x00ff, 0x00f7, plusd_printer_read, printer_parallel_write },
-};
-
-const size_t plusd_peripherals_count =
- sizeof( plusd_peripherals ) / sizeof( periph_t );
-
-int
-plusd_init( void )
-{
- int i;
- wd1770_drive *d;
-
- plusd_fdc.current_drive = &plusd_drives[ 0 ];
-
- for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
- d = &plusd_drives[ i ];
-
- d->disk = NULL;
- d->filename[0] = '\0';
- }
-
- plusd_fdc.set_cmdint = &plusd_set_cmdint;
- plusd_fdc.reset_cmdint = NULL;
- plusd_fdc.set_datarq = NULL;
- plusd_fdc.reset_datarq = NULL;
- plusd_fdc.iface = NULL;
-
- plusd_fdc.rates[ 0 ] = 6;
- plusd_fdc.rates[ 1 ] = 12;
- plusd_fdc.rates[ 2 ] = 2;
- plusd_fdc.rates[ 3 ] = 3;
-
- module_register( &plusd_module_info );
-
- return 0;
-}
-
-static void
-plusd_reset( int hard_reset )
-{
- int i;
- wd1770_drive *d;
- wd1770_fdc *f = &plusd_fdc;
-
- plusd_available = 0;
-
- if( !periph_plusd_active )
- return;
-
- machine_load_rom_bank( memory_map_romcs, 0, 0,
- settings_default.rom_plusd,
- settings_current.rom_plusd, 0x2000 );
-
- memory_map_romcs[0].source = MEMORY_SOURCE_PERIPHERAL;
-
- machine_current->ram.romcs = 0;
-
- memory_map_romcs[ 0 ].writable = 0;
- memory_map_romcs[ 1 ].writable = 0;
- memory_map_ram[ 16 * 2 ].writable = 1;
-
- plusd_available = 1;
- plusd_active = 0;
- plusd_index_pulse = 0;
-
- if( hard_reset ) {
- for( i = 0; i < 8192; i++ ) {
- memory_map_ram[ 16 * 2 ].page[ i ] = 0;
- }
- }
-
- f->spin_cycles = 0;
- f->direction = 0;
-
- f->state = wd1770_state_none;
- f->status_type = wd1770_status_type1;
-
- f->status_register = 0;
- f->track_register = 0;
- f->sector_register = 0;
- f->data_register = 0;
-
- for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
- d = &plusd_drives[ i ];
-
- d->index_pulse = 0;
- d->index_interrupt = 0;
- d->track = 0;
- d->side = 0;
- }
-
- f->status_register |= WD1770_SR_LOST; /* track 0 */
-
- /* We can eject disks only if they are currently present */
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT,
- !!plusd_drives[ PLUSD_DRIVE_1 ].disk );
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT,
- !!plusd_drives[ PLUSD_DRIVE_2 ].disk );
-
- plusd_fdc.current_drive = &plusd_drives[ 0 ];
- machine_current->memory_map();
- plusd_event_index( 0 );
-
- ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
-}
-
-void
-plusd_end( void )
-{
- plusd_available = 0;
-}
-
-libspectrum_byte
-plusd_sr_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- *attached = 1;
- return wd1770_sr_read( &plusd_fdc );
-}
-
-void
-plusd_cr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- wd1770_cr_write( &plusd_fdc, b );
-}
-
-libspectrum_byte
-plusd_tr_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- *attached = 1;
- return wd1770_tr_read( &plusd_fdc );
-}
-
-void
-plusd_tr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- wd1770_tr_write( &plusd_fdc, b );
-}
-
-libspectrum_byte
-plusd_sec_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- *attached = 1;
- return wd1770_sec_read( &plusd_fdc );
-}
-
-void
-plusd_sec_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- wd1770_sec_write( &plusd_fdc, b );
-}
-
-libspectrum_byte
-plusd_dr_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- *attached = 1;
- return wd1770_dr_read( &plusd_fdc );
-}
-
-void
-plusd_dr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- wd1770_dr_write( &plusd_fdc, b );
-}
-
-void
-plusd_cn_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- int drive, side;
- int i;
-
- drive = ( b & 0x03 ) == 2 ? 1 : 0;
- side = ( b & 0x80 ) ? 1 : 0;
-
- /* TODO: set current_drive to NULL when bits 0 and 1 of b are '00' or '11' */
- plusd_fdc.current_drive = &plusd_drives[ drive ];
-
- for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
- plusd_drives[ i ].side = side;
- }
-
- printer_parallel_strobe_write( b & 0x40 );
-}
-
-libspectrum_byte
-plusd_mem_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- plusd_page();
- return 0;
-}
-
-void
-plusd_mem_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
-{
- plusd_unpage();
-}
-
-libspectrum_byte
-plusd_printer_read( libspectrum_word port GCC_UNUSED, int *attached )
-{
- *attached = 1;
-
- /* bit 7 = busy. other bits high? */
-
- if(!settings_current.printer)
- return(0xff); /* no printer attached */
-
- return(0x7f); /* never busy */
-}
-
-int
-plusd_disk_insert_default_autoload( plusd_drive_number which,
- const char *filename )
-{
- return plusd_disk_insert( which, filename, settings_current.auto_load );
-}
-
-int
-plusd_disk_insert( plusd_drive_number which, const char *filename,
- int autoload )
-{
- int fd, error;
- char tempfilename[ PATH_MAX ];
- int israw = 0;
- dsk_format_t fmt;
- wd1770_drive *d;
- int l;
-
- if( which >= PLUSD_NUM_DRIVES ) {
- ui_error( UI_ERROR_ERROR, "plusd_disk_insert: unknown drive %d",
- which );
- fuse_abort();
- }
-
- d = &plusd_drives[ which ];
-
- /* Eject any disk already in the drive */
- if( d->disk ) {
- /* Abort the insert if we want to keep the current disk */
- if( plusd_disk_eject( which, 0 ) ) return 0;
- }
-
- /* Make a temporary copy of the disk file */
- error = utils_make_temp_file( &fd, tempfilename, filename, plusd_template );
- if( error ) return error;
- strcpy( d->filename, tempfilename );
-
- /* Determine the disk image format */
- l = strlen( filename );
- if( l >= 5 ) {
- if( !strcmp( filename + ( l - 4 ), ".dsk" ) ||
- !strcmp( filename + ( l - 4 ), ".mgt" ) ) {
- israw = 1;
- fmt = FMT_800K;
- } else if( !strcmp( filename + ( l - 4 ), ".img" ) ) {
- israw = 1;
- fmt = FMT_MGT800;
- }
- }
-
- /* And now insert the disk */
- if( israw ) {
-
- /* If the "logical" driver is not available, try the "raw" driver (unless
- * we're using FMT_MGT800, for which the raw driver will not work */
- if( dsk_open( &d->disk, tempfilename, "logical", NULL ) != DSK_ERR_OK &&
- ( fmt == FMT_MGT800 ||
- dsk_open( &d->disk, tempfilename, "raw", NULL ) != DSK_ERR_OK ) ) {
- ui_error( UI_ERROR_ERROR, "Failed to open disk image" );
- return 1;
- }
-
- if( dg_stdformat( &d->geom, fmt, NULL, NULL ) != DSK_ERR_OK ) {
- ui_error( UI_ERROR_ERROR, "Failed to set geometry for disk" );
- dsk_close( &d->disk );
- return 1;
- }
-
- } else {
-
- if( dsk_open( &d->disk, tempfilename, NULL, NULL ) != DSK_ERR_OK ) {
- ui_error( UI_ERROR_ERROR, "Failed to open disk image" );
- return 1;
- }
-
- if( dsk_getgeom( d->disk, &d->geom ) != DSK_ERR_OK ) {
- ui_error( UI_ERROR_ERROR, "Failed to determine geometry for disk" );
- dsk_close( &d->disk );
- return 1;
- }
-
- }
-
- /* Set the 'eject' item active */
- switch( which ) {
- case PLUSD_DRIVE_1:
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT, 1 );
- break;
- case PLUSD_DRIVE_2:
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT, 1 );
- break;
- }
-
- if( autoload ) {
- /* XXX */
- }
-
- return 0;
-}
-
-int
-plusd_disk_eject( plusd_drive_number which, int write )
-{
- wd1770_drive *d;
-
- if( which >= PLUSD_NUM_DRIVES )
- return 1;
-
- d = &plusd_drives[ which ];
-
- if( !d->disk )
- return 0;
-
- if( write ) {
-
- if( ui_plusd_disk_write( which ) ) return 1;
-
- } else {
-
- if( dsk_dirty( plusd_drives[which].disk ) ) {
-
- ui_confirm_save_t confirm = ui_confirm_save(
- "Disk has been modified.\nDo you want to save it?"
- );
-
- switch( confirm ) {
-
- case UI_CONFIRM_SAVE_SAVE:
- if( ui_plusd_disk_write( which ) ) return 1;
- break;
-
- case UI_CONFIRM_SAVE_DONTSAVE: break;
- case UI_CONFIRM_SAVE_CANCEL: return 1;
-
- }
- }
- }
-
- dsk_close( &d->disk );
- unlink( d->filename );
-
- /* Set the 'eject' item inactive */
- switch( which ) {
- case PLUSD_DRIVE_1:
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT, 0 );
- break;
- case PLUSD_DRIVE_2:
- ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT, 0 );
- break;
- }
- return 0;
-}
-
-int
-plusd_disk_write( plusd_drive_number which, const char *filename )
-{
- wd1770_drive *d = &plusd_drives[ which ];
- utils_file file;
- FILE *f;
- int error;
- size_t bytes_written;
-
- dsk_close( &d->disk );
-
- f = fopen( filename, "wb" );
- if( !f ) {
- ui_error( UI_ERROR_ERROR, "couldn't open '%s' for writing: %s", filename,
- strerror( errno ) );
- }
-
- error = utils_read_file( d->filename, &file );
- if( error ) { fclose( f ); return error; }
-
- bytes_written = fwrite( file.buffer, 1, file.length, f );
- if( bytes_written != file.length ) {
- ui_error( UI_ERROR_ERROR, "could write only %lu of %lu bytes to '%s'",
- (unsigned long)bytes_written, (unsigned long)file.length,
- filename );
- utils_close_file( &file ); fclose( f );
- }
-
- error = utils_close_file( &file ); if( error ) { fclose( f ); return error; }
-
- if( fclose( f ) ) {
- ui_error( UI_ERROR_ERROR, "error closing '%s': %s", filename,
- strerror( errno ) );
- return 1;
- }
-
- return 0;
-}
-
-int
-plusd_event_cmd_done( libspectrum_dword last_tstates )
-{
- plusd_fdc.status_register &= ~WD1770_SR_BUSY;
- return 0;
-}
-
-int
-plusd_event_index( libspectrum_dword last_tstates )
-{
- int error;
- int next_tstates;
- int i;
-
- plusd_index_pulse = !plusd_index_pulse;
- for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
- wd1770_drive *d = &plusd_drives[ i ];
-
- d->index_pulse = plusd_index_pulse;
- if( !plusd_index_pulse && d->index_interrupt ) {
- wd1770_set_cmdint( &plusd_fdc );
- d->index_interrupt = 0;
- }
- }
- next_tstates = ( plusd_index_pulse ? 10 : 190 ) *
- machine_current->timings.processor_speed / 1000;
- error = event_add( last_tstates + next_tstates, EVENT_TYPE_PLUSD_INDEX );
- if( error )
- return error;
- return 0;
-}
-
-static void
-plusd_from_snapshot( libspectrum_snap *snap )
-{
- /* XXX */
-}
-
-static void
-plusd_to_snapshot( libspectrum_snap *snap )
-{
- /* XXX */
-}
Copied: trunk/fuse/disk/plusd.c (from rev 404, vendor/fuse-emulator/current/fuse/disk/plusd.c)
===================================================================
--- trunk/fuse/disk/plusd.c (rev 0)
+++ trunk/fuse/disk/plusd.c 2007-06-29 12:55:24 UTC (rev 405)
@@ -0,0 +1,571 @@
+/* plusd.c: Routines for handling the +D interface
+ Copyright (c) 1999-2007 Stuart Brady, Fredrick Meunier, Philip Kendall,
+ Dmitry Sanarin, Darren Salt
+
+ $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:
+
+ Philip: phi...@sh...
+
+ Stuart: sd...@nt...
+
+*/
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h> /* Needed for strncasecmp() on QNX6 */
+#endif /* #ifdef HAVE_STRINGS_H */
+#include <limits.h>
+#include <sys/stat.h>
+
+#include <libdsk.h>
+
+#include <libspectrum.h>
+
+#include "compat.h"
+#include "event.h"
+#include "machine.h"
+#include "module.h"
+#include "plusd.h"
+#include "printer.h"
+#include "settings.h"
+#include "ui/ui.h"
+#include "utils.h"
+#include "wd1770.h"
+#include "z80/z80.h"
+
+int plusd_available = 0;
+int plusd_active = 0;
+int plusd_index_pulse = 0;
+
+wd1770_fdc plusd_fdc;
+wd1770_drive plusd_drives[ PLUSD_NUM_DRIVES ];
+
+static const char *plusd_template = "fuse.plusd.XXXXXX";
+
+static void plusd_reset( int hard_reset );
+static void plusd_memory_map( void );
+static void plusd_from_snapshot( libspectrum_snap *snap );
+static void plusd_to_snapshot( libspectrum_snap *snap );
+
+static module_info_t plusd_module_info = {
+
+ plusd_reset,
+ plusd_memory_map,
+ plusd_from_snapshot,
+ plusd_to_snapshot,
+
+};
+
+void
+plusd_page( void )
+{
+ plusd_active = 1;
+ machine_current->ram.romcs = 1;
+ machine_current->memory_map();
+}
+
+void
+plusd_unpage( void )
+{
+ plusd_active = 0;
+ machine_current->ram.romcs = 0;
+ machine_current->memory_map();
+}
+
+static void
+plusd_memory_map( void )
+{
+ if( !plusd_active ) return;
+
+ memory_map_read[ 0 ] = memory_map_write[ 0 ] = memory_map_romcs[ 0 ];
+ memory_map_read[ 1 ] = memory_map_write[ 1 ] = memory_map_ram[ 16 * 2 ];
+}
+
+void
+plusd_set_cmdint( wd1770_fdc *f )
+{
+ z80_interrupt();
+}
+
+const periph_t plusd_peripherals[] = {
+ /* ---- ---- 1110 0011 */
+ { 0x00ff, 0x00e3, plusd_sr_read, plusd_cr_write },
+ /* ---- ---- 1110 1011 */
+ { 0x00ff, 0x00eb, plusd_tr_read, plusd_tr_write },
+ /* ---- ---- 1111 0011 */
+ { 0x00ff, 0x00f3, plusd_sec_read, plusd_sec_write },
+ /* ---- ---- 1111 1011 */
+ { 0x00ff, 0x00fb, plusd_dr_read, plusd_dr_write },
+
+ /* ---- ---- 1110 1111 */
+ { 0x00ff, 0x00ef, NULL, plusd_cn_write },
+ /* ---- ---- 1110 0111 */
+ { 0x00ff, 0x00e7, plusd_mem_read, plusd_mem_write },
+ /* 0000 0000 1111 0111 */
+ { 0x00ff, 0x00f7, plusd_printer_read, printer_parallel_write },
+};
+
+const size_t plusd_peripherals_count =
+ sizeof( plusd_peripherals ) / sizeof( periph_t );
+
+int
+plusd_init( void )
+{
+ int i;
+ wd1770_drive *d;
+
+ plusd_fdc.current_drive = &plusd_drives[ 0 ];
+
+ for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
+ d = &plusd_drives[ i ];
+
+ d->disk = NULL;
+ d->filename[0] = '\0';
+ }
+
+ plusd_fdc.set_cmdint = &plusd_set_cmdint;
+ plusd_fdc.reset_cmdint = NULL;
+ plusd_fdc.set_datarq = NULL;
+ plusd_fdc.reset_datarq = NULL;
+ plusd_fdc.iface = NULL;
+
+ plusd_fdc.rates[ 0 ] = 6;
+ plusd_fdc.rates[ 1 ] = 12;
+ plusd_fdc.rates[ 2 ] = 2;
+ plusd_fdc.rates[ 3 ] = 3;
+
+ module_register( &plusd_module_info );
+
+ return 0;
+}
+
+static void
+plusd_reset( int hard_reset )
+{
+ int i;
+ wd1770_drive *d;
+ wd1770_fdc *f = &plusd_fdc;
+
+ plusd_available = 0;
+
+ if( !periph_plusd_active )
+ return;
+
+ machine_load_rom_bank( memory_map_romcs, 0, 0,
+ settings_default.rom_plusd,
+ settings_current.rom_plusd, 0x2000 );
+
+ memory_map_romcs[0].source = MEMORY_SOURCE_PERIPHERAL;
+
+ machine_current->ram.romcs = 0;
+
+ memory_map_romcs[ 0 ].writable = 0;
+ memory_map_romcs[ 1 ].writable = 0;
+ memory_map_ram[ 16 * 2 ].writable = 1;
+
+ plusd_available = 1;
+ plusd_active = 0;
+ plusd_index_pulse = 0;
+
+ if( hard_reset ) {
+ for( i = 0; i < 8192; i++ ) {
+ memory_map_ram[ 16 * 2 ].page[ i ] = 0;
+ }
+ }
+
+ f->spin_cycles = 0;
+ f->direction = 0;
+
+ f->state = wd1770_state_none;
+ f->status_type = wd1770_status_type1;
+
+ f->status_register = 0;
+ f->track_register = 0;
+ f->sector_register = 0;
+ f->data_register = 0;
+
+ for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
+ d = &plusd_drives[ i ];
+
+ d->index_pulse = 0;
+ d->index_interrupt = 0;
+ d->track = 0;
+ d->side = 0;
+ }
+
+ f->status_register |= WD1770_SR_LOST; /* track 0 */
+
+ /* We can eject disks only if they are currently present */
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT,
+ !!plusd_drives[ PLUSD_DRIVE_1 ].disk );
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT,
+ !!plusd_drives[ PLUSD_DRIVE_2 ].disk );
+
+ plusd_fdc.current_drive = &plusd_drives[ 0 ];
+ machine_current->memory_map();
+ plusd_event_index( 0 );
+
+ ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
+}
+
+void
+plusd_end( void )
+{
+ plusd_available = 0;
+}
+
+libspectrum_byte
+plusd_sr_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ *attached = 1;
+ return wd1770_sr_read( &plusd_fdc );
+}
+
+void
+plusd_cr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ wd1770_cr_write( &plusd_fdc, b );
+}
+
+libspectrum_byte
+plusd_tr_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ *attached = 1;
+ return wd1770_tr_read( &plusd_fdc );
+}
+
+void
+plusd_tr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ wd1770_tr_write( &plusd_fdc, b );
+}
+
+libspectrum_byte
+plusd_sec_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ *attached = 1;
+ return wd1770_sec_read( &plusd_fdc );
+}
+
+void
+plusd_sec_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ wd1770_sec_write( &plusd_fdc, b );
+}
+
+libspectrum_byte
+plusd_dr_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ *attached = 1;
+ return wd1770_dr_read( &plusd_fdc );
+}
+
+void
+plusd_dr_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ wd1770_dr_write( &plusd_fdc, b );
+}
+
+void
+plusd_cn_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ int drive, side;
+ int i;
+
+ drive = ( b & 0x03 ) == 2 ? 1 : 0;
+ side = ( b & 0x80 ) ? 1 : 0;
+
+ /* TODO: set current_drive to NULL when bits 0 and 1 of b are '00' or '11' */
+ plusd_fdc.current_drive = &plusd_drives[ drive ];
+
+ for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
+ plusd_drives[ i ].side = side;
+ }
+
+ printer_parallel_strobe_write( b & 0x40 );
+}
+
+libspectrum_byte
+plusd_mem_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ plusd_page();
+ return 0;
+}
+
+void
+plusd_mem_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b )
+{
+ plusd_unpage();
+}
+
+libspectrum_byte
+plusd_printer_read( libspectrum_word port GCC_UNUSED, int *attached )
+{
+ *attached = 1;
+
+ /* bit 7 = busy. other bits high? */
+
+ if(!settings_current.printer)
+ return(0xff); /* no printer attached */
+
+ return(0x7f); /* never busy */
+}
+
+int
+plusd_disk_insert_default_autoload( plusd_drive_number which,
+ const char *filename )
+{
+ return plusd_disk_insert( which, filename, settings_current.auto_load );
+}
+
+int
+plusd_disk_insert( plusd_drive_number which, const char *filename,
+ int autoload )
+{
+ int fd, error;
+ char tempfilename[ PATH_MAX ];
+ int israw = 0;
+ dsk_format_t fmt;
+ wd1770_drive *d;
+ int l;
+
+ if( which >= PLUSD_NUM_DRIVES ) {
+ ui_error( UI_ERROR_ERROR, "plusd_disk_insert: unknown drive %d",
+ which );
+ fuse_abort();
+ }
+
+ d = &plusd_drives[ which ];
+
+ /* Eject any disk already in the drive */
+ if( d->disk ) {
+ /* Abort the insert if we want to keep the current disk */
+ if( plusd_disk_eject( which, 0 ) ) return 0;
+ }
+
+ /* Make a temporary copy of the disk file */
+ error = utils_make_temp_file( &fd, tempfilename, filename, plusd_template );
+ if( error ) return error;
+ strcpy( d->filename, tempfilename );
+
+ /* Determine the disk image format */
+ l = strlen( filename );
+ if( l >= 5 ) {
+ if( !strcmp( filename + ( l - 4 ), ".dsk" ) ||
+ !strcmp( filename + ( l - 4 ), ".mgt" ) ) {
+ israw = 1;
+ fmt = FMT_800K;
+ } else if( !strcmp( filename + ( l - 4 ), ".img" ) ) {
+ israw = 1;
+ fmt = FMT_MGT800;
+ }
+ }
+
+ /* And now insert the disk */
+ if( israw ) {
+
+ /* If the "logical" driver is not available, try the "raw" driver (unless
+ * we're using FMT_MGT800, for which the raw driver will not work */
+ if( dsk_open( &d->disk, tempfilename, "logical", NULL ) != DSK_ERR_OK &&
+ ( fmt == FMT_MGT800 ||
+ dsk_open( &d->disk, tempfilename, "raw", NULL ) != DSK_ERR_OK ) ) {
+ ui_error( UI_ERROR_ERROR, "Failed to open disk image" );
+ return 1;
+ }
+
+ if( dg_stdformat( &d->geom, fmt, NULL, NULL ) != DSK_ERR_OK ) {
+ ui_error( UI_ERROR_ERROR, "Failed to set geometry for disk" );
+ dsk_close( &d->disk );
+ return 1;
+ }
+
+ } else {
+
+ if( dsk_open( &d->disk, tempfilename, NULL, NULL ) != DSK_ERR_OK ) {
+ ui_error( UI_ERROR_ERROR, "Failed to open disk image" );
+ return 1;
+ }
+
+ if( dsk_getgeom( d->disk, &d->geom ) != DSK_ERR_OK ) {
+ ui_error( UI_ERROR_ERROR, "Failed to determine geometry for disk" );
+ dsk_close( &d->disk );
+ return 1;
+ }
+
+ }
+
+ /* Set the 'eject' item active */
+ switch( which ) {
+ case PLUSD_DRIVE_1:
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT, 1 );
+ break;
+ case PLUSD_DRIVE_2:
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT, 1 );
+ break;
+ }
+
+ if( autoload ) {
+ /* XXX */
+ }
+
+ return 0;
+}
+
+int
+plusd_disk_eject( plusd_drive_number which, int write )
+{
+ wd1770_drive *d;
+
+ if( which >= PLUSD_NUM_DRIVES )
+ return 1;
+
+ d = &plusd_drives[ which ];
+
+ if( !d->disk )
+ return 0;
+
+ if( write ) {
+
+ if( ui_plusd_disk_write( which ) ) return 1;
+
+ } else {
+
+ if( dsk_dirty( plusd_drives[which].disk ) ) {
+
+ ui_confirm_save_t confirm = ui_confirm_save(
+ "Disk has been modified.\nDo you want to save it?"
+ );
+
+ switch( confirm ) {
+
+ case UI_CONFIRM_SAVE_SAVE:
+ if( ui_plusd_disk_write( which ) ) return 1;
+ break;
+
+ case UI_CONFIRM_SAVE_DONTSAVE: break;
+ case UI_CONFIRM_SAVE_CANCEL: return 1;
+
+ }
+ }
+ }
+
+ dsk_close( &d->disk );
+ unlink( d->filename );
+
+ /* Set the 'eject' item inactive */
+ switch( which ) {
+ case PLUSD_DRIVE_1:
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_1_EJECT, 0 );
+ break;
+ case PLUSD_DRIVE_2:
+ ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK_PLUSD_2_EJECT, 0 );
+ break;
+ }
+ return 0;
+}
+
+int
+plusd_disk_write( plusd_drive_number which, const char *filename )
+{
+ wd1770_drive *d = &plusd_drives[ which ];
+ utils_file file;
+ FILE *f;
+ int error;
+ size_t bytes_written;
+
+ dsk_close( &d->disk );
+
+ f = fopen( filename, "wb" );
+ if( !f ) {
+ ui_error( UI_ERROR_ERROR, "couldn't open '%s' for writing: %s", filename,
+ strerror( errno ) );
+ }
+
+ error = utils_read_file( d->filename, &file );
+ if( error ) { fclose( f ); return error; }
+
+ bytes_written = fwrite( file.buffer, 1, file.length, f );
+ if( bytes_written != file.length ) {
+ ui_error( UI_ERROR_ERROR, "could write only %lu of %lu bytes to '%s'",
+ (unsigned long)bytes_written, (unsigned long)file.length,
+ filename );
+ utils_close_file( &file ); fclose( f );
+ }
+
+ error = utils_close_file( &file ); if( error ) { fclose( f ); return error; }
+
+ if( fclose( f ) ) {
+ ui_error( UI_ERROR_ERROR, "error closing '%s': %s", filename,
+ strerror( errno ) );
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+plusd_event_cmd_done( libspectrum_dword last_tstates )
+{
+ plusd_fdc.status_register &= ~WD1770_SR_BUSY;
+ return 0;
+}
+
+int
+plusd_event_index( libspectrum_dword last_tstates )
+{
+ int error;
+ int next_tstates;
+ int i;
+
+ plusd_index_pulse = !plusd_index_pulse;
+ for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
+ wd1770_drive *d = &plusd_drives[ i ];
+
+ d->index_pulse = plusd_index_pulse;
+ if( !plusd_index_pulse && d->index_interrupt ) {
+ wd1770_set_cmdint( &plusd_fdc );
+ d->index_interrupt = 0;
+ }
+ }
+ next_tstates = ( plusd_index_pulse ? 10 : 190 ) *
+ machine_current->timings.processor_speed / 1000;
+ error = event_add( last_tstates + next_tstates, EVENT_TYPE_PLUSD_INDEX );
+ if( error )
+ return error;
+ return 0;
+}
+
+static void
+plusd_from_snapshot( libspectrum_snap *snap )
+{
+ /* XXX */
+}
+
+static void
+plusd_to_snapshot( libspectrum_snap *snap )
+{
+ /* XXX */
+}
Deleted: trunk/fuse/disk/plusd.h
===================================================================
--- vendor/fuse-emulator/current/fuse/disk/plusd.h 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/disk/plusd.h 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,94 +0,0 @@
-/* plusd.h: Routines for handling the +D interface
- Copyright (c) 2005-2007 Stuart Brady
-
- $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:
-
- Philip: phi...@sh...
-
- Stuart: sd...@nt...
-
-*/
-
-#ifndef FUSE_PLUSD_H
-#define FUSE_PLUSD_H
-
-#include <config.h>
-
-typedef enum plusd_drive_number {
- PLUSD_DRIVE_1 = 0,
- PLUSD_DRIVE_2,
-} plusd_drive_number;
-
-#ifdef HAVE_LIBDSK_H
-
-#include <libspectrum.h>
-
-#include "wd1770.h"
-#include "periph.h"
-
-extern int plusd_available; /* Is the +D available for use? */
-extern int plusd_active; /* +D enabled? */
-extern int plusd_index_pulse;
-
-extern const periph_t plusd_peripherals[];
-extern const size_t plusd_peripherals_count;
-
-int plusd_init( void );
-void plusd_end( void );
-
-void plusd_page( void );
-void plusd_unpage( void );
-
-libspectrum_byte plusd_sr_read( libspectrum_word port, int *attached );
-void plusd_cr_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_tr_read( libspectrum_word port, int *attached );
-void plusd_tr_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_sec_read( libspectrum_word port, int *attached );
-void plusd_sec_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_dr_read( libspectrum_word port, int *attached );
-void plusd_dr_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_joy_read( libspectrum_word port, int *attached );
-void plusd_cn_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_mem_read( libspectrum_word port, int *attached );
-void plusd_mem_write( libspectrum_word port, libspectrum_byte b );
-
-libspectrum_byte plusd_printer_read( libspectrum_word port, int *attached );
-
-extern wd1770_fdc plusd_fdc;
-
-#define PLUSD_NUM_DRIVES 2
-extern wd1770_drive plusd_drives[ PLUSD_NUM_DRIVES ];
-
-int plusd_disk_insert( plusd_drive_number which, const char *filename,
- int autoload );
-int plusd_disk_insert_default_autoload( plusd_drive_number which,
- const char *filename );
-int plusd_disk_eject( plusd_drive_number which, int write );
-int plusd_disk_write( plusd_drive_number which, const char *filename );
-int plusd_event_cmd_done( libspectrum_dword last_tstates );
-int plusd_event_index( libspectrum_dword last_tstates );
-
-#endif /* #ifndef HAVE_LIBDSK_H */
-
-#endif /* #ifndef FUSE_PLUSD_H */
Copied: trunk/fuse/disk/plusd.h (from rev 404, vendor/fuse-emulator/current/fuse/disk/plusd.h)
===================================================================
--- trunk/fuse/disk/plusd.h (rev 0)
+++ trunk/fuse/disk/plusd.h 2007-06-29 12:55:24 UTC (rev 405)
@@ -0,0 +1,94 @@
+/* plusd.h: Routines for handling the +D interface
+ Copyright (c) 2005-2007 Stuart Brady
+
+ $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:
+
+ Philip: phi...@sh...
+
+ Stuart: sd...@nt...
+
+*/
+
+#ifndef FUSE_PLUSD_H
+#define FUSE_PLUSD_H
+
+#include <config.h>
+
+typedef enum plusd_drive_number {
+ PLUSD_DRIVE_1 = 0,
+ PLUSD_DRIVE_2,
+} plusd_drive_number;
+
+#ifdef HAVE_LIBDSK_H
+
+#include <libspectrum.h>
+
+#include "wd1770.h"
+#include "periph.h"
+
+extern int plusd_available; /* Is the +D available for use? */
+extern int plusd_active; /* +D enabled? */
+extern int plusd_index_pulse;
+
+extern const periph_t plusd_peripherals[];
+extern const size_t plusd_peripherals_count;
+
+int plusd_init( void );
+void plusd_end( void );
+
+void plusd_page( void );
+void plusd_unpage( void );
+
+libspectrum_byte plusd_sr_read( libspectrum_word port, int *attached );
+void plusd_cr_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_tr_read( libspectrum_word port, int *attached );
+void plusd_tr_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_sec_read( libspectrum_word port, int *attached );
+void plusd_sec_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_dr_read( libspectrum_word port, int *attached );
+void plusd_dr_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_joy_read( libspectrum_word port, int *attached );
+void plusd_cn_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_mem_read( libspectrum_word port, int *attached );
+void plusd_mem_write( libspectrum_word port, libspectrum_byte b );
+
+libspectrum_byte plusd_printer_read( libspectrum_word port, int *attached );
+
+extern wd1770_fdc plusd_fdc;
+
+#define PLUSD_NUM_DRIVES 2
+extern wd1770_drive plusd_drives[ PLUSD_NUM_DRIVES ];
+
+int plusd_disk_insert( plusd_drive_number which, const char *filename,
+ int autoload );
+int plusd_disk_insert_default_autoload( plusd_drive_number which,
+ const char *filename );
+int plusd_disk_eject( plusd_drive_number which, int write );
+int plusd_disk_write( plusd_drive_number which, const char *filename );
+int plusd_event_cmd_done( libspectrum_dword last_tstates );
+int plusd_event_index( libspectrum_dword last_tstates );
+
+#endif /* #ifndef HAVE_LIBDSK_H */
+
+#endif /* #ifndef FUSE_PLUSD_H */
Deleted: trunk/fuse/disk/wd1770.c
===================================================================
--- vendor/fuse-emulator/current/fuse/disk/wd1770.c 2007-06-28 13:18:42 UTC (rev 404)
+++ trunk/fuse/disk/wd1770.c 2007-06-29 12:55:24 UTC (rev 405)
@@ -1,389 +0,0 @@
-/* wd1770.c: Routines for handling the WD1770 floppy disk controller
- Copyright (c) 2002-2007 Stuart Brady, Fredrick Meunier, Philip Kendall,
- Dmitry Sanarin
-
- $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:
-
- Philip: phi...@sh...
-
- Stuart: sd...@nt...
-
-*/
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h> /* Needed for strncasecmp() on QNX6 */
-#endif /* #ifdef HAVE_STRINGS_H */
-#include <limits.h>
-#include <sys/stat.h>
-
-#include <libdsk.h>
-
-#include <libspectrum.h>
-
-#include "compat.h"
-#include "event.h"
-#include "machine.h"
-#include "ui/ui.h"
-#include "wd1770.h"
-#include "z80/z80.h"
-
-char secbuf[1024];
-
-void
-statusbar_update( int busy )
-{
- ui_statusbar_update( UI_STATUSBAR_ITEM_DISK,
- busy ? UI_STATUSBAR_STATE_ACTIVE :
- UI_STATUSBAR_STATE_INACTIVE );
-}
-
-void
-wd1770_set_cmdint( wd1770_fdc *f )
-{
- if( f->set_cmdint )
- f->set_cmdint( f );
-}
-
-void
-wd1770_reset_cmdint( wd1770_fdc *f )
-{
- if( f->reset_cmdint )
- f->reset_cmdint( f );
-}
-
-void
-wd1770_set_datarq( wd1770_fdc *f )
-{
- f->status_register |= WD1770_SR_IDX_DRQ;
- if( f->set_datarq )
- f->set_datarq( f );
-}
-
-void
-wd1770_reset_datarq( wd1770_fdc *f )
-{
- f->status_register &= ~WD1770_SR_IDX_DRQ;
- if( f->reset_datarq )
- f->reset_datarq( f );
-}
-
-static void
-wd1770_seek( wd1770_fdc *f, int track, int update, int verify )
-{
- wd1770_drive *d = f->current_drive;
-
- if( track < d->track ) {
- f->direction = -1;
- if( f->track_register == 0 )
- f->track_register = 255;
- else if( update ) {
- int trk = f->track_register;
-
- trk += track - d->track + 256;
- trk %= 256;
- f->track_register = trk;
- }
- } else if( track > d->track ) {
- f->direction = 1;
- if( f->track_register == 255 )
- f->track_register = 0;
- else if( update ) {
- int trk = f->track_register;
-
- trk += track - d->track;
- trk %= 256;
- f->track_register = trk;
- }
- }
-
- if( verify ) {
- if( track < 0 )
- f->status_register |= WD1770_SR_RNF;
- else if( track >= d->geom.dg_cylinders )
- f->status_register |= WD1770_SR_RNF;
- else
- f->status_register &= ~WD1770_SR_RNF;
- } else
- f->status_register &= ~WD1770_SR_RNF;
-
- if( track < 0 )
- track = 0;
- if( track > 255 )
- track = 255;
- d->track = track;
-
- if( d->track == 0 )
- f->status_register |= WD1770_SR_LOST;
- else
- f->status_register &= ~WD1770_SR_LOST;
-}
-
-libspectrum_byte
-wd1770_sr_read( wd1770_fdc *f )
-{
- wd1770_drive *d = f->current_drive;
-
- f->status_register &= ~( WD1770_SR_MOTORON | WD1770_SR_SPINUP |
- WD1770_SR_WRPROT | WD1770_SR_CRCERR );
- if( f->status_type == wd1770_status_type1 ) {
- f->status_register &= ~WD1770_SR_IDX_DRQ;
- if( !d->disk || d->index_pulse )
- f->status_register |= WD1770_SR_IDX_DRQ;
- }
- return f->status_register;
-}
-
-
-void
-wd1770_cr_write( wd1770_fdc *f, libspectrum_byte b )
-{
- wd1770_drive *d = f->current_drive;
-
- /* command register: */
- if( ( b & 0xf0 ) == 0xd0 ) { /* Type IV - Force Interrupt */
- statusbar_update(0);
- f->status_register &= ~WD1770_SR_BUSY;
- f->status_register &= ~WD1770_SR_WRPROT;
- f->status_register &= ~WD1770_SR_CRCERR;
- f->status_register &= ~WD1770_SR_IDX_DRQ;
- f->state = wd1770_state_none;
- f->status_type = wd1770_status_type1;
- if( d->track == 0 )
- f->status_register |= WD1770_SR_LOST;
- else
- f->status_register &= ~WD1770_SR_LOST;
- wd1770_reset_datarq( f );
- if( b & 0x08 )
- wd1770_set_cmdint( f );
- if( b & 0x04 )
- d->index_interrupt = 1;
- return;
- }
-
- if( f->status_register & WD1770_SR_BUSY )
- return;
-
- /*
- f->status_register |= WD1770_SR_BUSY;
- event_add( tstates +
- 10 * machine_current->timings.processor_speed / 1000,
- EVENT_TYPE_PLUSD_CMD_DONE );
- */
-
- if( !( b & 0x08 ) ) {
- f->spin_cycles = 5;
- f->status_register |= WD1770_SR_MOTORON;
- f->status_register |= WD1770_SR_SPINUP;
- }
-
- if( !( b & 0x80 ) ) { /* Type I */
- int update = b & 0x10 ? 1 : 0;
- int verify = b & 0x04 ? 1 : 0;
-/* int rate = b & 0x03 ? 1 : 0; */
-
- switch( ( b >> 5 ) & 0x03 ) {
- case 0x00:
- if( ( b & 0x4 ) ) { /* Restore */
- f->track_register = d->track;
- wd1770_seek( f, 0, update, verify );
- } else { /* Seek */
- wd1770_seek( f, f->data_register, 0, verify );
- }
- f->direction = 1;
- break;
- case 0x01: /* Step */
- wd1770_seek( f, d->track + f->direction, update, verify );
- break;
- case 0x02: /* Step In */
- wd1770_seek( f, d->track + 1, update, verify );
- break;
- case 0x03: /* Step Out */
- wd1770_seek( f, d->track - 1, update, verify );
- break;
- }
- f->status_type = wd1770_status_type1;
- wd1770_set_cmdint( f );
- wd1770_reset_datarq( f );
- } else if( !( b & 0x40 ) ) { /* Type II */
- int multisector = b & 0x10 ? 1 : 0;
-/* int delay = b & 0x04 ? 1 : 0; */
-
- if( !( b & 0x20 ) ) { /* Read Sector */
- f->state = wd1770_state_read;
- } else { /* Write Sector */
-/* int dammark = b & 0x01; */
-
- f->state = wd1770_state_write;
- }
- if( f->sector_register < d->geom.dg_secbase ||
- f->sector_register >= d->geom.dg_secbase + d->geom.dg_sectors ||
- d->track >= d->geom.dg_cylinders ||
- d->track < 0 ) {
- f->status_register |= WD1770_SR_RNF;
- wd1770_set_cmdint( f );
- wd1770_reset_datarq( f );
- } else {
- wd1770_set_datarq( f );
- statusbar_update(1);
- f->status_register |= WD1770_SR_BUSY;
- f->status_register &= ~( WD1770_SR_WRPROT | WD1770_SR_RNF |
- WD1770_SR_CRCERR | WD1770_SR_LOST );
- f->status_type = wd1770_status_type2;
- f->data_track = d->track;
- f->data_sector = f->sector_register;
- f->data_side = d->side;
- f->data_offset = 0;
- f->data_multisector = multisector;
- }
- } else if( ( b & 0xf0 ) != 0xd0 ) { /* Type III */
-/* int delay = b & 0x04; */
-
- switch( b & 0xf0 ) {
- case 0x00: /* Read Track */
- fprintf( stderr, "read track not yet implemented\n" );
- break;
- case 0x01: /* Write Track */
- fprintf( stderr, "write track not yet implemented\n" );
- break;
- case 0x02: /* Read Address */
- fprintf( stderr, "read address not yet implemented\n" );
- break;
- }
- f->status_type = wd1770_status_type2;
- }
-}
-
-libspectrum_byte
-wd1770_tr_read( wd1770_fdc *f )
-{
- return f->track_reg...
[truncated message content] |