]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1400b1.zip
authorToni Wilen <twilen@winuae.net>
Sat, 13 Jan 2007 19:07:22 +0000 (21:07 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:31:15 +0000 (21:31 +0200)
456 files changed:
7z/7zAlloc.c [changed mode: 0755->0644]
7z/7zAlloc.h [changed mode: 0755->0644]
7z/7zBuffer.c [changed mode: 0755->0644]
7z/7zBuffer.h [changed mode: 0755->0644]
7z/7zCrc.c [changed mode: 0755->0644]
7z/7zCrc.h [changed mode: 0755->0644]
7z/7zDecode.c [changed mode: 0755->0644]
7z/7zDecode.h [changed mode: 0755->0644]
7z/7zExtract.c [changed mode: 0755->0644]
7z/7zExtract.h [changed mode: 0755->0644]
7z/7zHeader.c [changed mode: 0755->0644]
7z/7zHeader.h [changed mode: 0755->0644]
7z/7zIn.c [changed mode: 0755->0644]
7z/7zIn.h [changed mode: 0755->0644]
7z/7zItem.c [changed mode: 0755->0644]
7z/7zItem.h [changed mode: 0755->0644]
7z/7zMain.c [changed mode: 0755->0644]
7z/7zMethodID.c [changed mode: 0755->0644]
7z/7zMethodID.h [changed mode: 0755->0644]
7z/7zTypes.h [changed mode: 0755->0644]
7z/LzmaDecode.c [changed mode: 0755->0644]
7z/LzmaDecode.h [changed mode: 0755->0644]
7z/LzmaTypes.h [changed mode: 0755->0644]
ChangeLog [changed mode: 0755->0644]
akiko.c [changed mode: 0755->0644]
akiko2.c [changed mode: 0755->0644]
ar.c [changed mode: 0755->0644]
arcadia.c [changed mode: 0755->0644]
audio.c [changed mode: 0755->0644]
autoconf.c [changed mode: 0755->0644]
blitops.c [changed mode: 0755->0644]
blitter.c [changed mode: 0755->0644]
blitter2.c [changed mode: 0755->0644]
blitter3.c [changed mode: 0755->0644]
blkdev.c [changed mode: 0755->0644]
bsdsocket.c [changed mode: 0755->0644]
build68k.c [changed mode: 0755->0644]
catweasel.c [changed mode: 0755->0644]
cdrom.c [changed mode: 0755->0644]
cdtv.c [changed mode: 0755->0644]
cfgfile.c [changed mode: 0755->0644]
cia.c [changed mode: 0755->0644]
compemu_fpp.c [changed mode: 0755->0644]
compemu_optimizer.c [changed mode: 0755->0644]
compemu_optimizer_x86.c [changed mode: 0755->0644]
compemu_raw_x86.c [changed mode: 0755->0644]
compemu_support.c [changed mode: 0755->0644]
core.cw4.c [changed mode: 0755->0644]
cpuopti.c [changed mode: 0755->0644]
crc32.c [changed mode: 0755->0644]
custom.c [changed mode: 0755->0644]
custom2.c [changed mode: 0755->0644]
debug.c [changed mode: 0755->0644]
disk.c [changed mode: 0755->0644]
dms/cdata.h [changed mode: 0755->0644]
dms/crc_csum.c [changed mode: 0755->0644]
dms/crc_csum.h [changed mode: 0755->0644]
dms/getbits.c [changed mode: 0755->0644]
dms/getbits.h [changed mode: 0755->0644]
dms/maketbl.c [changed mode: 0755->0644]
dms/maketbl.h [changed mode: 0755->0644]
dms/pfile.c [changed mode: 0755->0644]
dms/pfile.h [changed mode: 0755->0644]
dms/tables.c [changed mode: 0755->0644]
dms/tables.h [changed mode: 0755->0644]
dms/u_deep.c [changed mode: 0755->0644]
dms/u_deep.h [changed mode: 0755->0644]
dms/u_heavy.c [changed mode: 0755->0644]
dms/u_heavy.h [changed mode: 0755->0644]
dms/u_init.c [changed mode: 0755->0644]
dms/u_init.h [changed mode: 0755->0644]
dms/u_medium.c [changed mode: 0755->0644]
dms/u_medium.h [changed mode: 0755->0644]
dms/u_quick.c [changed mode: 0755->0644]
dms/u_quick.h [changed mode: 0755->0644]
dms/u_rle.c [changed mode: 0755->0644]
dms/u_rle.h [changed mode: 0755->0644]
drawing.c [changed mode: 0755->0644]
driveclick.c [changed mode: 0755->0644]
enforcer.c [changed mode: 0755->0644]
ersatz.c [changed mode: 0755->0644]
expansion.c [changed mode: 0755->0644]
fdi2raw.c [changed mode: 0755->0644]
filesys.asm [changed mode: 0755->0644]
filesys.c [changed mode: 0755->0644]
filesys.sh [changed mode: 0755->0644]
filesys_bootrom.c [changed mode: 0755->0644]
fpp.c [changed mode: 0755->0644]
fsdb.c [changed mode: 0755->0644]
fsdb_unix.c [changed mode: 0755->0644]
fsusage.c [changed mode: 0755->0644]
gayle.c [changed mode: 0755->0644]
genblitter.c [changed mode: 0755->0644]
gencomp.c [changed mode: 0755->0644]
gencpu.c [changed mode: 0755->0644]
gengenblitter.c [changed mode: 0755->0644]
genlinetoscr.c [changed mode: 0755->0644]
genp2c.c [changed mode: 0755->0644]
gfxlib.c [changed mode: 0755->0644]
gfxutil.c [changed mode: 0755->0644]
gtkui.c [changed mode: 0755->0644]
hardfile.c [changed mode: 0755->0644]
hrtmon_rom.c [changed mode: 0755->0644]
identify.c [changed mode: 0755->0644]
include/akiko.h [changed mode: 0755->0644]
include/ar.h [changed mode: 0755->0644]
include/arcadia.h [changed mode: 0755->0644]
include/audio.h [changed mode: 0755->0644]
include/autoconf.h [changed mode: 0755->0644]
include/blitter.h [changed mode: 0755->0644]
include/blkdev.h [changed mode: 0755->0644]
include/bsdsocket.h [changed mode: 0755->0644]
include/catweasel.h [changed mode: 0755->0644]
include/cdtv.h [changed mode: 0755->0644]
include/cia.h [changed mode: 0755->0644]
include/commpipe.h [changed mode: 0755->0644]
include/compemu.h [changed mode: 0755->0644]
include/cpu_prefetch.h [changed mode: 0755->0644]
include/crc32.h [changed mode: 0755->0644]
include/custom.h [changed mode: 0755->0644]
include/debug.h [changed mode: 0755->0644]
include/disk.h [changed mode: 0755->0644]
include/drawing.h [changed mode: 0755->0644]
include/driveclick.h [changed mode: 0755->0644]
include/enforcer.h [changed mode: 0755->0644]
include/ersatz.h [changed mode: 0755->0644]
include/events.h [changed mode: 0755->0644]
include/events_jit.h [changed mode: 0755->0644]
include/events_normal.h [changed mode: 0755->0644]
include/execlib.h [changed mode: 0755->0644]
include/fdi2raw.h [changed mode: 0755->0644]
include/filesys.h [changed mode: 0755->0644]
include/filter.h [changed mode: 0755->0644]
include/fpp-ieee-be.h [changed mode: 0755->0644]
include/fpp-unknown.h [changed mode: 0755->0644]
include/fsdb.h [changed mode: 0755->0644]
include/fsusage.h [changed mode: 0755->0644]
include/gayle.h [new file with mode: 0644]
include/genblitter.h [changed mode: 0755->0644]
include/gensound.h [changed mode: 0755->0644]
include/gfxfilter.h [changed mode: 0755->0644]
include/gui.h [changed mode: 0755->0644]
include/identify.h [changed mode: 0755->0644]
include/inputdevice.h [changed mode: 0755->0644]
include/keyboard.h [changed mode: 0755->0644]
include/keybuf.h [changed mode: 0755->0644]
include/mackbd.h [changed mode: 0755->0644]
include/memory.h [changed mode: 0755->0644]
include/moduleripper.h [changed mode: 0755->0644]
include/native2amiga.h [changed mode: 0755->0644]
include/newcpu.h [changed mode: 0755->0644]
include/options.h [changed mode: 0755->0644]
include/osemu.h [changed mode: 0755->0644]
include/parallel.h [changed mode: 0755->0644]
include/picasso96.h [changed mode: 0755->0644]
include/readcpu.h [changed mode: 0755->0644]
include/savestate.h [changed mode: 0755->0644]
include/scsidev.h [changed mode: 0755->0644]
include/serial.h [changed mode: 0755->0644]
include/sysconfig.h.win32 [changed mode: 0755->0644]
include/sysdeps.h [changed mode: 0755->0644]
include/traps.h [changed mode: 0755->0644]
include/tui.h [changed mode: 0755->0644]
include/uae.h [changed mode: 0755->0644]
include/uaeexe.h [changed mode: 0755->0644]
include/uaeipc.h [changed mode: 0755->0644]
include/uaeserial.h [changed mode: 0755->0644]
include/unzip.h [changed mode: 0755->0644]
include/xwin.h [changed mode: 0755->0644]
include/zfile.h [changed mode: 0755->0644]
inputdevice.c [changed mode: 0755->0644]
inputevents.def [changed mode: 0755->0644]
keybuf.c [changed mode: 0755->0644]
main.c [changed mode: 0755->0644]
memory.c [changed mode: 0755->0644]
missing.c [changed mode: 0755->0644]
moduleripper.c [changed mode: 0755->0644]
native2amiga.c [changed mode: 0755->0644]
ncurses.c [changed mode: 0755->0644]
newcpu.c [changed mode: 0755->0644]
nogui.c [changed mode: 0755->0644]
od-generic/exectasks.h [changed mode: 0755->0644]
od-generic/joystick.c [changed mode: 0755->0644]
od-generic/memory.h [changed mode: 0755->0644]
od-generic/sound.c [changed mode: 0755->0644]
od-generic/sound.h [changed mode: 0755->0644]
od-win32/7zplugin.c [changed mode: 0755->0644]
od-win32/WinUAE_Install.nsi [changed mode: 0755->0644]
od-win32/ahidsound.c [changed mode: 0755->0644]
od-win32/ahidsound.h [changed mode: 0755->0644]
od-win32/asm.bat [changed mode: 0755->0644]
od-win32/avioutput.c [changed mode: 0755->0644]
od-win32/avioutput.h [changed mode: 0755->0644]
od-win32/blkdev_win32_aspi.c [changed mode: 0755->0644]
od-win32/blkdev_win32_ioctl.c [changed mode: 0755->0644]
od-win32/blkdev_win32_spti.c [changed mode: 0755->0644]
od-win32/bsdsock.c [changed mode: 0755->0644]
od-win32/build68k_msvc/build68k_msvc.rc [changed mode: 0755->0644]
od-win32/build68k_msvc/build68k_msvc.vcproj [changed mode: 0755->0644]
od-win32/caps/CapsAPI.h [changed mode: 0755->0644]
od-win32/caps/CapsLib.h [changed mode: 0755->0644]
od-win32/caps/Comlib.h [changed mode: 0755->0644]
od-win32/caps/Comtype.h [changed mode: 0755->0644]
od-win32/caps/caps_win32.c [changed mode: 0755->0644]
od-win32/caps/caps_win32.h [changed mode: 0755->0644]
od-win32/dinput.c [changed mode: 0755->0644]
od-win32/direct3d.c [changed mode: 0755->0644]
od-win32/direct3d.h [changed mode: 0755->0644]
od-win32/diskutil.c [changed mode: 0755->0644]
od-win32/diskutil.h [changed mode: 0755->0644]
od-win32/driveclick_win32.c [changed mode: 0755->0644]
od-win32/dxwrap.c [changed mode: 0755->0644]
od-win32/dxwrap.h [changed mode: 0755->0644]
od-win32/fdrawcmd.c [changed mode: 0755->0644]
od-win32/fsdb_win32.c [changed mode: 0755->0644]
od-win32/genblitter_msvc/genblitter_msvc.vcproj [changed mode: 0755->0644]
od-win32/gencomp_msvc/gencomp_msvc.vcproj [changed mode: 0755->0644]
od-win32/gencpu_msvc/gencpu_msvc.vcproj [changed mode: 0755->0644]
od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcproj [changed mode: 0755->0644]
od-win32/graphics/amiga_header.bmp [changed mode: 0755->0644]
od-win32/graphics/amiga_welcome.bmp [changed mode: 0755->0644]
od-win32/graphics/installer_icon.ico [changed mode: 0755->0644]
od-win32/hardfile_win32.c [changed mode: 0755->0644]
od-win32/hq2x32.asm [changed mode: 0755->0644]
od-win32/hq3x16.asm [changed mode: 0755->0644]
od-win32/hq3x32.asm [changed mode: 0755->0644]
od-win32/hq4x32.asm [changed mode: 0755->0644]
od-win32/ioport.c [changed mode: 0755->0644]
od-win32/ioport.h [changed mode: 0755->0644]
od-win32/ipctester.c [changed mode: 0755->0644]
od-win32/keyboard_win32.c [changed mode: 0755->0644]
od-win32/lcd.c [changed mode: 0755->0644]
od-win32/lcd.h [changed mode: 0755->0644]
od-win32/machdep/m68k.h [changed mode: 0755->0644]
od-win32/machdep/maccess.h [changed mode: 0755->0644]
od-win32/machdep/rpt.h [changed mode: 0755->0644]
od-win32/machdep/support.c [changed mode: 0755->0644]
od-win32/makeexe.bat [changed mode: 0755->0644]
od-win32/md-fpp.h [changed mode: 0755->0644]
od-win32/midi.c [changed mode: 0755->0644]
od-win32/midi.h [changed mode: 0755->0644]
od-win32/midiin.c [changed mode: 0755->0644]
od-win32/mman.c [changed mode: 0755->0644]
od-win32/opengl.c [changed mode: 0755->0644]
od-win32/opengl.h [changed mode: 0755->0644]
od-win32/parser.c [changed mode: 0755->0644]
od-win32/parser.h [changed mode: 0755->0644]
od-win32/picasso96_win.c [changed mode: 0755->0644]
od-win32/picasso96_win.h [changed mode: 0755->0644]
od-win32/posixemu.c [changed mode: 0755->0644]
od-win32/posixemu.h [changed mode: 0755->0644]
od-win32/resources/35floppy.ico [changed mode: 0755->0644]
od-win32/resources/Mycomp.ico [changed mode: 0755->0644]
od-win32/resources/RCa00564 [changed mode: 0755->0644]
od-win32/resources/WinUAE_German.rc [changed mode: 0755->0644]
od-win32/resources/amigainfo.ico [changed mode: 0755->0644]
od-win32/resources/avioutput.ico [changed mode: 0755->0644]
od-win32/resources/chip.ico [changed mode: 0755->0644]
od-win32/resources/cpu.ico [changed mode: 0755->0644]
od-win32/resources/drive.ico [changed mode: 0755->0644]
od-win32/resources/drive_click.wav [changed mode: 0755->0644]
od-win32/resources/drive_snatch.wav [changed mode: 0755->0644]
od-win32/resources/drive_spin.wav [changed mode: 0755->0644]
od-win32/resources/drive_spinnd.wav [changed mode: 0755->0644]
od-win32/resources/drive_startup.wav [changed mode: 0755->0644]
od-win32/resources/file.ico [changed mode: 0755->0644]
od-win32/resources/folder.ico [changed mode: 0755->0644]
od-win32/resources/h_arrow.cur [changed mode: 0755->0644]
od-win32/resources/joystick.ico [changed mode: 0755->0644]
od-win32/resources/lcd.bmp [changed mode: 0755->0644]
od-win32/resources/misc.ico [changed mode: 0755->0644]
od-win32/resources/move_dow.ico [changed mode: 0755->0644]
od-win32/resources/move_up.ico [changed mode: 0755->0644]
od-win32/resources/paths.ico [changed mode: 0755->0644]
od-win32/resources/quickstart.ico [changed mode: 0755->0644]
od-win32/resources/resource.h [changed mode: 0755->0644]
od-win32/resources/resource.hm [changed mode: 0755->0644]
od-win32/resources/root.ico [changed mode: 0755->0644]
od-win32/resources/screen.ico [changed mode: 0755->0644]
od-win32/resources/sound.ico [changed mode: 0755->0644]
od-win32/resources/winuae.exe.manifest [changed mode: 0755->0644]
od-win32/resources/winuae.ico [changed mode: 0755->0644]
od-win32/resources/winuae.rc [changed mode: 0755->0644]
od-win32/resources/winuae_minimal.rc [changed mode: 0755->0644]
od-win32/resources/xarcade-winuae.bmp [changed mode: 0755->0644]
od-win32/scaler.c [changed mode: 0755->0644]
od-win32/scaler2.c [changed mode: 0755->0644]
od-win32/screenshot.c [changed mode: 0755->0644]
od-win32/scsidef.h [changed mode: 0755->0644]
od-win32/serial_win32.c [changed mode: 0755->0644]
od-win32/sfhelper.c [changed mode: 0755->0644]
od-win32/shm.c [changed mode: 0755->0644]
od-win32/soundcheck.c [changed mode: 0755->0644]
od-win32/sounddep/sound.c [changed mode: 0755->0644]
od-win32/sounddep/sound.h [changed mode: 0755->0644]
od-win32/srcrelease.bat [changed mode: 0755->0644]
od-win32/support.c [changed mode: 0755->0644]
od-win32/sys/ipc.h [changed mode: 0755->0644]
od-win32/sys/mman.h [changed mode: 0755->0644]
od-win32/sys/shm.h [changed mode: 0755->0644]
od-win32/sysconfig.h [changed mode: 0755->0644]
od-win32/target.h [changed mode: 0755->0644]
od-win32/threaddep/thread.h [changed mode: 0755->0644]
od-win32/unistd.h [changed mode: 0755->0644]
od-win32/wcc.sh [changed mode: 0755->0644]
od-win32/win32.c [changed mode: 0755->0644]
od-win32/win32.h [changed mode: 0755->0644]
od-win32/win32_decompress.c [changed mode: 0755->0644]
od-win32/win32_filesys.c [changed mode: 0755->0644]
od-win32/win32_nogui.c [changed mode: 0755->0644]
od-win32/win32_scale2x.c [changed mode: 0755->0644]
od-win32/win32gfx.c [changed mode: 0755->0644]
od-win32/win32gfx.h [changed mode: 0755->0644]
od-win32/win32gui.c [changed mode: 0755->0644]
od-win32/win32gui.h [changed mode: 0755->0644]
od-win32/winuae_msvc/winuae_msvc.vcproj [changed mode: 0755->0644]
od-win32/winuaechangelog.txt [changed mode: 0755->0644]
od-win32/wrc.sh [changed mode: 0755->0644]
od-win32/writelog.c [changed mode: 0755->0644]
picasso96.c [changed mode: 0755->0644]
prowizard/misc/misc.c [changed mode: 0755->0644]
prowizard/misc/testbag.c [changed mode: 0755->0644]
prowizard/prowiz.c [changed mode: 0755->0644]
prowizard/rippers/AC1D_packer.c [changed mode: 0755->0644]
prowizard/rippers/AMOS-MusicBank.c [changed mode: 0755->0644]
prowizard/rippers/AMOS-PowerPackerBank.c [changed mode: 0755->0644]
prowizard/rippers/BP-Soundmonitor.c [changed mode: 0755->0644]
prowizard/rippers/BSI-FutureComposer.c [changed mode: 0755->0644]
prowizard/rippers/Bytekiller.c [changed mode: 0755->0644]
prowizard/rippers/ChipTracker.c [changed mode: 0755->0644]
prowizard/rippers/Crunchmania-Address.c [changed mode: 0755->0644]
prowizard/rippers/Crunchmania-Simple.c [changed mode: 0755->0644]
prowizard/rippers/DefjamCruncher32-pro.c [changed mode: 0755->0644]
prowizard/rippers/DigiBooster17.c [changed mode: 0755->0644]
prowizard/rippers/DigitalIllusion.c [changed mode: 0755->0644]
prowizard/rippers/DoubleAction.c [changed mode: 0755->0644]
prowizard/rippers/Dragpack100.c [changed mode: 0755->0644]
prowizard/rippers/Dragpack252.c [changed mode: 0755->0644]
prowizard/rippers/EurekaPacker.c [changed mode: 0755->0644]
prowizard/rippers/FC-M-Packer.c [changed mode: 0755->0644]
prowizard/rippers/FastTracker2.c [changed mode: 0755->0644]
prowizard/rippers/FuchsTracker.c [changed mode: 0755->0644]
prowizard/rippers/FutureComposer13.c [changed mode: 0755->0644]
prowizard/rippers/FutureComposer14.c [changed mode: 0755->0644]
prowizard/rippers/FuzzacPacker.c [changed mode: 0755->0644]
prowizard/rippers/GNUPacker12.c [changed mode: 0755->0644]
prowizard/rippers/GPMO.c [changed mode: 0755->0644]
prowizard/rippers/GameMusicCreator.c [changed mode: 0755->0644]
prowizard/rippers/GnuPlayer.c [changed mode: 0755->0644]
prowizard/rippers/HQC2.c [changed mode: 0755->0644]
prowizard/rippers/HeatseekerMC10.c [changed mode: 0755->0644]
prowizard/rippers/HornetPacker.c [changed mode: 0755->0644]
prowizard/rippers/JamCracker.c [changed mode: 0755->0644]
prowizard/rippers/KefrensSoundMachine.c [changed mode: 0755->0644]
prowizard/rippers/MED-Octamed.c [changed mode: 0755->0644]
prowizard/rippers/MOD-compatible.c [changed mode: 0755->0644]
prowizard/rippers/MasterCruncher30-Address.c [changed mode: 0755->0644]
prowizard/rippers/MaxPacker12.c [changed mode: 0755->0644]
prowizard/rippers/MegaCruncher-Object.c [changed mode: 0755->0644]
prowizard/rippers/MegaCruncher.c [changed mode: 0755->0644]
prowizard/rippers/ModuleProtector.c [changed mode: 0755->0644]
prowizard/rippers/Mugician.c [changed mode: 0755->0644]
prowizard/rippers/Newtron.c [changed mode: 0755->0644]
prowizard/rippers/NoiseFromHeaven.c [changed mode: 0755->0644]
prowizard/rippers/NoisePacker1.c [changed mode: 0755->0644]
prowizard/rippers/NoisePacker2.c [changed mode: 0755->0644]
prowizard/rippers/NoisePacker3.c [changed mode: 0755->0644]
prowizard/rippers/NoiseRunner.c [changed mode: 0755->0644]
prowizard/rippers/PhaPacker.c [changed mode: 0755->0644]
prowizard/rippers/PolkaPacker.c [changed mode: 0755->0644]
prowizard/rippers/PowerMusic.c [changed mode: 0755->0644]
prowizard/rippers/PowerPacker23.c [changed mode: 0755->0644]
prowizard/rippers/PowerPacker30.c [changed mode: 0755->0644]
prowizard/rippers/PowerPacker40-library.c [changed mode: 0755->0644]
prowizard/rippers/PowerPacker40.c [changed mode: 0755->0644]
prowizard/rippers/ProPacker10.c [changed mode: 0755->0644]
prowizard/rippers/ProPacker21.c [changed mode: 0755->0644]
prowizard/rippers/ProPacker30.c [changed mode: 0755->0644]
prowizard/rippers/Promizer01.c [changed mode: 0755->0644]
prowizard/rippers/Promizer10c.c [changed mode: 0755->0644]
prowizard/rippers/Promizer18a.c [changed mode: 0755->0644]
prowizard/rippers/Promizer20.c [changed mode: 0755->0644]
prowizard/rippers/Promizer40.c [changed mode: 0755->0644]
prowizard/rippers/Prorunner10.c [changed mode: 0755->0644]
prowizard/rippers/Prorunner20.c [changed mode: 0755->0644]
prowizard/rippers/QuadraComposer.c [changed mode: 0755->0644]
prowizard/rippers/RelokIt10.c [changed mode: 0755->0644]
prowizard/rippers/SGT-Packer.c [changed mode: 0755->0644]
prowizard/rippers/SkytPacker.c [changed mode: 0755->0644]
prowizard/rippers/SoundFX.c [changed mode: 0755->0644]
prowizard/rippers/SoundTracker.c [changed mode: 0755->0644]
prowizard/rippers/SoundTracker26.c [changed mode: 0755->0644]
prowizard/rippers/SpikeCruncher.c [changed mode: 0755->0644]
prowizard/rippers/StartrekkerPack.c [changed mode: 0755->0644]
prowizard/rippers/StimPacker.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker270.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker299.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker299b.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker299d.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker300.c [changed mode: 0755->0644]
prowizard/rippers/StoneCracker310.c [changed mode: 0755->0644]
prowizard/rippers/SuperCruncher27.c [changed mode: 0755->0644]
prowizard/rippers/SyncroPacker46.c [changed mode: 0755->0644]
prowizard/rippers/TMK.c [changed mode: 0755->0644]
prowizard/rippers/TNMCruncher.c [changed mode: 0755->0644]
prowizard/rippers/TetraPack102.c [changed mode: 0755->0644]
prowizard/rippers/TetraPack21.c [changed mode: 0755->0644]
prowizard/rippers/TetraPack22.c [changed mode: 0755->0644]
prowizard/rippers/TheDarkDemon.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer22a.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer30a.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer40.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer41a.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer50a.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer60a.c [changed mode: 0755->0644]
prowizard/rippers/ThePlayer61a.c [changed mode: 0755->0644]
prowizard/rippers/TimeCruncher17.c [changed mode: 0755->0644]
prowizard/rippers/TrackerPacker1.c [changed mode: 0755->0644]
prowizard/rippers/TrackerPacker2.c [changed mode: 0755->0644]
prowizard/rippers/TrackerPacker3.c [changed mode: 0755->0644]
prowizard/rippers/TreasurePattern.c [changed mode: 0755->0644]
prowizard/rippers/TryItCruncher101.c [changed mode: 0755->0644]
prowizard/rippers/TurboSqueezer61.c [changed mode: 0755->0644]
prowizard/rippers/UnicTracker.c [changed mode: 0755->0644]
prowizard/rippers/UnicTracker2.c [changed mode: 0755->0644]
prowizard/rippers/WantonPacker.c [changed mode: 0755->0644]
prowizard/rippers/XannPlayer.c [changed mode: 0755->0644]
prowizard/rippers/ZenPacker.c [changed mode: 0755->0644]
prowizard/rippers/datacrunchers.c [changed mode: 0755->0644]
prowizard/rippers/extern.h [changed mode: 0755->0644]
prowizard/rippers/globals.h [changed mode: 0755->0644]
prowizard/rippers/ptktable.h [changed mode: 0755->0644]
prowizard/rippers/tuning.h [changed mode: 0755->0644]
prowizard/rippers/vars.h [changed mode: 0755->0644]
readcpu.c [changed mode: 0755->0644]
readdisk.c [changed mode: 0755->0644]
rpc.c [changed mode: 0755->0644]
savestate.c [changed mode: 0755->0644]
scsi-none.c [changed mode: 0755->0644]
scsidev.c [changed mode: 0755->0644]
scsiemul.c [changed mode: 0755->0644]
sdl-joystick.c [changed mode: 0755->0644]
serial.c [changed mode: 0755->0644]
sinctable.c [changed mode: 0755->0644]
svga.c [changed mode: 0755->0644]
svgancui.c [changed mode: 0755->0644]
table68k [changed mode: 0755->0644]
traps.c [changed mode: 0755->0644]
tui.c [changed mode: 0755->0644]
uaeexe.c [changed mode: 0755->0644]
uaeipc.c [changed mode: 0755->0644]
uaelib.c [changed mode: 0755->0644]
uaeserial.c [changed mode: 0755->0644]
unzip.c [changed mode: 0755->0644]
writelog.c [changed mode: 0755->0644]
zfile.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/akiko.c b/akiko.c
old mode 100755 (executable)
new mode 100644 (file)
index bd26082..de5b71f
--- a/akiko.c
+++ b/akiko.c
@@ -66,7 +66,11 @@ static int state = I2C_WAIT;
 
 static void nvram_write        (int offset, int len)
 {
-    struct zfile *f = zfile_fopen (currprefs.flashfile, "rb+");
+    struct zfile *f;
+
+    if (!currprefs.cs_cd32nvram)
+       return;
+    f = zfile_fopen (currprefs.flashfile, "rb+");
     if (!f) {
        f = zfile_fopen (currprefs.flashfile, "wb");
        if (!f) return;
@@ -81,6 +85,8 @@ static void nvram_read (void)
 {
     struct zfile *f;
 
+    if (!currprefs.cs_cd32nvram)
+       return;
     f = zfile_fopen (currprefs.flashfile, "rb");
     memset (cd32_nvram, 0, NVRAM_SIZE);
     if (!f) return;
@@ -620,18 +626,15 @@ static int cdrom_command_something (void)
 
 static int cdrom_command_media_status (void)
 {
-    struct device_info di;
-
     cdrom_result_buffer[0] = 10;
-    cdrom_result_buffer[1] = sys_command_info (DF_IOCTL, unitnum, &di)->media_inserted ?  1 : 0;
+    cdrom_result_buffer[1] = sys_command_ismedia (DF_IOCTL, unitnum);
     return 2;
 }
 
 /* check if cd drive door is open or closed */
 static int cdrom_command_door_status (void)
 {
-    struct device_info di;
-    if (unitnum >= 0 && !sys_command_info (DF_IOCTL, unitnum, &di)->media_inserted) {
+    if (unitnum >= 0 && !sys_command_ismedia (DF_IOCTL, unitnum)) {
        cdrom_result_buffer[1] = 0x80;
        cdrom_disk = 0;
     } else {
@@ -887,7 +890,6 @@ static void akiko_handler (void)
 {
     static int mediacheckcnt;
     static int lastmediastate = -1;
-    struct device_info di;
 
     if (unitnum < 0)
        return;
@@ -900,7 +902,7 @@ static void akiko_handler (void)
     if (mediacheckcnt > 0)
        mediacheckcnt--;
     if (mediacheckcnt == 0) {
-       int media = sys_command_info (DF_IOCTL, unitnum, &di)->media_inserted;
+       int media = sys_command_ismedia (DF_IOCTL, unitnum);
        mediacheckcnt = 312 * 50 * 2;
        if (media != lastmediastate) {
            write_log ("media changed = %d\n", media);
@@ -921,6 +923,8 @@ static void akiko_handler (void)
 
 static void akiko_internal (void)
 {
+    if (!currprefs.cs_cd32cd)
+       return;
     cdrom_run_command ();
     if (cdrom_command_active > 0) {
        cdrom_command_active--;
@@ -929,13 +933,11 @@ static void akiko_internal (void)
     }
 }
 
-extern int cd32_enabled;
-
 void AKIKO_hsync_handler (void)
 {
     static int framecounter;
 
-    if (!cd32_enabled)
+    if (!currprefs.cs_cd32cd)
        return;
     framecounter--;
     if (framecounter <= 0) {
@@ -1014,7 +1016,16 @@ STATIC_INLINE void akiko_put_long (uae_u32 *p, int offset, int v)
     *p |= v << ((3 - offset) * 8);
 }
 
-uae_u32 akiko_bget2 (uaecptr addr, int msg)
+static uae_u32 REGPARAM3 akiko_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 akiko_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 akiko_bget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 akiko_lgeti (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 akiko_wgeti (uaecptr) REGPARAM;
+static void REGPARAM3 akiko_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 akiko_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 akiko_bput (uaecptr, uae_u32) REGPARAM;
+
+static uae_u32 akiko_bget2 (uaecptr addr, int msg)
 {
     uae_u8 v;
 
@@ -1031,68 +1042,74 @@ uae_u32 akiko_bget2 (uaecptr addr, int msg)
        v = 0xFE;
        break;
 
-       /* CDROM control */
-       case 0x04:
-       case 0x05:
-       case 0x06:
-       case 0x07:
-       v = akiko_get_long (cdrom_status1, addr - 0x04);
-       break;
-       case 0x08:
-       case 0x09:
-       case 0x0a:
-       case 0x0b:
-       v = akiko_get_long (cdrom_status2, addr - 0x08);
-       break;
-       case 0x10:
-       case 0x11:
-       case 0x12:
-       case 0x13:
-       v = akiko_get_long (cdrom_address1, addr - 0x10);
-       break;
-       case 0x14:
-       case 0x15:
-       case 0x16:
-       case 0x17:
-       v = akiko_get_long (cdrom_address2, addr - 0x14);
-       break;
-       case 0x18:
-       v = cdrom_status3;
-       break;
-       case 0x19:
-       v = cdrom_command_offset_complete;
-       break;
-       case 0x1a:
-       v = cdrom_result_complete;
-       break;
-       case 0x1f:
-       v = cdrom_result_last_pos;
-       break;
-       case 0x20:
-       case 0x21:
-       v = akiko_get_long (cdrom_readmask_r, addr - 0x20 + 2);
-       break;
-       case 0x24:
-       case 0x25:
-       case 0x26:
-       case 0x27:
-       v = akiko_get_long (cdrom_longmask, addr - 0x24);
-       break;
+       if (currprefs.cs_cd32cd) {
+           /* CDROM control */
+           case 0x04:
+           case 0x05:
+           case 0x06:
+           case 0x07:
+           v = akiko_get_long (cdrom_status1, addr - 0x04);
+           break;
+           case 0x08:
+           case 0x09:
+           case 0x0a:
+           case 0x0b:
+           v = akiko_get_long (cdrom_status2, addr - 0x08);
+           break;
+           case 0x10:
+           case 0x11:
+           case 0x12:
+           case 0x13:
+           v = akiko_get_long (cdrom_address1, addr - 0x10);
+           break;
+           case 0x14:
+           case 0x15:
+           case 0x16:
+           case 0x17:
+           v = akiko_get_long (cdrom_address2, addr - 0x14);
+           break;
+           case 0x18:
+           v = cdrom_status3;
+           break;
+           case 0x19:
+           v = cdrom_command_offset_complete;
+           break;
+           case 0x1a:
+           v = cdrom_result_complete;
+           break;
+           case 0x1f:
+           v = cdrom_result_last_pos;
+           break;
+           case 0x20:
+           case 0x21:
+           v = akiko_get_long (cdrom_readmask_r, addr - 0x20 + 2);
+           break;
+           case 0x24:
+           case 0x25:
+           case 0x26:
+           case 0x27:
+           v = akiko_get_long (cdrom_longmask, addr - 0x24);
+           break;
+       } else if (addr < 0x30) {
+           break;
+       }
 
-       /* NVRAM */
-       case 0x30:
-       case 0x31:
-       case 0x32:
-       case 0x33:
-       v =  akiko_nvram_read (addr - 0x30);
-       break;
+        /* NVRAM */
+        case 0x30:
+        case 0x31:
+        case 0x32:
+        case 0x33:
+       if (currprefs.cs_cd32nvram)
+            v =  akiko_nvram_read (addr - 0x30);
+        break;
 
        /* C2P */
        case 0x38:
        case 0x39:
-       case 0x3a:
+       case 0x3a:
        case 0x3b:
-       v = akiko_c2p_read (addr - 0x38);
+       if (currprefs.cs_cd32c2p)
+           v = akiko_c2p_read (addr - 0x38);
        break;
 
        default:
@@ -1107,14 +1124,20 @@ uae_u32 akiko_bget2 (uaecptr addr, int msg)
     return v;
 }
 
-uae_u32 REGPARAM2 akiko_bget (uaecptr addr)
+static uae_u32 REGPARAM2 akiko_bget (uaecptr addr)
 {
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
     return akiko_bget2 (addr, 1);
 }
 
-uae_u32 REGPARAM2 akiko_wget (uaecptr addr)
+static uae_u32 REGPARAM2 akiko_wget (uaecptr addr)
 {
     uae_u16 v;
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
     addr &= 0xffff;
     v = akiko_bget2 (addr + 1, 0);
     v |= akiko_bget2 (addr + 0, 0) << 8;
@@ -1123,10 +1146,13 @@ uae_u32 REGPARAM2 akiko_wget (uaecptr addr)
     return v;
 }
 
-uae_u32 REGPARAM2 akiko_lget (uaecptr addr)
+static uae_u32 REGPARAM2 akiko_lget (uaecptr addr)
 {
     uae_u32 v;
 
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
     addr &= 0xffff;
     v = akiko_bget2 (addr + 3, 0);
     v |= akiko_bget2 (addr + 2, 0) << 8;
@@ -1137,7 +1163,7 @@ uae_u32 REGPARAM2 akiko_lget (uaecptr addr)
     return v;
 }
 
-void akiko_bput2 (uaecptr addr, uae_u32 v, int msg)
+static void akiko_bput2 (uaecptr addr, uae_u32 v, int msg)
 {
     uae_u32 tmp;
 
@@ -1148,78 +1174,84 @@ void akiko_bput2 (uaecptr addr, uae_u32 v, int msg)
     uae_sem_wait (&akiko_sem);
     switch (addr)
     {
-       case 0x04:
-       case 0x05:
-       case 0x06:
-       case 0x07:
-       akiko_put_long (&cdrom_status1, addr - 0x04, v);
-       break;
-       case 0x08:
-       case 0x09:
-       case 0x0a:
-       case 0x0b:
-       akiko_put_long (&cdrom_status2, addr - 0x08, v);
-       if (addr == 8)
-           cdrom_status1 &= cdrom_status2;
-       break;
-       case 0x10:
-       case 0x11:
-       case 0x12:
-       case 0x13:
-       akiko_put_long (&cdrom_address1, addr - 0x10, v);
-       break;
-       case 0x14:
-       case 0x15:
-       case 0x16:
-       case 0x17:
-       akiko_put_long (&cdrom_address2, addr - 0x14, v);
-       break;
-       case 0x18:
-       cdrom_status3 = v;
-       break;
-       case 0x19:
-       cdrom_command_offset_complete = v;
-       break;
-       case 0x1a:
-       cdrom_result_complete = v;
-       break;
-       case 0x1d:
-       cdrom_command_offset_todo = v;
-       break;
-       case 0x1f:
-       cdrom_result_last_pos = v;
-       break;
-       case 0x20:
-       cdrom_readmask_w |= (v << 8);
-       cdrom_readmask_r &= 0x00ff;
-       break;
-       case 0x21:
-       cdrom_readmask_w |= (v << 0);
-       cdrom_readmask_r &= 0xff00;
-       break;
-       case 0x24:
-       case 0x25:
-       case 0x26:
-       case 0x27:
-       tmp = cdrom_longmask;
-       akiko_put_long (&cdrom_longmask, addr - 0x24, v);
-       if ((cdrom_longmask & 0x04000000) && !(tmp & 0x04000000))
-           cdrom_sector_counter = 0;
-       break;
+       if (currprefs.cs_cd32cd) {
+           case 0x04:
+           case 0x05:
+           case 0x06:
+           case 0x07:
+           akiko_put_long (&cdrom_status1, addr - 0x04, v);
+           break;
+           case 0x08:
+           case 0x09:
+           case 0x0a:
+           case 0x0b:
+           akiko_put_long (&cdrom_status2, addr - 0x08, v);
+           if (addr == 8)
+               cdrom_status1 &= cdrom_status2;
+           break;
+           case 0x10:
+           case 0x11:
+           case 0x12:
+           case 0x13:
+           akiko_put_long (&cdrom_address1, addr - 0x10, v);
+           break;
+           case 0x14:
+           case 0x15:
+           case 0x16:
+           case 0x17:
+           akiko_put_long (&cdrom_address2, addr - 0x14, v);
+           break;
+           case 0x18:
+           cdrom_status3 = v;
+           break;
+           case 0x19:
+           cdrom_command_offset_complete = v;
+           break;
+           case 0x1a:
+           cdrom_result_complete = v;
+           break;
+           case 0x1d:
+           cdrom_command_offset_todo = v;
+           break;
+           case 0x1f:
+           cdrom_result_last_pos = v;
+           break;
+           case 0x20:
+           cdrom_readmask_w |= (v << 8);
+           cdrom_readmask_r &= 0x00ff;
+           break;
+           case 0x21:
+           cdrom_readmask_w |= (v << 0);
+           cdrom_readmask_r &= 0xff00;
+           break;
+           case 0x24:
+           case 0x25:
+           case 0x26:
+           case 0x27:
+           tmp = cdrom_longmask;
+           akiko_put_long (&cdrom_longmask, addr - 0x24, v);
+           if ((cdrom_longmask & 0x04000000) && !(tmp & 0x04000000))
+               cdrom_sector_counter = 0;
+           break;
+       } else if (addr < 0x30) {
+           break;
+       }
 
-       case 0x30:
-       case 0x31:
-       case 0x32:
-       case 0x33:
-       akiko_nvram_write (addr - 0x30, v);
+        case 0x30:
+        case 0x31:
+        case 0x32:
+        case 0x33:
+           if (currprefs.cs_cd32nvram)
+               akiko_nvram_write (addr - 0x30, v);
        break;
 
-       case 0x38:
-       case 0x39:
-       case 0x3a:
-       case 0x3b:
-       akiko_c2p_write (addr - 0x38, v);
-       break;
+        case 0x38:
+        case 0x39:
+        case 0x3a:
+        case 0x3b:
+           if (currprefs.cs_cd32c2p)
+               akiko_c2p_write (addr - 0x38, v);
+        break;
 
        default:
        write_log ("akiko_bput: unknown address %08.8X\n", addr);
@@ -1229,13 +1261,19 @@ void akiko_bput2 (uaecptr addr, uae_u32 v, int msg)
     uae_sem_post (&akiko_sem);
 }
 
-void REGPARAM2 akiko_bput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 akiko_bput (uaecptr addr, uae_u32 v)
 {
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
     akiko_bput2 (addr, v, 1);
 }
 
-void REGPARAM2 akiko_wput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 akiko_wput (uaecptr addr, uae_u32 v)
 {
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
     addr &= 0xfff;
     if((addr < 0x30 && AKIKO_DEBUG_IO))
        write_log("akiko_wput %08.8X: %08.8X=%04.4X\n", m68k_getpc(), addr, v & 0xffff);
@@ -1243,8 +1281,11 @@ void REGPARAM2 akiko_wput (uaecptr addr, uae_u32 v)
     akiko_bput2 (addr + 0, v >> 8, 0);
 }
 
-void REGPARAM2 akiko_lput (uaecptr addr, uae_u32 v)
+static void REGPARAM2 akiko_lput (uaecptr addr, uae_u32 v)
 {
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
     addr &= 0xffff;
     if(addr < 0x30 && AKIKO_DEBUG_IO)
        write_log("akiko_lput %08.8X: %08.8X=%08.8X\n", m68k_getpc(), addr, v);
@@ -1254,6 +1295,13 @@ void REGPARAM2 akiko_lput (uaecptr addr, uae_u32 v)
     akiko_bput2 (addr + 0, (v >> 24) & 0xff, 0);
 }
 
+addrbank akiko_bank = {
+    akiko_lget, akiko_wget, akiko_bget,
+    akiko_lput, akiko_wput, akiko_bput,
+    default_xlate, default_check, NULL, "Akiko",
+    dummy_lgeti, dummy_wgeti, ABFLAG_IO
+};
+
 static uae_thread_id akiko_tid;
 
 static void akiko_cdrom_free (void)
@@ -1319,7 +1367,7 @@ void akiko_free (void)
 
 int akiko_init (void)
 {
-    if (cdromok == 0) {
+    if (currprefs.cs_cd32cd && cdromok == 0) {
        unitnum = -1;
        if (!device_func_init(DEVICE_TYPE_ANY)) {
            write_log ("no CDROM support\n");
@@ -1461,7 +1509,7 @@ uae_u8 *restore_akiko(uae_u8 *src)
 
 void restore_akiko_finish(void)
 {
-    if (!cd32_enabled)
+    if (!currprefs.cs_cd32cd)
        return;
     akiko_c2p_do ();
     sys_command_cd_pause (DF_IOCTL, unitnum, 0);
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/ar.c b/ar.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/audio.c b/audio.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index c258d08..7fb1888
--- a/blkdev.c
+++ b/blkdev.c
@@ -212,6 +212,19 @@ int sys_command_write (int mode, int unitnum, int offset)
     return device_func[DF_IOCTL]->write (unitnum, offset);
 }
 
+int sys_command_ismedia (int mode, int unitnum)
+{
+    struct device_info di;
+
+    if (mode == DF_SCSI || !have_ioctl || !device_func[DF_IOCTL]->ismedia) {
+        memset(&di, 0, sizeof di);
+       device_func[DF_SCSI]->info (unitnum, &di);
+       return di.media_inserted;
+    } else {
+       return device_func[DF_IOCTL]->ismedia (unitnum);
+    }
+}
+
 struct device_info *sys_command_info (int mode, int unitnum, struct device_info *di)
 {
     if (mode == DF_SCSI || !have_ioctl)
old mode 100755 (executable)
new mode 100644 (file)
index f3fb03a..8116283
@@ -245,14 +245,16 @@ void releasesock (SB, int sd)
 
 /* Signal queue */
 /* @@@ TODO: ensure proper interlocking */
-#if 0
+#if 1
 struct socketbase *sbsigqueue;
 volatile int bsd_int_requested;
 #endif
 
 void addtosigqueue (SB, int events)
 {
+#if 0
     uae_u32 ot, sts;
+#endif
 
     locksigqueue ();
 
@@ -260,7 +262,7 @@ void addtosigqueue (SB, int events)
        sb->sigstosend |= sb->eventsigs;
     else
        sb->sigstosend |= ((uae_u32) 1) << sb->signal;
-#if 0
+#if 1
     if (!sb->dosignal) {
        sb->nextsig = sbsigqueue;
        sbsigqueue = sb;
@@ -268,7 +270,10 @@ void addtosigqueue (SB, int events)
     sb->dosignal = 1;
 
     bsd_int_requested = 1;
-#endif
+
+    unlocksigqueue ();
+
+#else
 
     ot = sb->ownertask;
     sts = sb->sigstosend;
@@ -279,11 +284,36 @@ void addtosigqueue (SB, int events)
 
     if (sts)
        uae_Signal(ot, sts);
+#endif
 
-    //INTREQ (0x8000 | 0x2000);
 }
 
-#if 0
+#if 1
+void bsdsock_fake_int_handler(void)
+{
+    locksigqueue ();
+
+    bsd_int_requested = 0;
+
+    if (sbsigqueue != NULL) {
+        SB;
+
+       for (sb = sbsigqueue; sb; sb = sb->nextsig) {
+           if (sb->dosignal == 1) {
+               uae_Signal(sb->ownertask, sb->sigstosend);
+               sb->sigstosend = 0;
+           }
+           sb->dosignal = 0;
+       }
+
+       sbsigqueue = NULL;
+    }
+
+    unlocksigqueue ();
+}
+
+#else
+
 static uae_u32 REGPARAM2 bsdsock_int_handler (TrapContext *context)
 {
     SB;
@@ -334,7 +364,7 @@ void waitsig (TrapContext *context, SB)
 
 void cancelsig (TrapContext *context, SB)
 {
-#if 0
+#if 1
     locksigqueue ();
     if (sb->dosignal)
        sb->dosignal = 2;
@@ -442,7 +472,7 @@ static void free_socketbase (TrapContext *context)
            }
        }
 
-#if 0
+#if 1
        if (sb == sbsigqueue)
            sbsigqueue = sb->next;
        else {
@@ -1411,7 +1441,7 @@ void bsdlib_reset (void)
     }
 
     socketbases = NULL;
-#if 0
+#if 1
     sbsigqueue = NULL;
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index f3ca014..3a13586
@@ -598,7 +598,7 @@ int catweasel_init(void)
     if (cwc.can_joy)
        catweasel_do_bput(0xcc, 0); // joystick buttons = input
 
-    catweasel_init_controller(&cwc);
+    //catweasel_init_controller(&cwc);
     sprintf(tmp, "CW: Catweasel MK%d @%p (%s) enabled.",
        cwc.type, (uae_u8*)cwc.iobase, name);
     if (cwc.can_sid) {
@@ -669,6 +669,8 @@ int catweasel_detect (void)
     return FALSE;
 }
 
+#if 0
+
 #define outb(v,port) catweasel_do_bput(port,v)
 #define inb(port) catweasel_do_bget(port)
 
@@ -1340,4 +1342,4 @@ int catweasel_read(catweasel_drive *d, int side, int clock, int rawmode)
 
 #endif
 
-
+#endif
\ No newline at end of file
diff --git a/cdrom.c b/cdrom.c
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/cdtv.c b/cdtv.c
old mode 100755 (executable)
new mode 100644 (file)
index 8190238..afacdd0
--- a/cdtv.c
+++ b/cdtv.c
   *
   * CDTV DMAC/CDROM controller emulation
   *
-  * Copyright 2004 Toni Wilen
+  * Copyright 2004/2007 Toni Wilen
+  *
+  * Thanks to Mark Knibbs <markk@clara.co.uk> for CDTV Technical information
   *
   */
 
-#define CDTV_DEBUG
+//#define CDTV_DEBUG
+#define CDTV_DEBUG_CMD
+//#define CDTV_DEBUG_6525
 
 #include "sysconfig.h"
 #include "sysdeps.h"
 
 #include "options.h"
-#include "uae.h"
 #include "memory.h"
 #include "custom.h"
 #include "newcpu.h"
 #include "debug.h"
 #include "cdtv.h"
+#include "blkdev.h"
+#include "gui.h"
+#include "zfile.h"
+#include "threaddep/thread.h"
+
+static smp_comm_pipe requests;
+static volatile int thread_alive;
+
+static int configured;
+static uae_u8 dmacmemory[100];
+
+#define        MAX_TOC_ENTRIES 103
+static uae_u8 cdrom_toc[MAX_TOC_ENTRIES * 13];
+static uae_u32 last_cd_position;
+static uae_u8 cdrom_qcode[16];
+static int datatrack;
+
+static volatile int cdtv_command_len;
+static volatile uae_u8 cdtv_command_buf[6];
+static volatile uae_u8 dmac_istr, dmac_cntr;
+static volatile uae_u16 dmac_dawr;
+static volatile uae_u32 dmac_acr, dmac_wtc;
+static volatile int dmac_dma;
+
+static volatile int activate_stch, cdrom_command_done;
+static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset;
+static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error;
+
+static volatile int cdtv_hsync, dma_wait, dma_finished;
+
+int cdtv_enabled;
+
+static void do_stch(void);
+
+static void INT2(void)
+{
+    INTREQ(0x8000 | 0x0008);
+}
+
+static int cdrom_command_cnt_out, cdrom_command_size_out;
+static uae_u8 cdrom_command_output[16];
+
+static volatile int stch, sten, scor, sbcp;
+static volatile int cmd, enable, xaen, dten;
+
+static int unitnum = -1;
+
+/* convert minutes, seconds and frames -> logical sector number */
+static int msf2lsn (int        msf)
+{
+    int sector = ((msf >> 16) & 0xff) * 60 * 75 + ((msf >> 8) & 0xff) * 75 + ((msf >> 0) & 0xff);
+    if (sector < 0)
+       sector = 0;
+    return sector;
+}
+
+/* convert logical sector number -> minutes, seconds and frames */
+static int lsn2msf (int        sectors)
+{
+    int msf;
+    msf = (sectors / (75 * 60)) << 16;
+    msf |= ((sectors / 75) % 60) << 8;
+    msf |= (sectors % 75) << 0;
+    return msf;
+}
+
+static int get_toc(void)
+{
+    uae_u8 *buf;
+    int i;
+    
+    datatrack = 0;
+    buf = sys_command_cd_toc (DF_IOCTL, unitnum);
+    if (!buf)
+       return 0;
+    i = (buf[0] << 8) | (buf[1] << 0);
+    memcpy (cdrom_toc, buf, i);
+    last_cd_position = (buf[4 + 2 * 11 + 8] << 16) | (buf[4 + 2 * 11 + 9] << 8) | (buf[4 + 2 * 11 + 10] << 0);
+    last_cd_position = lsn2msf(msf2lsn(last_cd_position) - 1);
+    if (buf[4 + 3 * 11 + 3] == 1 && (buf[4 + 3 * 11 + 1] & 0x0f) == 0x04)
+       datatrack = 1;
+    return 1;
+}
+
+static int get_qcode(void)
+{
+    uae_u8 *s;
+    static uae_u8 subq0;
+
+    memset (cdrom_qcode, 0, 16);
+    s = sys_command_cd_qcode (DF_IOCTL, unitnum);
+    if (!s)
+       return 0;
+    memcpy (cdrom_qcode, s, 16);
+    if (s[1] != subq0) {
+       subq0 = s[1];
+       do_stch();
+    }
+    return 1;
+}
+
+static void cdaudiostop(void)
+{
+    cd_playing = 0;
+    cd_paused = 0;
+    cd_motor = 0;
+    if (unitnum < 0)
+       return;
+    sys_command_cd_pause (DF_IOCTL, unitnum, 0);
+    sys_command_cd_stop (DF_IOCTL, unitnum);
+}
+
+static int pause_audio (int pause)
+{
+    sys_command_cd_pause (DF_IOCTL, unitnum, pause);
+    cd_paused = pause;
+    return 1;
+}
+
+static int read_sectors(int start, int length)
+{
+    write_log("READ DATA sector %d, %d sectors\n", start, length);
+    cdrom_sector = start;
+    cdrom_sectors = length;
+    cdrom_offset = start * 2048;
+    cdrom_length = length * 2048;
+    cd_motor = 1;
+    if (cd_playing)
+       cdaudiostop();
+    return 0;
+}
+
+static int ismedia(void)
+{
+    if (unitnum < 0)
+       return 0;
+    return sys_command_ismedia (DF_IOCTL, unitnum);
+}
+
+static int play_cdtrack (uae_u8 *p)
+{
+    int track_start = p[1];
+    int index_start = p[2];
+    int track_end = p[3];
+    int index_end = p[4];
+    uae_u32 start, end;
+    int i, j;
+
+    i = (cdrom_toc[0] << 8) | (cdrom_toc[1] << 0);
+    i -= 2;
+    i /= 11;
+    for (j = 0; j < i; j++) {
+        uae_u8 *s = cdrom_toc + 4 + j * 11;
+       if (track_start == s[3])
+           start = (s[8] << 16) | (s[9] << 8) | s[10];
+       if (track_end == s[3]) {
+//         s += 11;
+//         if (j == i - 1)
+//             s = cdrom_toc + 4 + 2 * 11; /* end position */
+           end = (s[8] << 16) | (s[9] << 8) | s[10];
+       }
+    }
+    sys_command_cd_pause (DF_IOCTL, unitnum, 0);
+    write_log("PLAY CD AUDIO from %d-%d (%06.6X to %06.6X)\n",
+       track_start, track_end, start, end);
+    if (sys_command_cd_play (DF_IOCTL, unitnum, start, end, 0)) {
+       cd_playing = 1;
+       cd_motor = 1;
+    }
+    return 0;
+}
+
+static int play_cd(uae_u8 *p)
+{
+    uae_u32 start, end;
+
+    start = (p[1] << 16) | (p[2] << 8) | p[3];
+    end = (p[4] << 16) | (p[5] << 8) | p[6];
+    if (start == 0 && end == 0) {
+       cdaudiostop();
+       return 0;
+    }
+    if (end == 0x00ffffff)
+       end = last_cd_position;
+    if (p[0] == 0x09) {
+       start = lsn2msf (start);
+       end = lsn2msf (end);
+    }
+    write_log("PLAY CD AUDIO from %06.6X to %06.6X\n", start, end);
+    sys_command_cd_pause (DF_IOCTL, unitnum, 0);
+    if (sys_command_cd_play (DF_IOCTL, unitnum, start, end, 0)) {
+       cd_playing = 1;
+       cd_motor = 1;
+    }
+    return 0;
+}
+
+static int cdrom_subq(uae_u8 *out, int msflsn)
+{
+    uae_u8 *s = cdrom_qcode;
+    uae_u32 trackposlsn, trackposmsf;
+    uae_u32 diskposlsn, diskposmsf;
+
+    get_qcode();
+    out[0] = s[1];
+    s += 4;
+    out[1] = s[1];
+    out[2] = s[2];
+    out[3] = s[3];
+    trackposmsf = (s[9] << 16) | (s[10] << 8) | s[11];
+    diskposmsf = (s[5] << 16) | (s[6] << 8) | s[7];
+    trackposlsn = msf2lsn (trackposmsf);
+    diskposlsn = msf2lsn (diskposmsf);
+    out[4] = 0;
+    out[5] = (msflsn ? diskposmsf : diskposlsn) >> 16;
+    out[6] = (msflsn ? diskposmsf : diskposlsn) >> 8;
+    out[7] = (msflsn ? diskposmsf : diskposlsn) >> 0;
+    out[8] = 0;
+    out[9] = (msflsn ? trackposmsf : trackposlsn) >> 16;
+    out[10] = (msflsn ? trackposmsf : trackposlsn) >> 8;
+    out[11] = (msflsn ? trackposmsf : trackposlsn) >> 0;
+    out[12] = 0;
+    return 13;
+}
+
+static int cdrom_info(uae_u8 *out)
+{
+    uae_u8 *p;
+    uae_u32 size;
+
+    if (!ismedia())
+       return -1;
+    cd_motor = 1;
+    out[0] = cdrom_toc[2];
+    out[1] = cdrom_toc[3];
+    p = cdrom_toc + 4 + 2 * 11;
+    size =  ((p[8] << 16) | (p[9] << 8) | p[10]);
+    out[2] = size >> 16;
+    out[3] = size >> 8;
+    out[4] = size >> 0; 
+    return 5;
+}
+
+static int read_toc(int track, int msflsn, uae_u8 *out)
+{
+    uae_u8 *buf = cdrom_toc, *s;
+    int i, j;
+
+    if (!ismedia())
+       return -1;
+    if (!out)
+       return 0;
+    cd_motor = 1;
+    i = (buf[0] << 8) | (buf[1] << 0);
+    i -= 2;
+    i /= 11;
+    for (j = 0; j < i; j++) {
+        s = buf + 4 + j * 11;
+       if (track == s[3]) {
+           uae_u32 msf = (s[8] << 16) | (s[9] << 8) | s[10];
+           uae_u32 lsn = msf2lsn (msf);
+           out[0] = 0;
+           out[1] = s[1];
+           out[2] = s[3];
+           out[3] = track == 0 ? buf[3] : 0;
+           out[4] = 0;
+           out[5] = (msflsn ? msf : lsn) >> 16;
+           out[6] = (msflsn ? msf : lsn) >> 8;
+           out[7] = (msflsn ? msf : lsn) >> 0;
+           return 8;
+       }
+    }
+    return -1;
+}
+
+static void cdrom_command_accepted(int size, uae_u8 *cdrom_command_input, int *cdrom_command_cnt_in)
+{
+#ifdef CDTV_DEBUG_CMD
+    char tmp[200];
+    int i;
+#endif
+    cdrom_command_size_out = size;
+#ifdef CDTV_DEBUG_CMD
+    tmp[0] = 0;
+    for (i = 0; i < *cdrom_command_cnt_in; i++)
+       sprintf(tmp + i * 3, "%02.2X%c", cdrom_command_input[i], i < *cdrom_command_cnt_in - 1 ? '.' : ' ');
+    write_log("CD<-: %s\n", tmp);
+    if (size > 0) {
+       tmp[0] = 0;
+       for (i = 0; i < size; i++)
+           sprintf(tmp + i * 3, "%02.2X%c", cdrom_command_output[i], i < size - 1 ? '.' : ' ');
+       write_log("CD->: %s\n", tmp);
+    }
+#endif
+    *cdrom_command_cnt_in = 0;
+    cdrom_command_cnt_out = 0;
+    cdrom_command_done = 1;
+}
+
+static void cdrom_command_thread(uae_u8 b)
+{
+    static uae_u8 cdrom_command_input[16];
+    static int cdrom_command_cnt_in;
+    uae_u8 *s;
+
+    cdrom_command_input[cdrom_command_cnt_in] = b;
+    cdrom_command_cnt_in++;
+    s = cdrom_command_input;
+
+    switch (cdrom_command_input[0])
+    {
+       case 0x01: /* seek */
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x02: /* read */
+       if (cdrom_command_cnt_in == 7) {
+           read_sectors((s[1] << 16) | (s[2] << 8) | (s[3] << 0), (s[4] << 8) | (s[5] << 0));
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x04: /* motor on */
+       if (cdrom_command_cnt_in == 7) {
+           cd_motor = 1;
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x05: /* motor off */
+       if (cdrom_command_cnt_in == 7) {
+           cd_motor = 0;
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x09: /* play (lsn) */
+       case 0x0a: /* play (msf) */
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(play_cd(cdrom_command_input), s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x0b:
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(play_cdtrack(cdrom_command_input), s, &cdrom_command_cnt_in);
+       }
+       break;
+        case 0x81:
+        if (cdrom_command_cnt_in == 1) {
+           uae_u8 flag = 1 << 0;
+           flag |= 1 << 3;
+           if (cd_playing)
+               flag |= 1 << 2;
+           if (cd_error)
+               flag |= 1 << 4;
+           if (cd_motor)
+               flag |= 1 << 5;
+           if (cd_media)
+               flag |= 1 << 6;
+           cdrom_command_output[0] = flag;
+           cdrom_command_accepted(1, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x82:
+       if (cdrom_command_cnt_in == 7) {
+           if (cd_error)
+               cdrom_command_output[2] |= 1 << 4;
+           cd_error = 0;
+           cdrom_command_accepted(6, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x84:
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x87: /* subq */
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(cdrom_subq (cdrom_command_output, cdrom_command_input[1] & 2), s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x89:
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(cdrom_info(cdrom_command_output), s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x8a: /* read toc */
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(read_toc(cdrom_command_input[2], cdrom_command_input[1] & 2, cdrom_command_output), s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0x8b:
+       if (cdrom_command_cnt_in == 7) {
+           pause_audio (s[1] == 0x00 ? 1 : 0);
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       case 0xa3: /* front panel */
+       if (cdrom_command_cnt_in == 7) {
+           cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       }
+       break;
+       default:
+       write_log("unknown CDROM command %02.2X!\n", s[0]);
+       cd_error = 1;
+       cdrom_command_accepted(0, s, &cdrom_command_cnt_in);
+       break;
+    }
+}
+
+#define CNTR_INTEN (1 << 4)
+#define CNTR_PREST (1 << 6)
+#define CNTR_TCEN (1 << 7)
+
+#define ISTR_INT_P (1 << 4)
+#define ISTR_E_INT (1 << 5)
+
+static void dma_do_thread(void)
+{
+    static int readsector;
+    uae_u8 *p = NULL;
+
+#ifdef CDTV_DEBUG
+    write_log("DMAC DMA: sector=%d, cnt=%d, addr=%08.8X, %d\n",
+       cdrom_sector, cdrom_sectors, dmac_acr, dmac_wtc);
+#endif
+    dma_wait += dmac_wtc * 312 * 50 / 75 + 1;
+    while (dmac_wtc > 0 && dmac_dma) {
+       if (!p || readsector != (cdrom_offset / 2048)) {
+           readsector = cdrom_offset / 2048;
+           p = sys_command_cd_read (DF_IOCTL, unitnum, readsector);
+           if (!p) {
+               cd_error = 1;
+               activate_stch = 1;
+               write_log ("CDTV: CD read error!\n");
+               break;
+           }
+
+       }
+        put_byte (dmac_acr, p[(cdrom_offset % 2048) + 0]);
+        put_byte (dmac_acr + 1, p[(cdrom_offset % 2048) + 1]);
+        dmac_wtc--;
+        dmac_acr+=2;
+        cdrom_length-=2;
+       cdrom_offset+=2;
+    }
+    dmac_dma = 0;
+    dma_finished = 1;
+}
+    
+static void *dev_thread (void *p)
+{
+    write_log("CDTV: CD thread started\n");
+    for (;;) {
+
+       uae_u32 b = read_comm_pipe_u32_blocking (&requests);
+       if (unitnum < 0) {
+           thread_alive = -1;
+           return NULL;
+       }
+       switch (b)
+       {
+           case 0x100:
+           dma_do_thread();
+           break;
+           case 0x101:
+           {
+               get_qcode();
+               if (ismedia() != cd_media) {
+                   cd_media = ismedia();
+                   get_toc();
+                   activate_stch = 1;
+               }
+           }
+           break;
+           case 0x102: // pause
+           sys_command_cd_pause (DF_IOCTL, unitnum, 1);
+           break;
+           case 0x103: // unpause
+           sys_command_cd_pause (DF_IOCTL, unitnum, 0);
+           break;
+           case 0xffff:
+           thread_alive = -1;
+           return NULL;
+           default:
+           cdrom_command_thread (b);
+           break;
+       }
+
+    }
+}
+
+static void cdrom_command(uae_u8 b)
+{
+    write_comm_pipe_u32 (&requests, b, 1);
+}
+
+static uae_u8 tp_a, tp_b, tp_c, tp_ad, tp_bd, tp_cd;
+static uae_u8 tp_imr, tp_cr, tp_air;
+
+static void tp_check_interrupts(void)
+{
+    if ((tp_cr & 1) != 1)
+       return;
+
+    if (sten == 1) {
+       if (!(tp_air & (1 << 3)) && (tp_cd & (1 << 3))) {
+           tp_air |= 1 << 3;
+           INT2();
+       }
+    }
+}
+
+
+static void tp_bput (int addr, uae_u8 v)
+{
+#ifdef CDTV_DEBUG_6525
+    write_log("6525 write %x=%02.2X PC=%x\n", addr, v, M68K_GETPC);
+#endif
+    switch (addr)
+    {
+       case 0:
+       tp_a = v;
+       break;
+       case 1:
+       tp_b = v;
+       break;
+       case 2:
+       tp_c = v;
+       break;
+       case 3:
+       tp_ad = v;
+       break;
+       case 4:
+       tp_bd = v;
+       break;
+       case 5:
+       tp_cd = v;
+       break;
+       case 6:
+       tp_cr = v;
+       break;
+       case 7:
+       tp_air = v;
+       break;
+    }
+    cmd = (tp_b >> 0) & 1;
+    enable = (tp_b >> 1) & 1;
+    xaen = (tp_b >> 2) & 1;
+    dten = (tp_b >> 3) & 1;
+#if 0
+    if (cmd == 1 && enable == 1 && cdrom_command_size_out && cdrom_command_cnt_out < cdrom_command_size_out) {
+       sten = 0;
+       tp_check_interrupts();
+    }
+#endif
+}
+
+static uae_u8 tp_bget(int addr)
+{
+    uae_u8 v = 0;
+    switch (addr)
+    {
+       case 0:
+       v = tp_a;
+       write_log("TPA read!\n");
+       break;
+       case 1:
+       v = tp_b;
+       break;
+       case 2:
+        v = (sbcp << 0) | ((scor ^ 1) << 1) | ((stch ^ 1) << 2) | (sten << 3);
+       if (tp_cr & 1) {
+           if (!v)
+               v |= 1 << 5; // /IRQ
+       } else {
+           v |= tp_c & ~(0x80 | 0x40);
+       }
+       v |= tp_c & (0x80 | 0x40);
+       sbcp = 0;
+       break;
+       case 3:
+       v = tp_ad;
+       break;
+       case 4:
+       v = tp_bd;
+       break;
+       case 5:
+       v = tp_cd;
+       break;
+       case 6:
+       v = tp_cr;
+       break;
+       case 7:
+       v = tp_air;
+       tp_air = 0;
+       break;
+    }
+
+#ifdef CDTV_DEBUG_6525
+    if (addr < 7)
+       write_log("6525 read %x=%02.2X PC=%x\n", addr, v, M68K_GETPC);
+#endif
+    return v;
+}
 
 static uae_u32 REGPARAM3 dmac_lget (uaecptr) REGPARAM;
 static uae_u32 REGPARAM3 dmac_wget (uaecptr) REGPARAM;
@@ -27,63 +633,129 @@ static void REGPARAM3 dmac_lput (uaecptr, uae_u32) REGPARAM;
 static void REGPARAM3 dmac_wput (uaecptr, uae_u32) REGPARAM;
 static void REGPARAM3 dmac_bput (uaecptr, uae_u32) REGPARAM;
 
-static uae_u8 dmacmemory[0x100];
-static uae_u8 wd[0x1f];
+static void dmac_start_dma(void)
+{
+    write_comm_pipe_u32 (&requests, 0x100, 1);
+}
+
+void CDTV_hsync_handler(void)
+{
+    static int subqcnt;
+
+    if (!currprefs.cs_cdtvcd)
+       return;
+
+    cdtv_hsync++;
+
+    if (dma_wait >= 1024)
+       dma_wait -= 1024;
+    if (dma_wait >= 0 && dma_wait < 1024 && dma_finished) {
+        if ((dmac_cntr & (CNTR_INTEN | CNTR_TCEN)) == (CNTR_INTEN | CNTR_TCEN)) {
+           dmac_istr |= ISTR_INT_P | ISTR_E_INT;
+           INT2();
+       }
+       dma_finished = 0;
+       cdtv_hsync = -1;
+    }
+
+    if (cdrom_command_done) {
+       cdrom_command_done = 0;
+       sten = 1;
+       tp_check_interrupts();
+    }
+
+    if (cdtv_hsync < 312 * 50 / 75 && cdtv_hsync >= 0)
+       return;
+    cdtv_hsync = 0;
 
-static int cdtv_command_len;
-static uae_u8 cdtv_command_buf[6];
+    if (cd_playing)
+       gui_cd_led (1);
+    if (cd_media && (tp_cr & 1)) {
+       if (!(tp_air & (1 << 1))) {
+           tp_air |= 1 << 1;
+           INT2();
+       }
+    }
 
-static void cdtv_do_interrupt (void)
+    subqcnt--;
+    if (subqcnt < 0) {
+        write_comm_pipe_u32 (&requests, 0x0101, 1);
+       if (activate_stch)
+           do_stch();
+       subqcnt = 75;
+    }
+}
+
+static void do_stch(void)
 {
-    if (dmacmemory[0x41] & 0x10) {
-       write_log ("cdtv doint\n");
-       INTREQ (0x8008);
+    static int stch_cnt;
+    if ((tp_cr & 1) && !(tp_air & (1 << 2)) && (tp_cd & (1 << 2))) {
+       activate_stch = 0;
+       tp_air |= 1 << 2;
+       INT2();
+       write_log("STCH %d\n", stch_cnt++);
     }
 }
 
-static void cdtv_interrupt (void)
+void bleh(void)
 {
-    write_log ("cdtv int\n");
-    wd[0x1f] |= 0x80;
-    dmacmemory[0x41] |= (1 << 4) | (1 << 6); /* ISTR */
-    cdtv_do_interrupt ();
+    //do_stch();
 }
 
-static void write_register (uae_u8 b)
+static void cdtv_reset (void)
 {
-    switch (dmacmemory[0x91])
-    {
-       case 0x18:
-       write_log ("command=%02.2X\n", b);
-       cdtv_interrupt ();
-       break;
-    }
+    write_log("CDTV: reset\n");
+    cd_playing = cd_paused = 0;
+    cd_motor = 0;
+    cd_media = 0;
+    cd_error = 0;
+    stch = 0;
 }
 
 static uae_u32 dmac_bget2 (uaecptr addr)
 {
-    addr -= DMAC_START;
-    addr &= 65535;
+    uae_u8 v = 0;
+
+    if (addr < 0x40)
+       return dmacmemory[addr];
+
+    if (addr >= 0xb0 && addr < 0xc0)
+       return tp_bget ((addr - 0xb0) / 2);
+
     switch (addr)
     {
        case 0x41:
-       return 0x10|0x40;
-       case 0x91: /* AUXILIARY STATUS */
-       return 0x80 | 0x01;
-
-       case 0x93:
-       case 0xa3:
-       switch (dmacmemory[0x91])
-       {
-           case 0x17: /* SCSI STATUS */
-           return 0x22;
-
-           default:
-           return dmacmemory[0x93];
+       v = dmac_istr;
+       break;
+       case 0x43:
+       v = dmac_cntr;
+       break;
+       case 0xa1:
+       if (cdrom_command_cnt_out < 0) {
+           cd_error = 1;
+           do_stch();
+       } else {
+           v = cdrom_command_output[cdrom_command_cnt_out];
+           cdrom_command_output[cdrom_command_cnt_out++] = 0;
+           if (cdrom_command_cnt_out >= cdrom_command_size_out) {
+               stch = 1;
+               sten = 0;
+               cdrom_command_size_out = 0;
+               cdrom_command_cnt_out = -1;
+           } else {
+               sten = 1;
+               tp_check_interrupts();
+           }
        }
        break;
     }
-    return dmacmemory[addr];
+
+#ifdef CDTV_DEBUG
+    if (addr != 0x41)
+       write_log ("dmac_bget %04.4X=%02.2X PC=%08.8X\n", addr, v, M68K_GETPC);
+#endif
+
+    return v;
 }
 
 uae_u32 REGPARAM2 dmac_lget (uaecptr addr)
@@ -92,6 +764,7 @@ uae_u32 REGPARAM2 dmac_lget (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
+    addr &= 65535;
     v = (dmac_bget2 (addr) << 24) | (dmac_bget2 (addr + 1) << 16) |
        (dmac_bget2 (addr + 2) << 8) | (dmac_bget2 (addr + 3));
 #ifdef CDTV_DEBUG
@@ -106,6 +779,7 @@ uae_u32 REGPARAM2 dmac_wget (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
+    addr &= 65535;
     v = (dmac_bget2 (addr) << 8) | dmac_bget2 (addr + 1);
 #ifdef CDTV_DEBUG
     write_log ("dmac_wget %08.8X=%04.4X PC=%08.8X\n", addr, v, M68K_GETPC);
@@ -119,64 +793,96 @@ uae_u32 REGPARAM2 dmac_bget (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
+    addr &= 65535;
     v = dmac_bget2 (addr);
-#ifdef CDTV_DEBUG
-    write_log ("dmac_bget %08.8X=%02.2X PC=%08.8X\n", addr, v, M68K_GETPC);
-#endif
+    if (!configured)
+       return v;
     return v;
 }
 
 static void dmac_bput2 (uaecptr addr, uae_u32 b)
 {
-    int i;
+    if (addr >= 0xb0 && addr < 0xc0) {
+       tp_bput ((addr - 0xb0) / 2, b);
+       return;
+    }
 
-    addr -= DMAC_START;
-    addr &= 65535;
 #ifdef CDTV_DEBUG
-    dmacmemory[addr] = b;
+    write_log ("dmac_bput %04.4X=%02.2X PC=%08.8X\n", addr, b & 255, M68K_GETPC);
+#endif
+
     switch (addr)
     {
        case 0x43:
-       cdtv_do_interrupt ();
+       dmac_cntr = b;
+       if (dmac_cntr & CNTR_PREST)
+           cdtv_reset ();
        break;
-       case 0x93:
-       case 0xa3:
-       write_register (b);
+       case 0x80:
+       dmac_wtc &= 0x00ffffff;
+       dmac_wtc |= b << 24;
        break;
-       case 0xa1:
-       if ((dmacmemory[0xb3] & 3) == 0) { /* PRB /CMD and /ENABLE */
-           if (cdtv_command_len >= sizeof (cdtv_command_buf))
-               cdtv_command_len = sizeof (cdtv_command_buf) - 1;
-           cdtv_command_buf[cdtv_command_len++] = b;
-       } else {
-           cdtv_command_len = 0;
-       }
-       if (cdtv_command_len == 6)
-           cdtv_interrupt ();
+       case 0x81:
+       dmac_wtc &= 0xff00ffff;
+       dmac_wtc |= b << 16;
        break;
-       case 0xa5:
-       cdtv_command_len = 0;
+       case 0x82:
+       dmac_wtc &= 0xffff00ff;
+       dmac_wtc |= b << 8;
        break;
-       case 0xb3:
-       if (!(dmacmemory[0xb3] & 1) && (b & 1)) { /* command sent? */
-           write_log ("CMD: ");
-           for (i = 0; i < cdtv_command_len; i++) {
-               write_log ("%02.2X ", cdtv_command_buf[i]);
-           }
-           write_log("\n");
-       }
+       case 0x83:
+       dmac_wtc &= 0xffffff00;
+       dmac_wtc |= b << 0;
+       break;
+       case 0x84:
+       dmac_acr &= 0x00ffffff;
+       dmac_acr |= b << 24;
+       break;
+       case 0x85:
+       dmac_acr &= 0xff00ffff;
+       dmac_acr |= b << 16;
+       break;
+       case 0x86:
+       dmac_acr &= 0xffff00ff;
+       dmac_acr |= b << 8;
+       break;
+       case 0x87:
+       dmac_acr &= 0xffffff01;
+       dmac_acr |= (b & ~ 1) << 0;
+       break;
+       case 0x8e:
+       dmac_dawr &= 0x00ff;
+       dmac_dawr |= b << 8;
+       break;
+       case 0x8f:
+       dmac_dawr &= 0xff00;
+       dmac_dawr |= b << 0;
+       break;
+       case 0xa1:
+       cdrom_command(b);
        break;
        case 0xe0:
-       write_log ("DMA PTR=%x LEN=%d\n", dmac_lget (0x84), dmac_lget (0x80));
+       case 0xe1:
+       if (!dmac_dma) {
+           dmac_dma = 1;
+           dmac_start_dma();
+       }
+       break;
+       case 0xe2:
+       case 0xe3:
+       dmac_dma = 0;
        break;
-       case 0xe4: /* CINT */
-       dmacmemory[0x41] = 0;
+       case 0xe4:
+       case 0xe5:
+       dmac_istr = 0;
        break;
-       case 0xe8: /* FLUSH */
-       cdtv_command_len = 0;
+       case 0xe8:
+       case 0xe9:
+       dmac_dma = 0;
        break;
     }
-#endif
+
+    tp_check_interrupts();
 }
 
 static void REGPARAM2 dmac_lput (uaecptr addr, uae_u32 l)
@@ -184,6 +890,7 @@ static void REGPARAM2 dmac_lput (uaecptr addr, uae_u32 l)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
+    addr &= 65535;
 #ifdef CDTV_DEBUG
     write_log ("dmac_lput %08.8X=%08.8X PC=%08.8X\n", addr, l, M68K_GETPC);
 #endif
@@ -198,6 +905,7 @@ static void REGPARAM2 dmac_wput (uaecptr addr, uae_u32 w)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
+    addr &= 65535;
 #ifdef CDTV_DEBUG
     write_log ("dmac_wput %04.4X=%04.4X PC=%08.8X\n", addr, w & 65535, M68K_GETPC);
 #endif
@@ -210,21 +918,205 @@ static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-#ifdef CDTV_DEBUG
-    write_log ("dmac_bput %08.8X=%02.2X PC=%08.8X\n", addr, b & 255, M68K_GETPC);
-#endif
+    addr &= 65535;
+    if (addr == 0x48) {
+       map_banks (&dummy_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
+       map_banks (&dmac_bank, b, 0x10000 >> 16, 0x10000);
+       write_log ("CDTV DMAC autoconfigured at %02.2X0000\n", b & 0xff);
+       configured = 1;
+       return;
+    }
+    if (addr == 0x4c) {
+       map_banks (&dummy_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
+       write_log ("CDTV DMAC AUTOCONFIG SHUT-UP!\n");
+       configured = 1;
+    }
+    if (!configured)
+       return;
     dmac_bput2 (addr, b);
 }
 
-void dmac_init (void)
+static void open_unit(void)
+{
+    struct device_info di1, *di2;
+    int first = -1;
+    int cdtvunit = -1, audiounit = -1;
+
+    if (unitnum >= 0)
+       sys_command_close (DF_IOCTL, unitnum);
+    cdtv_reset();
+    unitnum = -1;
+    if (!device_func_init(DEVICE_TYPE_ANY)) {
+        write_log ("no CDROM support\n");
+        return;
+    }
+    for (unitnum = 0; unitnum < MAX_TOTAL_DEVICES; unitnum++) {
+       if (sys_command_open (DF_IOCTL, unitnum)) {
+           di2 = sys_command_info (DF_IOCTL, unitnum, &di1);
+           if (di2 && di2->type == INQ_ROMD) {
+               write_log ("%s: ", di2->label);
+               if (first < 0)
+                   first = unitnum;
+               if (get_toc () > 0) {
+                   if (datatrack) {
+                       uae_u8 *p = sys_command_cd_read (DF_IOCTL, unitnum, 16);
+                       if (p) {
+                           if (!memcmp (p + 8, "CDTV", 4)) {
+                               write_log ("CDTV\n");
+                               if (cdtvunit < 0)
+                                   cdtvunit = unitnum;
+                           }
+                       }
+                   } else {
+                       write_log("Audio CD\n");
+                       if (audiounit < 0)
+                           audiounit = unitnum;
+                   }
+               } else {
+                   write_log("TOC read failed\n");
+               }
+           }
+           sys_command_close (DF_IOCTL, unitnum);
+       }
+    }
+    unitnum = audiounit;
+    if (cdtvunit >= 0)
+       unitnum = cdtvunit;
+    if (unitnum < 0)
+       unitnum = first;
+    cd_media = 0;
+    if (unitnum >= 0) {
+       sys_command_open (DF_IOCTL, unitnum);
+       cd_media = ismedia();
+       if (!get_toc())
+           cd_media = 0;
+       cdaudiostop();
+    }
+}
+
+static void ew (int addr, uae_u32 value)
 {
-    dmacmemory[6] = ~(2 << 4); /* CDTV DMAC product id */
+    addr &= 0xffff;
+    if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) {
+       dmacmemory[addr] = (value & 0xf0);
+       dmacmemory[addr + 2] = (value & 0x0f) << 4;
+    } else {
+       dmacmemory[addr] = ~(value & 0xf0);
+       dmacmemory[addr + 2] = ~((value & 0x0f) << 4);
+    }
 }
 
 addrbank dmac_bank = {
     dmac_lget, dmac_wget, dmac_bget,
     dmac_lput, dmac_wput, dmac_bput,
-    default_xlate, default_check, NULL, "DMAC",
+    default_xlate, default_check, NULL, "CDTV CD Controller",
     dummy_lgeti, dummy_wgeti, ABFLAG_IO
 };
 
+
+void cdtv_entergui (void)
+{
+    if (cd_playing)
+       write_comm_pipe_u32 (&requests, 0x102, 1);
+}
+void cdtv_exitgui (void)
+{
+    if (cd_playing)
+       write_comm_pipe_u32 (&requests, 0x103, 1);
+}
+
+
+/* CDTV batterybacked RAM emulation */
+#define CDTV_NVRAM_MASK 16383
+#define CDTV_NVRAM_SIZE 16384
+static uae_u8 cdtv_battram[CDTV_NVRAM_SIZE];
+
+void cdtv_loadcardmem(uae_u8 *p, int size)
+{
+    struct zfile *f;
+
+    memset (p, 0, size);
+    f = zfile_fopen (currprefs.flashfile, "rb");
+    if (!f)
+       return;
+    zfile_fseek (f, CDTV_NVRAM_SIZE, SEEK_SET);
+    zfile_fread (p, size, 1, f);
+    zfile_fclose (f);
+}
+
+static void cdtv_battram_reset (void)
+{
+    struct zfile *f;
+
+    memset (cdtv_battram, 0, CDTV_NVRAM_SIZE);
+    f = zfile_fopen (currprefs.flashfile, "rb");
+    if (!f) {
+        f = zfile_fopen (currprefs.flashfile, "wb");
+       if (f) {
+           zfile_fwrite (cdtv_battram, CDTV_NVRAM_SIZE, 1, f);
+           zfile_fclose (f);
+       }
+       return;
+    }
+    zfile_fread (cdtv_battram, CDTV_NVRAM_SIZE, 1, f);
+    zfile_fclose (f);
+}
+
+void cdtv_battram_write (int addr, int v)
+{
+    struct zfile *f;
+    int offset = addr & CDTV_NVRAM_MASK;
+
+    if (offset >= CDTV_NVRAM_SIZE)
+       return;
+    if (cdtv_battram[offset] == v)
+       return;
+    cdtv_battram[offset] = v;
+    f = zfile_fopen (currprefs.flashfile, "rb+");
+    if (!f)
+       return;
+    zfile_fseek (f, offset, SEEK_SET);
+    zfile_fwrite (cdtv_battram + offset, 1, 1, f);
+    zfile_fclose (f);
+}
+
+uae_u8 cdtv_battram_read (int addr)
+{
+    uae_u8 v;
+    int offset;
+    offset = addr & CDTV_NVRAM_MASK;
+    if (offset >= CDTV_NVRAM_SIZE)
+       return 0;
+    v = cdtv_battram[offset];
+    return v;
+}
+
+
+void dmac_init (void)
+{
+    if (!thread_alive) {
+        uae_thread_id tid;
+       init_comm_pipe (&requests, 100, 1);
+       uae_start_thread (dev_thread, NULL, &tid);
+    }
+
+    configured = 0;
+    tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0;
+    tp_imr = tp_cr = tp_air = 0;
+    stch = 1;
+    sten = 1;
+    scor = 1;
+    sbcp = 0;
+    cdrom_command_cnt_out = -1;
+    cmd = enable = xaen = dten = 0;
+    memset (dmacmemory, 0xff, 100);
+    ew (0x00, 0xc0 | 0x01);
+    ew (0x04, 0x03);
+    ew (0x08, 0x40);
+    ew (0x10, 0x02);
+    ew (0x14, 0x02);
+    /* KS autoconfig handles the rest */
+    map_banks (&dmac_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
+    cdtv_battram_reset ();
+    open_unit();
+}
old mode 100755 (executable)
new mode 100644 (file)
index 7a4d61f..c5e22b0
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -26,6 +26,7 @@
 #include "zfile.h"
 #include "filesys.h"
 #include "fsdb.h"
+#include "disk.h"
 
 static int config_newfilesystem;
 static struct strlist *temp_lines;
@@ -142,6 +143,10 @@ static const char *filtermode1[] = { "no_16", "bilinear_16", "no_32", "bilinear_
 static const char *filtermode2[] = { "0x", "1x", "2x", "3x", "4x", 0 };
 #endif
 static const char *cartsmode[] = { "none", "hrtmon", 0 };
+static const char *idemode[] = { "none", "a600/a1200", "a4000", 0 };
+static const char *rtctype[] = { "none", "MSM6242B", "RP5C01A", 0 };
+static const char *ciaatodmode[] = { "vblank", "50hz", "60hz", 0 };
+static const char *cscompa[] = { "-", "Generic", "CDTV", "CD32", "A500", "A500+", "A600", "A1000", "A1200", "A2000", "A4000" };
 
 static const char *obsolete[] = {
     "accuracy", "gfx_opengl", "gfx_32bit_blits", "32bit_blits",
@@ -206,6 +211,41 @@ void cfgfile_target_write (struct zfile *f, char *format,...)
     va_end (parms);
 }
 
+static void write_filesys_config (struct uae_prefs *p, const char *unexpanded,
+                                 const char *default_path, struct zfile *f)
+{
+    int i;
+    char tmp[MAX_DPATH];
+
+    for (i = 0; i < p->mountitems; i++) {
+       struct uaedev_config_info *uci = &p->mountconfig[i];
+       char *str;
+
+       str = cfgfile_subst_path (default_path, unexpanded, uci->rootdir);
+       if (uci->volname != 0) {
+           sprintf (tmp, "filesystem2=%s,%s:%s:%s,%d\n", uci->readonly ? "ro" : "rw",
+               uci->devname ? uci->devname : "", uci->volname, str, uci->bootpri);
+           zfile_fputs (f, tmp);
+           sprintf (tmp, "filesystem=%s,%s:%s\n", uci->readonly ? "ro" : "rw",
+               uci->volname, str);
+           zfile_fputs (f, tmp);
+       } else {
+           sprintf (tmp, "hardfile2=%s,%s:%s,%d,%d,%d,%d,%d,%s\n",
+                    uci->readonly ? "ro" : "rw",
+                    uci->devname ? uci->devname : "", str,
+                    uci->sectors, uci->surfaces, uci->reserved, uci->blocksize,
+                    uci->bootpri, uci->filesys ? uci->filesys : "");
+           zfile_fputs (f, tmp);
+           sprintf (tmp, "hardfile=%s,%d,%d,%d,%d,%s\n",
+                    uci->readonly ? "ro" : "rw", uci->sectors,
+                    uci->surfaces, uci->reserved, uci->blocksize, str);
+           zfile_fputs (f, tmp);
+       }
+       xfree (str);
+    }
+}
+
+
 void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
 {
     struct strlist *sl;
@@ -426,8 +466,25 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "chipset_refreshrate=%d\n", p->chipset_refreshrate);
     cfgfile_write (f, "collision_level=%s\n", collmode[p->collision_level]);
 
+    cfgfile_write (f, "chipset_compatible=%s\n", cscompa[p->cs_compatible]);
+    cfgfile_write (f, "ciaatod=%s\n", ciaatodmode[p->cs_ciaatod]);
+    cfgfile_write (f, "rtc=%s\n", rtctype[p->cs_rtc]);
+    //cfgfile_write (f, "chipset_rtc_adjust=%d\n", p->cs_rtc_adjust);
+    cfgfile_write (f, "ksmirror=%s\n", p->cs_ksmirror ? "true" : "false");
+    cfgfile_write (f, "cd32cd=%s\n", p->cs_cd32cd ? "true" : "false");
+    cfgfile_write (f, "cd32c2p=%s\n", p->cs_cd32c2p ? "true" : "false");
+    cfgfile_write (f, "cd32nvram=%s\n", p->cs_cd32nvram ? "true" : "false");
+    cfgfile_write (f, "cdtvcd=%s\n", p->cs_cdtvcd ? "true" : "false");
+    cfgfile_write (f, "cdtvram=%s\n", p->cs_cdtvram ? "true" : "false");
+    cfgfile_write (f, "cdtvramcard=%d\n", p->cs_cdtvcard);
+    cfgfile_write (f, "ide=%s\n", p->cs_ide == 1 ? "a600/a1200" : (p->cs_ide == 2 ? "a4000" : "none"));
+    cfgfile_write (f, "a1000ram=%s\n", p->cs_a1000ram ? "true" : "false");
+    cfgfile_write (f, "fatgary=%d\n", p->cs_fatgaryrev);
+    cfgfile_write (f, "ramsey=%d\n", p->cs_ramseyrev);
+
     cfgfile_write (f, "fastmem_size=%d\n", p->fastmem_size / 0x100000);
-    cfgfile_write (f, "a3000mem_size=%d\n", p->a3000mem_size / 0x100000);
+    cfgfile_write (f, "a3000mem_size=%d\n", p->mbresmem_low_size / 0x100000);
+    cfgfile_write (f, "mbresmem_size=%d\n", p->mbresmem_high_size / 0x100000);
     cfgfile_write (f, "z3mem_size=%d\n", p->z3fastmem_size / 0x100000);
     cfgfile_write (f, "z3mem_start=0x%x\n", p->z3fastmem_start);
     cfgfile_write (f, "bogomem_size=%d\n", p->bogomem_size / 0x40000);
@@ -465,7 +522,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "state_replay_buffer=%d\n", p->statecapturebuffersize);
 
 #ifdef FILESYS
-    write_filesys_config (&currprefs, currprefs.mountinfo, UNEXPANDED, p->path_hardfile, f);
+    write_filesys_config (p, UNEXPANDED, p->path_hardfile, f);
     if (p->filesys_no_uaefsdb)
        cfgfile_write (f, "filesys_no_fsdb=%s\n", p->filesys_no_uaefsdb ? "true" : "false");
 #endif
@@ -906,9 +963,12 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
                break;
            *tmpp++= 0;
            num = -1;
-           if (!strcasecmp (tmpp2, "numlock")) num = 0;
-           if (!strcasecmp (tmpp2, "capslock")) num = 1;
-           if (!strcasecmp (tmpp2, "scrolllock")) num = 2;
+           if (!strcasecmp (tmpp2, "numlock"))
+               num = 0;
+           if (!strcasecmp (tmpp2, "capslock"))
+               num = 1;
+           if (!strcasecmp (tmpp2, "scrolllock"))
+               num = 2;
            tmpp2 = tmpp;
            tmpp = strchr (tmpp2, ',');
            if (!tmpp)
@@ -993,6 +1053,40 @@ end:
     xfree(romtxt);
 }
 
+static struct uaedev_config_info *getuci(struct uae_prefs *p)
+{
+    if (p->mountitems < MOUNT_CONFIG_SIZE)
+       return &p->mountconfig[p->mountitems++];
+    return NULL;
+}
+
+int add_filesys_config (struct uae_prefs *p, int index,
+                       char *devname, char *volname, char *rootdir, int readonly,
+                       int secspertrack, int surfaces, int reserved,
+                       int blocksize, int bootpri, char *filesysdir, int flags) {
+    struct uaedev_config_info *uci;
+    if (index < 0)
+       uci = getuci(p);
+    else
+       uci = &p->mountconfig[index];
+    if (!uci)
+       return 0;
+    strcpy (uci->devname, devname ? devname : "");
+    strcpy (uci->volname, volname ? volname : "");
+    strcpy (uci->rootdir, rootdir ? rootdir : "");
+    uci->readonly = readonly;
+    uci->sectors = secspertrack;
+    uci->surfaces = surfaces;
+    uci->reserved = reserved;
+    uci->blocksize = blocksize;
+    uci->bootpri = bootpri;
+    uci->configoffset = -1;
+    strcpy (uci->filesys, filesysdir ? filesysdir : "");
+    if (!uci->devname[0])
+       sprintf(uci->devname,"DH%d", uci - &p->mountconfig[0]);
+    return 1;
+}
+
 static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *value)
 {
     int tmpval, dummy, i;
@@ -1008,6 +1102,15 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
     }
 
     if (cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits)
+
+       || cfgfile_yesno (option, value, "ksmirror", &p->cs_ksmirror)
+       || cfgfile_yesno (option, value, "cd32cd", &p->cs_cd32cd)
+       || cfgfile_yesno (option, value, "cd32c2p", &p->cs_cd32c2p)
+       || cfgfile_yesno (option, value, "cd32nvram", &p->cs_cd32nvram)
+       || cfgfile_yesno (option, value, "cdtvcd", &p->cs_cdtvcd)
+       || cfgfile_yesno (option, value, "cdtvram", &p->cs_cdtvram)
+       || cfgfile_yesno (option, value, "a1000ram", &p->cs_a1000ram)
+
        || cfgfile_yesno (option, value, "kickshifter", &p->kickshifter)
        || cfgfile_yesno (option, value, "ntsc", &p->ntscmode)
        || cfgfile_yesno (option, value, "genlock", &p->genlock)
@@ -1031,10 +1134,15 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
        || cfgfile_yesno (option, value, "uaeserial", &p->uaeserial)
        || cfgfile_yesno (option, value, "scsi", &p->scsi))
        return 1;
+
     if (cfgfile_intval (option, value, "cachesize", &p->cachesize, 1)
+       || cfgfile_intval (option, value, "cdtvramcard", &p->cs_cdtvcard, 1)
+       || cfgfile_intval (option, value, "fatgary", &p->cs_fatgaryrev, 1)
+       || cfgfile_intval (option, value, "ramsey", &p->cs_ramseyrev, 1)
        || cfgfile_intval (option, value, "chipset_refreshrate", &p->chipset_refreshrate, 1)
        || cfgfile_intval (option, value, "fastmem_size", &p->fastmem_size, 0x100000)
-       || cfgfile_intval (option, value, "a3000mem_size", &p->a3000mem_size, 0x100000)
+       || cfgfile_intval (option, value, "a3000mem_size", &p->mbresmem_low_size, 0x100000)
+       || cfgfile_intval (option, value, "mbresmem_size", &p->mbresmem_high_size, 0x100000)
        || cfgfile_intval (option, value, "z3mem_size", &p->z3fastmem_size, 0x100000)
        || cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1)
        || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
@@ -1049,13 +1157,19 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
        || cfgfile_intval (option, value, "parallel_autoflush", &p->parallel_autoflush_time, 1)
        || cfgfile_intval (option, value, "catweasel", &p->catweasel, 1))
        return 1;
+
     if (cfgfile_strval (option, value, "comp_trustbyte", &p->comptrustbyte, compmode, 0)
+       || cfgfile_strval (option, value, "chipset_compatible", &p->cs_compatible, cscompa, 0)
+       || cfgfile_strval (option, value, "rtc", &p->cs_rtc, rtctype, 0)
+       || cfgfile_strval (option, value, "ciaatod", &p->cs_ciaatod, ciaatodmode, 0)
+       || cfgfile_strval (option, value, "ide", &p->cs_ide, idemode, 0)
        || cfgfile_strval (option, value, "comp_trustword", &p->comptrustword, compmode, 0)
        || cfgfile_strval (option, value, "comp_trustlong", &p->comptrustlong, compmode, 0)
        || cfgfile_strval (option, value, "comp_trustnaddr", &p->comptrustnaddr, compmode, 0)
        || cfgfile_strval (option, value, "collision_level", &p->collision_level, collmode, 0)
        || cfgfile_strval (option, value, "comp_flushmode", &p->comp_hardflush, flushmode, 0))
        return 1;
+
     if (cfgfile_string (option, value, "kickstart_rom_file", p->romfile, sizeof p->romfile)
        || cfgfile_string (option, value, "kickstart_ext_rom_file", p->romextfile, sizeof p->romextfile)
        || cfgfile_string (option, value, "flash_file", p->flashfile, sizeof p->flashfile)
@@ -1173,14 +1287,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
            aname = 0;
        }
        str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
-       tmpp = 0;
 #ifdef FILESYS
-       tmpp = add_filesys_unit (currprefs.mountinfo, 0, aname, str, ro, secs,
-           heads, reserved, bs, 0, 0, 0);
+       add_filesys_config (p, -1, NULL, aname, str, ro, secs, heads, reserved, bs, 0, NULL, 0);
 #endif
        free (str);
-       if (tmpp)
-           write_log ("Error: %s\n", tmpp);
        return 1;
 
     }
@@ -1251,14 +1361,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
            }
        }
        str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
-       tmpp = 0;
 #ifdef FILESYS
-       tmpp = add_filesys_unit (currprefs.mountinfo, dname, aname, str, ro, secs,
-           heads, reserved, bs, bp, fs, 0);
+       add_filesys_config (p, -1, dname, aname, str, ro, secs, heads, reserved, bs, bp, fs, 0);
 #endif
        free (str);
-       if (tmpp)
-           write_log ("Error: %s\n", tmpp);
        return 1;
 
       invalid_fs:
@@ -1723,7 +1829,7 @@ bad:
     p->jport1 = v1;
 }
 
-static void parse_filesys_spec (int readonly, char *spec)
+static void parse_filesys_spec (struct uae_prefs *p, int readonly, char *spec)
 {
     char buf[256];
     char *s2;
@@ -1740,18 +1846,15 @@ static void parse_filesys_spec (int readonly, char *spec)
                *tmp = '/';
        }
 #endif
-       s2 = 0;
 #ifdef FILESYS
-       s2 = add_filesys_unit (currprefs.mountinfo, 0, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0);
+       add_filesys_config (p, -1, 0, buf, s2, readonly, 0, 0, 0, 0, 0, 0, 0);
 #endif
-       if (s2)
-           write_log ("%s\n", s2);
     } else {
        write_log ("Usage: [-m | -M] VOLNAME:mount_point\n");
     }
 }
 
-static void parse_hardfile_spec (char *spec)
+static void parse_hardfile_spec (struct uae_prefs *p, char *spec)
 {
     char *x0 = my_strdup (spec);
     char *x1, *x2, *x3, *x4;
@@ -1772,13 +1875,9 @@ static void parse_hardfile_spec (char *spec)
     if (x4 == NULL)
        goto argh;
     *x4++ = '\0';
-    x4 = 0;
 #ifdef FILESYS
-    x4 = add_filesys_unit (currprefs.mountinfo, 0, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0, 0);
+    add_filesys_config (p, -1, 0, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3), 0, 0, 0);
 #endif
-    if (x4)
-       write_log ("%s\n", x4);
-
     free (x0);
     return;
 
@@ -1852,8 +1951,8 @@ int parse_cmdline_option (struct uae_prefs *p, char c, char *arg)
     case 'K': strncpy (p->romextfile, arg, 255); p->romextfile[255] = 0; break;
     case 'p': strncpy (p->prtname, arg, 255); p->prtname[255] = 0; break;
        /*     case 'I': strncpy (p->sername, arg, 255); p->sername[255] = 0; currprefs.use_serial = 1; break; */
-    case 'm': case 'M': parse_filesys_spec (c == 'M', arg); break;
-    case 'W': parse_hardfile_spec (arg); break;
+    case 'm': case 'M': parse_filesys_spec (p, c == 'M', arg); break;
+    case 'W': parse_hardfile_spec (p, arg); break;
     case 'S': parse_sound_spec (p, arg); break;
     case 'R': p->gfx_framerate = atoi (arg); break;
     case 'x': p->no_xhair = 1; break;
@@ -2368,8 +2467,8 @@ static void default_prefs_mini (struct uae_prefs *p, int type)
     strcpy (p->description, "UAE default A500 configuration");
 
     p->nr_floppies = 1;
-    p->dfxtype[0] = 0;
-    p->dfxtype[1] = -1;
+    p->dfxtype[0] = DRV_35_DD;
+    p->dfxtype[1] = DRV_NONE;
     p->cpu_level = 0;
     p->address_space_24 = 1;
     p->chipmem_size = 0x00080000;
@@ -2498,6 +2597,10 @@ void default_prefs (struct uae_prefs *p, int type)
     p->picasso96_nocustom = 1;
     p->cart_internal = 1;
 
+    p->cs_compatible = 1;
+    p->cs_rtc = 2;
+    p->cs_df0idhw = 1;
+
     p->gfx_filter = 0;
     p->gfx_filter_horiz_zoom_mult = 1000;
     p->gfx_filter_vert_zoom_mult = 1000;
@@ -2532,7 +2635,8 @@ void default_prefs (struct uae_prefs *p, int type)
     p->ntscmode = 0;
 
     p->fastmem_size = 0x00000000;
-    p->a3000mem_size = 0x00000000;
+    p->mbresmem_low_size = 0x00000000;
+    p->mbresmem_high_size = 0x00000000;
     p->z3fastmem_size = 0x00000000;
     p->z3fastmem_start = 0x10000000;
     p->chipmem_size = 0x00080000;
@@ -2540,10 +2644,10 @@ void default_prefs (struct uae_prefs *p, int type)
     p->gfxmem_size = 0x00000000;
 
     p->nr_floppies = 2;
-    p->dfxtype[0] = 0;
-    p->dfxtype[1] = 0;
-    p->dfxtype[2] = -1;
-    p->dfxtype[3] = -1;
+    p->dfxtype[0] = DRV_35_DD;
+    p->dfxtype[1] = DRV_35_DD;
+    p->dfxtype[2] = DRV_NONE;
+    p->dfxtype[3] = DRV_NONE;
     p->floppy_speed = 100;
     p->dfxclickvolume = 33;
 
@@ -2551,8 +2655,6 @@ void default_prefs (struct uae_prefs *p, int type)
     p->statecapturerate = 5 * 50;
     p->statecapture = 0;
 
-    p->mountinfo = &options_mountinfo;
-
 #ifdef UAE_MINI
     default_prefs_mini (p, 0);
 #endif
@@ -2572,24 +2674,23 @@ static void buildin_default_prefs_68020 (struct uae_prefs *p)
 
 static void buildin_default_host_prefs (struct uae_prefs *p)
 {
+#if 0
     p->sound_filter = FILTER_SOUND_OFF;
     p->sound_stereo = 1;
     p->sound_stereo_separation = 7;
     p->sound_mixed_stereo = 0;
+#endif
 }
 
 static void buildin_default_prefs (struct uae_prefs *p)
 {
-    free_mountinfo (currprefs.mountinfo);
-    p->mountinfo = currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo;
-
     buildin_default_host_prefs (p);
 
     p->nr_floppies = 2;
-    p->dfxtype[0] = 0;
-    p->dfxtype[1] = 0;
-    p->dfxtype[2] = -1;
-    p->dfxtype[3] = -1;
+    p->dfxtype[0] = DRV_35_DD;
+    p->dfxtype[1] = DRV_35_DD;
+    p->dfxtype[2] = DRV_NONE;
+    p->dfxtype[3] = DRV_NONE;
     p->floppy_speed = 100;
 
     p->cpu_level = 0;
@@ -2613,10 +2714,26 @@ static void buildin_default_prefs (struct uae_prefs *p)
     p->chipmem_size = 0x00080000;
     p->bogomem_size = 0x00080000;
     p->fastmem_size = 0x00000000;
-    p->a3000mem_size = 0x00000000;
+    p->mbresmem_low_size = 0x00000000;
+    p->mbresmem_high_size = 0x00000000;
     p->z3fastmem_size = 0x00000000;
     p->gfxmem_size = 0x00000000;
 
+    p->cs_rtc = 1;
+    p->cs_a1000ram = 0;
+    p->cs_fatgaryrev = -1;
+    p->cs_ramseyrev = -1;
+    p->cs_agnusrev = -1;
+    p->cs_deniserev = -1;
+    p->cs_mbdmac = -1;
+    p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 0;
+    p->cs_cdtvcd = p->cs_cdtvram = 0;
+    p->cs_ide = 0;
+    p->cs_pcmcia = 0;
+    p->cs_ksmirror = 0;
+    p->cs_ciaatod = 0;
+    p->cs_df0idhw = 1;
+
     strcpy (p->romfile, "");
     strcpy (p->romextfile, "");
     strcpy (p->flashfile, "");
@@ -2680,7 +2797,9 @@ static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck)
     if (config == 1)
        p->chipmem_size = 0x40000;
     set_68000_compa (p, compa);
-    p->dfxtype[1] = -1;
+    p->dfxtype[1] = DRV_NONE;
+    p->cs_compatible = 7;
+    build_in_chipset_prefs (p);
     return configure_rom (p, roms, romcheck);
 }
 
@@ -2700,10 +2819,18 @@ static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck)
     if (!configure_rom (p, roms, romcheck))
        return 0;
     p->bogomem_size = 0;
-    p->chipmem_size = 0x100000;
+    p->chipmem_size = 0x200000;
     p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
-    p->dfxtype[1] = -1;
+    p->cs_cdtvcd = p->cs_cdtvram = 1;
+    if (config > 0)
+       p->cs_cdtvcard = 64;
+    p->cs_rtc = 1;
+    p->nr_floppies = 0;
+    p->dfxtype[0] = DRV_35_DD;
+    p->dfxtype[1] = DRV_NONE;
     set_68000_compa (p, compa);
+    p->cs_compatible = 2;
+    build_in_chipset_prefs (p);
     return 1;
 }
 
@@ -2719,10 +2846,13 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck)
     roms[0] = 19;
     if (!configure_rom (p, roms, romcheck))
        return 0;
+    p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
     p->nr_floppies = 0;
-    p->dfxtype[0] = -1;
-    p->dfxtype[1] = -1;
+    p->dfxtype[0] = DRV_NONE;
+    p->dfxtype[1] = DRV_NONE;
     set_68020_compa (p, compa);
+    p->cs_compatible = 3;
+    build_in_chipset_prefs (p);
     return 1;
 }
 
@@ -2735,9 +2865,13 @@ static int bip_a1200 (struct uae_prefs *p, int config, int compa, int romcheck)
     roms[1] = 31;
     roms[2] = 15;
     roms[3] = -1;
-    if (config == 1)
+    if (config == 1) {
        p->fastmem_size = 0x400000;
+        p->cs_rtc = 2;
+    }
     set_68020_compa (p, compa);
+    p->cs_compatible = 8;
+    build_in_chipset_prefs (p);
     return configure_rom (p, roms, romcheck);
 }
 
@@ -2757,6 +2891,8 @@ static int bip_a600 (struct uae_prefs *p, int config, int compa, int romcheck)
        p->fastmem_size = 0x400000;
     p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
     set_68000_compa (p, compa);
+    p->cs_compatible = 6;
+    build_in_chipset_prefs (p);
     return configure_rom (p, roms, romcheck);
 }
 
@@ -2774,6 +2910,8 @@ static int bip_a500p (struct uae_prefs *p, int config, int compa, int romcheck)
        p->fastmem_size = 0x400000;
     p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
     set_68000_compa (p, compa);
+    p->cs_compatible = 5;
+    build_in_chipset_prefs (p);
     return configure_rom (p, roms, romcheck);
 }
 static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck)
@@ -2803,7 +2941,8 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck)
        roms[1] = 32;
        p->bogomem_size = 0;
        p->chipset_mask = 0;
-       p->dfxtype[1] = -1;
+       p->cs_rtc = 0;
+       p->dfxtype[1] = DRV_NONE;
        break;
        case 4: // KS 1.2, OCS Agnus, 0.5M Chip
        roms[0] = 5;
@@ -2811,7 +2950,8 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck)
        roms[2] = 3;
        p->bogomem_size = 0;
        p->chipset_mask = 0;
-       p->dfxtype[1] = -1;
+       p->cs_rtc = 0;
+       p->dfxtype[1] = DRV_NONE;
        break;
        case 5: // KS 1.2, OCS Agnus, 0.5M Chip + 0.5M Slow
        roms[0] = 5;
@@ -2821,6 +2961,8 @@ static int bip_a500 (struct uae_prefs *p, int config, int compa, int romcheck)
        break;
     }
     set_68000_compa (p, compa);
+    p->cs_compatible = 4;
+    build_in_chipset_prefs (p);
     return configure_rom (p, roms, romcheck);
 }
 
@@ -2847,8 +2989,8 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck)
     p->immediate_blits = 1;
     p->produce_sound = 2;
     p->cachesize = 8192;
-    p->dfxtype[0] = 1;
-    p->dfxtype[1] = 1;
+    p->dfxtype[0] = DRV_35_HD;
+    p->dfxtype[1] = DRV_35_HD;
     p->floppy_speed = 0;
     p->cpu_idle = 150;
     p->scsi = 1;
@@ -2856,6 +2998,10 @@ static int bip_super (struct uae_prefs *p, int config, int compa, int romcheck)
     p->socket_emu = 1;
     p->cart_internal = 0;
     p->picasso96_nocustom = 1;
+    p->cs_compatible = 1;
+    build_in_chipset_prefs (p);
+    p->cs_ide = -1;
+    p->cs_ciaatod = p->ntscmode ? 2 : 1;
     return configure_rom (p, roms, romcheck);
 }
 
@@ -2889,8 +3035,8 @@ int build_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r
        case 7:
        v = bip_a500 (p, 4, compa, romcheck);
        p->nr_floppies = 0;
-       p->dfxtype[0] = -1;
-       p->dfxtype[1] = -1;
+       p->dfxtype[0] = DRV_NONE;
+       p->dfxtype[1] = DRV_NONE;
        break;
        case 10:
        v = bip_super (p, config, compa, romcheck);
@@ -2898,7 +3044,103 @@ int build_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r
     }
     for (i = 0; i < 4; i++) {
        if (p->dfxtype[i] < 0)
-           p->df[i][0] = 0;
+           p->df[i][0] = DRV_35_DD;
     }
     return v;
-}
\ No newline at end of file
+}
+
+int build_in_chipset_prefs (struct uae_prefs *p)
+{
+    if (!p->cs_compatible)
+       return 1;
+    p->cs_a1000ram = 0;
+    p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 0;
+    p->cs_cdtvcd = p->cs_cdtvram = 0;
+    p->cs_fatgaryrev = -1;
+    p->cs_ide = 0;
+    p->cs_ramseyrev = -1;
+    p->cs_deniserev = -1;
+    p->cs_agnusrev = -1;
+    p->cs_mbdmac = -1;
+    p->cs_pcmcia = 0;
+    p->cs_ksmirror = 0;
+    p->cs_ciaatod = 0;
+    p->cs_df0idhw = 1;
+    switch (p->cs_compatible)
+    {
+       case  1: // generic
+           p->cs_rtc = 2;
+           p->cs_fatgaryrev = 0;
+           p->cs_ide = -1;
+           p->cs_mbdmac = 1;
+           p->cs_ramseyrev = 0x0f;
+           p->cs_ksmirror = 1;
+       break;
+       case  2: // CDTV
+           p->cs_rtc = 1;
+           p->cs_cdtvcd = p->cs_cdtvram = 1;
+           p->cs_ciaatod = 0;
+           p->cs_df0idhw = 0;
+       break;
+       case  3: // CD32
+           p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
+       break;
+       case  4: // A500
+           p->cs_df0idhw = 0;
+       break;
+       case  5: // A500+
+           p->cs_ksmirror = 1;
+       break;
+       case  6: // A600
+           p->cs_ksmirror = 1;
+           p->cs_ide = 1;
+           p->cs_pcmcia = 1;
+       break;
+       case  7: // A1000
+           p->cs_a1000ram = 1;
+           p->cs_ciaatod = p->ntscmode ? 2 : 1;
+       break;
+       case  8: // A1200
+           p->cs_ide = 1;
+           p->cs_pcmcia = 1;
+           p->cs_ksmirror = 1;
+       break;
+       case  9: // A2000
+           p->cs_rtc = 1;
+           p->cs_ciaatod = p->ntscmode ? 2 : 1;
+           break;
+       break;
+       case 10: // A3000
+           p->cs_rtc = 2;
+           p->cs_fatgaryrev = 0;
+           p->cs_ramseyrev = 0x0d;
+           p->cs_mbdmac = 1;
+           p->cs_ciaatod = p->ntscmode ? 2 : 1;
+       break;
+       case 11: // A3000T
+           p->cs_rtc = 2;
+           p->cs_fatgaryrev = 0;
+           p->cs_ramseyrev = 0x0d;
+           p->cs_mbdmac = 1;
+           p->cs_ciaatod = p->ntscmode ? 2 : 1;
+       break;
+       case 12: // A4000
+           p->cs_rtc = 2;
+           p->cs_fatgaryrev = 0;
+           p->cs_ramseyrev = 0x0f;
+           p->cs_ide = 2;
+           p->cs_mbdmac = 1;
+           p->cs_ksmirror = 1;
+       break;
+       case 13: // A4000T
+           p->cs_rtc = 2;
+           p->cs_fatgaryrev = 0;
+           p->cs_ramseyrev = 0x0f;
+           p->cs_ide = 2;
+           p->cs_mbdmac = 1;
+           p->cs_ksmirror = 1;
+       break;
+    }
+    return 1;
+}
+
diff --git a/cia.c b/cia.c
old mode 100755 (executable)
new mode 100644 (file)
index 5203079..27f75a1
--- a/cia.c
+++ b/cia.c
@@ -28,6 +28,7 @@
 #include "ar.h"
 #include "parallel.h"
 #include "akiko.h"
+#include "cdtv.h"
 #include "debug.h"
 #include "arcadia.h"
 #include "audio.h"
 
 #define DIV10 (10 * CYCLE_UNIT / 2) /* Yes, a bad identifier. */
 
-/* battclock stuff */
-#define RTC_D_ADJ      8
-#define RTC_D_IRQ      4
-#define RTC_D_BUSY     2
-#define RTC_D_HOLD     1
-#define RTC_E_t1       8
-#define RTC_E_t0       4
-#define RTC_E_INTR     2
-#define RTC_E_MASK     1
-#define RTC_F_TEST     8
-#define RTC_F_24_12    4
-#define RTC_F_STOP     2
-#define RTC_F_RSET     1
-
-static unsigned int clock_control_d = RTC_D_ADJ + RTC_D_HOLD;
-static unsigned int clock_control_e = 0;
-static unsigned int clock_control_f = RTC_F_24_12;
-
 static unsigned int ciaaicr, ciaaimask, ciabicr, ciabimask;
 static unsigned int ciaacra, ciaacrb, ciabcra, ciabcrb;
 
@@ -1012,11 +995,9 @@ void CIA_reset (void)
        DISK_select (ciabprb);
     }
 #ifdef CD32
-    if (cd32_enabled) {
-       akiko_reset ();
-       if (!akiko_init ())
-           cd32_enabled = 0;
-    }
+    akiko_reset ();
+    if (!akiko_init ())
+        currprefs.cs_cd32cd = changed_prefs.cs_cd32cd = 0;
 #endif
 }
 
@@ -1085,10 +1066,6 @@ uae_u32 REGPARAM2 cia_bget (uaecptr addr)
 
 #ifdef JIT
     special_mem |= S_READ;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END)
-       return akiko_bget (addr);
 #endif
     cia_wait_pre ();
     v = 0xff;
@@ -1123,10 +1100,6 @@ uae_u32 REGPARAM2 cia_wget (uaecptr addr)
 
 #ifdef JIT
     special_mem |= S_READ;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END)
-       return akiko_wget (addr);
 #endif
     cia_wait_pre ();
     v = 0xffff;
@@ -1160,10 +1133,6 @@ uae_u32 REGPARAM2 cia_lget (uaecptr addr)
     uae_u32 v;
 #ifdef JIT
     special_mem |= S_READ;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END)
-       return akiko_lget (addr);
 #endif
     v = cia_wget (addr) << 16;
     v |= cia_wget (addr + 2);
@@ -1189,12 +1158,6 @@ void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value)
 
 #ifdef JIT
     special_mem |= S_WRITE;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END) {
-       akiko_bput (addr, value);
-       return;
-    }
 #endif
     cia_wait_pre ();
     if ((addr & 0x2000) == 0)
@@ -1213,12 +1176,6 @@ void REGPARAM2 cia_wput (uaecptr addr, uae_u32 value)
     int r = (addr & 0xf00) >> 8;
 #ifdef JIT
     special_mem |= S_WRITE;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END) {
-       akiko_wput (addr, value);
-       return;
-    }
 #endif
     cia_wait_pre ();
     if ((addr & 0x2000) == 0)
@@ -1236,63 +1193,11 @@ void REGPARAM2 cia_lput (uaecptr addr, uae_u32 value)
 {
 #ifdef JIT
     special_mem |= S_WRITE;
-#endif
-#ifdef CD32
-    if (cd32_enabled && addr >= AKIKO_BASE && addr < AKIKO_BASE_END) {
-       akiko_lput (addr, value);
-       return;
-    }
 #endif
     cia_wput (addr, value >> 16);
     cia_wput (addr + 2, value & 0xffff);
 }
 
-#ifdef CDTV
-/* CDTV batterybacked RAM emulation */
-
-static uae_u8 cdtv_battram[4096];
-#define CDTV_NVRAM_MASK 4095
-#define CDTV_NVRAM_SIZE 2048
-int cdtv_enabled;
-
-static void cdtv_battram_reset (void)
-{
-    struct zfile *f = zfile_fopen (currprefs.flashfile,"rb");
-    if (!f)
-       return;
-    zfile_fread (cdtv_battram, CDTV_NVRAM_SIZE,1 ,f);
-    zfile_fclose (f);
-}
-
-static void cdtv_battram_write (int addr, int v)
-{
-    struct zfile *f;
-    int offset = addr & CDTV_NVRAM_MASK;
-    if (offset >= CDTV_NVRAM_SIZE)
-       return;
-    if (cdtv_battram[offset] == v)
-       return;
-    cdtv_battram[offset] = v;
-    f = zfile_fopen (currprefs.flashfile,"rb+");
-    if (!f)
-       return;
-    zfile_fseek (f, offset, SEEK_SET);
-    zfile_fwrite (cdtv_battram + offset, 1, 1, f);
-    zfile_fclose (f);
-}
-
-static uae_u8 cdtv_battram_read (int addr)
-{
-    uae_u8 v;
-    int offset;
-    offset = addr & CDTV_NVRAM_MASK;
-    if (offset >= CDTV_NVRAM_SIZE)
-       return 0;
-    v = cdtv_battram[offset];
-    return v;
-}
-#endif
-
 /* battclock memory access */
 
 static uae_u32 REGPARAM3 clock_lget (uaecptr) REGPARAM;
@@ -1309,6 +1214,27 @@ addrbank clock_bank = {
     dummy_lgeti, dummy_wgeti, ABFLAG_IO
 };
 
+static unsigned int clock_control_d;
+static unsigned int clock_control_e;
+static unsigned int clock_control_f;
+
+static uae_u8 rtc_memory[13], rtc_alarm[13];
+
+void rtc_hardreset(void)
+{
+    if (currprefs.cs_rtc == 1) { /* MSM6242B */
+       clock_control_d = 0x1;
+       clock_control_e = 0;
+       clock_control_f = 0x4; /* 24/12 */
+    } else if (currprefs.cs_rtc == 2) { /* RF5C01A */
+       clock_control_d = 0x4; /* Timer EN */
+       clock_control_e = 0;
+       clock_control_f = 0;
+       memset (rtc_memory, 0, 13);
+       memset (rtc_alarm, 0, 13);
+    }
+}
+
 uae_u32 REGPARAM2 clock_lget (uaecptr addr)
 {
     return (clock_wget (addr) << 16) | clock_wget (addr + 2);
@@ -1324,31 +1250,63 @@ uae_u32 REGPARAM2 clock_bget (uaecptr addr)
     time_t t = time(0);
     struct tm *ct;
 
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
+    t += currprefs.cs_rtc_adjust;
 #ifdef CDTV
-    if (cdtv_enabled && addr >= 0xdc8000)
+    if (currprefs.cs_cdtvram && addr >= 0xdc8000)
        return cdtv_battram_read (addr);
 #endif
     ct = localtime (&t);
-#ifdef JIT
-    special_mem |= S_READ;
-#endif
-    switch (addr & 0x3f) {
-    case 0x03: return ct->tm_sec % 10;
-    case 0x07: return ct->tm_sec / 10;
-    case 0x0b: return ct->tm_min % 10;
-    case 0x0f: return ct->tm_min / 10;
-    case 0x13: return ct->tm_hour % 10;
-    case 0x17: return ct->tm_hour / 10;
-    case 0x1b: return ct->tm_mday % 10;
-    case 0x1f: return ct->tm_mday / 10;
-    case 0x23: return (ct->tm_mon+1) % 10;
-    case 0x27: return (ct->tm_mon+1) / 10;
-    case 0x2b: return ct->tm_year % 10;
-    case 0x2f: return ct->tm_year / 10;
-    case 0x33: return ct->tm_wday;  /*Hack by -=SR=- */
-    case 0x37: return clock_control_d;
-    case 0x3b: return clock_control_e;
-    case 0x3f: return clock_control_f;
+    addr &= 0x3f;
+    if ((addr & 3) != 3)
+       return 0;
+    addr >>= 2;
+    if (currprefs.cs_rtc == 1) { /* MSM6242B */
+       switch (addr) {
+           case 0x0: return ct->tm_sec % 10;
+           case 0x1: return ct->tm_sec / 10;
+           case 0x2: return ct->tm_min % 10;
+           case 0x3: return ct->tm_min / 10;
+           case 0x4: return ct->tm_hour % 10;
+           case 0x5: return ct->tm_hour / 10;
+           case 0x6: return ct->tm_mday % 10;
+           case 0x7: return ct->tm_mday / 10;
+           case 0x8: return (ct->tm_mon + 1) % 10;
+           case 0x9: return (ct->tm_mon + 1) / 10;
+           case 0xA: return ct->tm_year % 10;
+           case 0xB: return ct->tm_year / 10;
+           case 0xC: return ct->tm_wday;
+           case 0xD: return clock_control_d;
+           case 0xE: return clock_control_e;
+           case 0xF: return clock_control_f;
+       }
+    } else if (currprefs.cs_rtc == 2) { /* RF5C01A */
+       int bank = clock_control_d & 3;
+        /* memory access */
+       if (bank >= 2 && addr < 0x0d)
+           return (rtc_memory[addr] >> ((bank == 2) ? 0 : 4)) & 0x0f;
+       /* alarm */
+       if (bank == 1 && addr < 0x0d)
+           return rtc_alarm[addr];
+       switch (addr) {
+           case 0x0: return ct->tm_sec % 10;
+           case 0x1: return ct->tm_sec / 10;
+           case 0x2: return ct->tm_min % 10;
+           case 0x3: return ct->tm_min / 10;
+           case 0x4: return ct->tm_hour % 10;
+           case 0x5: return ct->tm_hour / 10;
+           case 0x6: return ct->tm_wday;
+           case 0x7: return ct->tm_mday % 10;
+           case 0x8: return ct->tm_mday / 10;
+           case 0x9: return (ct->tm_mon+1) % 10;
+           case 0xA: return (ct->tm_mon+1) / 10;
+           case 0xB: return ct->tm_year % 10;
+           case 0xC: return ct->tm_year / 10;
+           case 0xD: return clock_control_d;
+           /* E and F = write-only */
+       }
     }
     return 0;
 }
@@ -1371,16 +1329,51 @@ void REGPARAM2 clock_bput (uaecptr addr, uae_u32 value)
     special_mem |= S_WRITE;
 #endif
 #ifdef CDTV
-    if (cdtv_enabled && addr >= 0xdc8000) {
+    if (currprefs.cs_cdtvram && addr >= 0xdc8000) {
        cdtv_battram_write (addr, value);
        return;
     }
 #endif
-    switch (addr & 0x3f) {
-    case 0x37: clock_control_d = value; break;
-    case 0x3b: clock_control_e = value; break;
-    case 0x3f: clock_control_f = value; break;
+    addr &= 0x3f;
+    if ((addr & 3) != 3)
+       return;
+    addr >>= 2;
+    value &= 0x0f;
+    if (currprefs.cs_rtc == 1) { /* MSM6242B */
+       switch (addr)
+       {
+           case 0xD: clock_control_d = value & (1|8); break;
+           case 0xE: clock_control_e = value; break;
+           case 0xF: clock_control_f = value; break;
+       }
+    } else if (currprefs.cs_rtc == 2) { /* RF5C01A */
+       int bank = clock_control_d & 3;
+        /* memory access */
+       if (bank >= 2 && addr < 0x0d) {
+           rtc_memory[addr] &= ((bank == 2) ? 0xf0 : 0x0f);
+           rtc_memory[addr] |= value << ((bank == 2) ? 0 : 4);
+           return;
+       }
+       /* alarm */
+       if (bank == 1 && addr < 0x0d) {
+           rtc_alarm[addr] = value;
+           rtc_alarm[0] = rtc_alarm[1] = rtc_alarm[9] = rtc_alarm[12] = 0;
+           rtc_alarm[3] &= ~0x8;
+           rtc_alarm[5] &= ~0xc;
+           rtc_alarm[6] &= ~0x8;
+           rtc_alarm[8] &= ~0xc;
+           rtc_alarm[10] &= ~0xe;
+           rtc_alarm[11] &= ~0xc;
+           return;
+       }
+       switch (addr)
+       {
+           case 0xD: clock_control_d = value; break;
+           case 0xE: clock_control_e = value; break;
+           case 0xF: clock_control_f = value; break;
+       }
     }
+
 }
 
 #ifdef SAVESTATE
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/crc32.c b/crc32.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index f803d6c..885f911
--- a/custom.c
+++ b/custom.c
@@ -52,6 +52,7 @@
 #endif
 #include "debug.h"
 #include "akiko.h"
+#include "cdtv.h"
 #if defined(ENFORCER)
 #include "enforcer.h"
 #endif
@@ -229,6 +230,7 @@ enum diw_states
 
 int plffirstline, plflastline;
 int plfstrt, plfstop;
+static int first_bpl_vpos;
 static int last_diw_pix_hpos, last_ddf_pix_hpos;
 static int last_decide_line_hpos, last_sprite_decide_line_hpos;
 static int last_fetch_hpos, last_sprite_hpos;
@@ -1483,6 +1485,8 @@ STATIC_INLINE void decide_fetch (int hpos)
 
 static void start_bpl_dma (int hpos, int hstart)
 {
+    if (first_bpl_vpos < 0)
+       first_bpl_vpos = vpos;
     fetch_start(hpos);
     fetch_cycle = 0;
     last_fetch_hpos = hstart;
@@ -2223,7 +2227,6 @@ void init_hz (void)
        changed_prefs.chipset_refreshrate = abs (currprefs.gfx_refreshrate);
     }
 
-    ciavsyncmode = 0;
     beamcon0 = new_beamcon0;
     isntsc = beamcon0 & 0x20 ? 0 : 1;
     if (hack_vpos > 0) {
@@ -2265,7 +2268,6 @@ void init_hz (void)
            minfirstline = maxvpos - 1;
        sprite_vblank_endline = minfirstline - 2;
        dumpsync();
-       ciavsyncmode = 1;
     }
     /* limit to sane values */
     if (vblank_hz < 10)
@@ -2376,6 +2378,8 @@ static uae_u32 REGPARAM2 timehack_helper (TrapContext *context)
   */
 STATIC_INLINE uae_u16 DENISEID (void)
 {
+    if (currprefs.cs_deniserev >= 0)
+       return currprefs.cs_deniserev;
 #ifdef AGA
     if (currprefs.chipset_mask & CSMASK_AGA)
        return 0xF8;
@@ -2416,12 +2420,22 @@ STATIC_INLINE int GETHPOS(void)
 
 STATIC_INLINE uae_u16 VPOSR (void)
 {
-    unsigned int csbit = currprefs.ntscmode ? 0x1000 : 0;
+    unsigned int csbit = 0;
     int vp = (GETVPOS() >> 8) & 7;
+
+    if (currprefs.cs_agnusrev >= 0) {
+       csbit |= currprefs.cs_agnusrev << 8;
+    } else {
+       if (currprefs.ntscmode)
+           csbit |= 0x1000;
 #ifdef AGA
-    csbit |= (currprefs.chipset_mask & CSMASK_AGA) ? 0x2300 : 0;
+       csbit |= (currprefs.chipset_mask & CSMASK_AGA) ? 0x2300 : 0;
 #endif
-    csbit |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x2000 : 0;
+       csbit |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x2000 : 0;
+       if (currprefs.chipmem_size > 1024 * 1024 && (currprefs.chipset_mask & CSMASK_ECS_AGNUS))
+           csbit |= 0x2100;
+    }
+
     if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
        vp &= 1;
     vp = vp | lof | csbit;
@@ -2458,13 +2472,19 @@ STATIC_INLINE uae_u16 VHPOSR (void)
 static void perform_copper_write (int old_hpos);
 static void immediate_copper (int num)
 {
+    int pos = 0;
+
     cop_state.state = COP_stop;
     cop_state.vpos = vpos;
     cop_state.hpos = current_hpos () & ~1;
     cop_state.ip = num == 1 ? cop1lc : cop2lc;
-    for (;;) {
+    while (pos < (maxvpos << 5)) {
        if (!dmaen(DMA_COPPER))
            break;
+       if (cop_state.ip >= currprefs.chipmem_size)
+           break;
+       pos++;
        cop_state.i1 = chipmem_agnus_wget (cop_state.ip);
        cop_state.i2 = chipmem_agnus_wget (cop_state.ip + 2);
        cop_state.ip += 4;
@@ -2479,7 +2499,9 @@ static void immediate_copper (int num)
                continue;
            }
            perform_copper_write (0);
-       } else { // wait or skip, simply ignore them
+       } else { // wait or skip
+           if ((cop_state.i1 >> 8) > ((pos >> 5) & 0xff))
+               pos = (((pos >> 5) & 0x100) | ((cop_state.i1 >> 8)) << 5) | ((cop_state.i1 & 0xff) >> 3);
            if (cop_state.i1 >= 0xffdf && cop_state.i2 == 0xfffe)
                break;
        }
@@ -3968,6 +3990,7 @@ static void adjust_array_sizes (void)
 
 static void init_hardware_frame (void)
 {
+    first_bpl_vpos = -1;
     next_lineno = 0;
     nextline_how = nln_normal;
     diwstate = DIW_waiting_start;
@@ -4171,11 +4194,11 @@ static void vsync_handler (void)
 
     COPJMP (1);
 
-    init_hardware_frame ();
-
     if (timehack_alive > 0)
        timehack_alive--;
     inputdevice_vsync ();
+
+    init_hardware_frame ();
 }
 
 #ifdef JIT
@@ -4271,6 +4294,9 @@ static void hsync_handler (void)
 #ifdef CD32
        AKIKO_hsync_handler ();
 #endif
+#ifdef CDTV
+       CDTV_hsync_handler ();
+#endif
 #ifdef CPUEMU_6
        if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) {
            decide_blitter (hpos);
@@ -4286,20 +4312,20 @@ static void hsync_handler (void)
     eventtab[ev_hsync].evtime += get_cycles () - eventtab[ev_hsync].oldcycles;
     eventtab[ev_hsync].oldcycles = get_cycles ();
     CIA_hsync_handler ();
+    if (currprefs.cs_ciaatod > 0) {
+       static int cia_hsync;
+       cia_hsync -= 256;
+       if (cia_hsync <= 0) {
+           CIA_vsync_prehandler();
+           cia_hsync += ((MAXVPOS_PAL * MAXHPOS_PAL * 50 * 256) / (maxhpos * (currprefs.cs_ciaatod == 2 ? 60 : 50)));
+       }
+    }
+
 
 #ifdef PICASSO96
     picasso_handle_hsync ();
 #endif
 
-    if (ciavsyncmode) {
-       static int ciahsync;
-       ciahsync++;
-       if (ciahsync >= (currprefs.ntscmode ? MAXVPOS_NTSC : MAXVPOS_PAL) * MAXHPOS_PAL / maxhpos) { /* not so perfect.. */
-           CIA_vsync_prehandler ();
-           ciahsync = 0;
-       }
-    }
-
     if ((currprefs.chipset_mask & CSMASK_AGA) || (!currprefs.chipset_mask & CSMASK_ECS_AGNUS))
        last_custom_value = uaerand ();
     else
@@ -4345,7 +4371,7 @@ static void hsync_handler (void)
        }
 #endif
        vsync_counter++;
-       if (!ciavsyncmode)
+       if (currprefs.cs_ciaatod == 0)
            CIA_vsync_prehandler();
     }
 
@@ -4398,6 +4424,13 @@ static void hsync_handler (void)
     }
 #endif
 
+    {
+        extern void bsdsock_fake_int_handler(void);
+       extern int bsd_int_requested;
+       if (bsd_int_requested)
+           bsdsock_fake_int_handler();
+    }
+
     /* See if there's a chance of a copper wait ending this line.  */
     cop_state.hpos = 0;
     cop_state.last_write = 0;
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/debug.c b/debug.c
old mode 100755 (executable)
new mode 100644 (file)
index d482143..03ff550
--- a/debug.c
+++ b/debug.c
@@ -867,7 +867,7 @@ static void illg_init (void)
     if (cloanto_rom)
        memset (illgdebug + 0xe00000, 1, 512 * 1024);
 #ifdef FILESYS
-    if (nr_units (currprefs.mountinfo) > 0) /* filesys "rom" */
+    if (uae_boot_rom) /* filesys "rom" */
        memset (illgdebug + RTAREA_BASE, 1, 0x10000);
 #endif
 }
@@ -2172,7 +2172,7 @@ void debug (void)
     debug_1 ();
     if (!debug_rewind && !currprefs.cachesize
 #ifdef FILESYS
-       && nr_units (currprefs.mountinfo) == 0
+       && nr_units () == 0
 #endif
        ) {
        savestate_capture (1);
diff --git a/disk.c b/disk.c
old mode 100755 (executable)
new mode 100644 (file)
index 2eb0c53..3ea48f7
--- a/disk.c
+++ b/disk.c
@@ -40,6 +40,8 @@
 #include "crc32.h"
 #include "inputdevice.h"
 
+#undef CATWEASEL
+
 static int longwritemode = 0;
 
 /* support HD floppies */
@@ -483,6 +485,7 @@ static char *drive_id_name(drive *drv)
     case DRIVE_ID_35HD : return "3.5HD";
     case DRIVE_ID_525SD: return "5.25SD";
     case DRIVE_ID_35DD : return "3.5DD";
+    case DRIVE_ID_NONE : return "NONE";
     }
     return "UNKNOWN";
 }
@@ -516,6 +519,9 @@ static void drive_settype_id(drive *drv)
        case DRV_525_SD:
        drv->drive_id = DRIVE_ID_525SD;
        break;
+       case DRV_NONE:
+       drv->drive_id = DRIVE_ID_NONE;
+       break;
     }
 #ifdef DEBUG_DRIVE_ID
     write_log("drive_settype_id: DF%d: set to %s\n", drv-floppy, drive_id_name(drv));
@@ -2131,15 +2137,13 @@ void DISK_select (uae_u8 data)
            write_log (" side %d ", (data & 0x04) ? 1 : 0);
     }
 
-    selected |= disabled;
-
     if (step != step_pulse) {
        if (disk_debug_logging > 1)
            write_log (" dskstep %d ", step_pulse);
        step = step_pulse;
        if (step && !savestate_state) {
            for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
-               if (!(selected & (1 << dr))) {
+               if (!((selected | disabled) & (1 << dr))) {
                    drive_step (floppy + dr);
                    if (floppy[dr].indexhackmode > 1 && (data & 0x80))
                        floppy[dr].indexhack = 1;
@@ -2156,20 +2160,18 @@ void DISK_select (uae_u8 data)
                drv->drive_id_scnt++;
                drv->drive_id_scnt &= 31;
                drv->idbit = (drv->drive_id & (1L << (31 - drv->drive_id_scnt))) ? 1 : 0;
-               if ((prevdata & 0x80) == 0 || (data & 0x80) == 0) {
-                   /* motor off: if motor bit = 0 in prevdata or data -> turn motor on */
-                   drive_motor (drv, 0);
-               } else if (prevdata & 0x80) {
-                   /* motor on: if motor bit = 1 in prevdata only (motor flag state in data has no effect)
-                       -> turn motor off */
-                   drive_motor (drv, 1);
-               }
-               if (currprefs.dfxtype[dr] == DRV_35_DD) {
-                   if (dr == 0) /* A500/A2000 internal drive always returns 0 */
-                       drv->idbit = 0;
-                   else /* regular external DD drive always returns 1 */
-                       drv->idbit = 1;
+               if (!(disabled & (1 << dr))) {
+                   if ((prevdata & 0x80) == 0 || (data & 0x80) == 0) {
+                       /* motor off: if motor bit = 0 in prevdata or data -> turn motor on */
+                       drive_motor (drv, 0);
+                   } else if (prevdata & 0x80) {
+                       /* motor on: if motor bit = 1 in prevdata only (motor flag state in data has no effect)
+                           -> turn motor off */
+                       drive_motor (drv, 1);
+                   }
                }
+               if (!currprefs.cs_df0idhw && dr == 0)
+                   drv->idbit = 0;
 #ifdef DEBUG_DRIVE_ID
                write_log("DISK_status: sel %d id %s (%08.8X) [0x%08lx, bit #%02d: %d]\n",
                    dr, drive_id_name(drv), drv->drive_id, drv->drive_id << drv->drive_id_scnt, 31 - drv->drive_id_scnt, drv->idbit);
@@ -2177,6 +2179,7 @@ void DISK_select (uae_u8 data)
            }
        }
     }
+
     for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
        floppy[dr].state = (!(selected & (1 << dr))) | !floppy[dr].motoroff;
        update_drive_gui (dr);
@@ -2193,7 +2196,7 @@ uae_u8 DISK_status (void)
 
     for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
        drive *drv = floppy + dr;
-       if (!(selected & (1 << dr))) {
+       if (!((selected | disabled) & (1 << dr))) {
            if (drive_running (drv)) {
                if (drv->catweasel) {
 #ifdef CATWEASEL
@@ -2227,6 +2230,9 @@ uae_u8 DISK_status (void)
            } else if (drv->dskchange && currprefs.dfxtype[dr] != DRV_525_SD) {
                st &= ~4;
            }
+       } else if (!(selected & (1 << dr))) {
+           if (drv->idbit)
+               st &= ~0x20;
        }
     }
     return st;
@@ -2469,6 +2475,31 @@ static void disk_doupdate_predict (drive * drv, int startcycle)
 extern uae_u8 cycle_line[256];
 #endif
 
+static void disk_doupdate_read_nothing (int floppybits)
+{
+    int j = 0, k = 1, l = 0;
+
+    while (floppybits >= get_floppy_speed()) {
+       word <<= 1;
+       if (bitoffset == 15 && dma_enable && dskdmaen == 2 && dsklength >= 0) {
+           if (dsklength > 0) {
+               put_word (dskpt, word);
+               dskpt += 2;
+           }
+           dsklength--;
+           if (dsklength <= 0)
+               disk_dmafinished ();
+       }
+       if ((bitoffset & 7) == 7) {
+           dskbytr_val = word & 0xff;
+           dskbytr_val |= 0x8000;
+       }
+       bitoffset++;
+       bitoffset &= 15;
+       floppybits -= get_floppy_speed();
+    }
+}
+
 static void disk_doupdate_read (drive * drv, int floppybits)
 {
     int j = 0, k = 1, l = 0;
@@ -2668,6 +2699,7 @@ void DISK_update (int tohpos)
     int dr;
     int cycles = (tohpos << 8) - disk_hpos;
     int startcycle = disk_hpos;
+    int didread;
 
     disk_jitter = ((uaerand () >> 4) & 3) + 1;
     if (disk_jitter > 2)
@@ -2697,6 +2729,7 @@ void DISK_update (int tohpos)
        drive_fill_bigbuf (drv, 0);
        drv->mfmpos %= drv->tracklen;
     }
+    didread = 0;
     for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
        drive *drv = &floppy[dr];
        if (drv->motoroff)
@@ -2709,13 +2742,20 @@ void DISK_update (int tohpos)
            disk_doupdate_read (drv, drv->floppybitcounter);
        disk_doupdate_predict (drv, disk_hpos);
        drv->floppybitcounter %= drv->trackspeed;
+       didread = 1;
        break;
     }
+     /* no floppy selected but read dma */
+    if (!didread && dskdmaen == 2) {
+       disk_doupdate_read_nothing (cycles);
+    }
+
 }
 
 void DSKLEN (uae_u16 v, int hpos)
 {
     int dr, prev = dsklen;
+    int noselected = 0;
 
     DISK_update (hpos);
     if ((v & 0x8000) && (dsklen & 0x8000)) {
@@ -2769,23 +2809,24 @@ void DSKLEN (uae_u16 v, int hpos)
        }
     }
 
-    if (disk_debug_logging > 0) {
-       for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
-           drive *drv = &floppy[dr];
-           if (drv->motoroff)
-               continue;
-           if ((selected & (1 << dr)) == 0)
-               break;
-       }
-       if (dr == 4) {
-           write_log ("disk %s DMA started but no drive selected!\n",
-              dskdmaen == 3 ? "write" : "read");
-       } else {
+    for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
+        drive *drv = &floppy[dr];
+        if (drv->motoroff)
+           continue;
+       if ((selected & (1 << dr)) == 0)
+           break;
+    }
+    if (dr == 4) {
+        write_log ("disk %s DMA started but no drive selected!\n",
+           dskdmaen == 3 ? "write" : "read");
+       noselected = 1;
+    } else {
+       if (disk_debug_logging > 0) {
            write_log ("disk %s DMA started, drv=%x track %d mfmpos %d\n",
-               dskdmaen == 3 ? "write" : "read", selected ^ 15,
+               dskdmaen == 3 ? "write" : "read", selected ^ 15,
                floppy[dr].cyl * 2 + side, floppy[dr].mfmpos);
+           disk_dma_debugmsg();
        }
-        disk_dma_debugmsg();
     }
 
     for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++)
@@ -2794,6 +2835,7 @@ void DSKLEN (uae_u16 v, int hpos)
     /* Try to make floppy access from Kickstart faster.  */
     if (dskdmaen != 2 && dskdmaen != 3)
        return;
+
     for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
        drive *drv = &floppy[dr];
        if (selected & (1 << dr))
@@ -2855,6 +2897,15 @@ void DSKLEN (uae_u16 v, int hpos)
                done = 1;
            }
        }
+       if (!done && noselected) {
+           while (dsklength-- > 0) {
+               put_word (dskpt, 0);
+               dskpt += 2;
+           }
+           INTREQ (0x8000 | 0x1000);
+           done = 1;
+       }
+
        if (done) {
            linecounter = 2;
            dskdmaen = 0;
@@ -2948,6 +2999,7 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32)
     int ret, i;
     drive *drv = &floppy[num];
     uae_u32 dos, crc, crc2;
+    int wasdelayed = drv->dskchange_time;
 
     ret = 0;
     drv->cyl = 0;
@@ -2976,8 +3028,10 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32)
        crc += v;
     }
     crc ^= 0xffffffff;
-    if (crc != crc2)
-       return 3;
+    if (crc != crc2) {
+       ret = 3;
+       goto end;
+    }
     if (dos == 0x444f5300)
        ret = 10;
     else if (dos == 0x444f5301 || dos == 0x444f5302 || dos == 0x444f5303)
@@ -2988,6 +3042,12 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32)
        ret = 4;
 end:
     drive_image_free (drv);
+    if (wasdelayed > 1) {
+       drive_eject (drv);
+       currprefs.df[num][0] = 0;
+       drv->dskchange_time = wasdelayed;
+       disk_insert (num, drv->newname);
+    }
     return ret;
 }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index e57837d..aa4995c
--- a/drawing.c
+++ b/drawing.c
@@ -367,6 +367,10 @@ static void pfield_init_linetoscr (void)
     }
 }
 
+void drawing_adjust_mousepos(int *xp, int *yp)
+{
+}
+
 static uae_u8 merge_2pixel8(uae_u8 p1, uae_u8 p2)
 {
     return p1;
@@ -1797,6 +1801,9 @@ static const char *numbers = { /* ugly  0123456789CHD%+- */
 
 STATIC_INLINE void putpixel (int x, xcolnr c8)
 {
+    if (x <= 0)
+       return;
+
     switch(gfxvidinfo.pixbytes)
     {
     case 1:
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 24a6fad..01ab0ec
@@ -125,6 +125,7 @@ uaecptr ROM_filesys_resname, ROM_filesys_resid;
 uaecptr ROM_filesys_diagentry;
 uaecptr ROM_hardfile_resname, ROM_hardfile_resid;
 uaecptr ROM_hardfile_init;
+int uae_boot_rom;
 
 /* ********************************************************** */
 
@@ -133,6 +134,8 @@ static void (*card_map[MAX_EXPANSION_BOARDS]) (void);
 
 static int ecard;
 
+static uae_u16 uae_id;
+
 /* ********************************************************** */
 
 /* Please note: ZorroIII implementation seems to work different
@@ -733,7 +736,7 @@ uae_u32 gfxmem_start;
 static void expamem_map_fastcard (void)
 {
     fastmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
-    map_banks (&fastmem_bank, fastmem_start >> 16, allocated_fastmem >> 16, allocated_fastmem);
+    map_banks (&fastmem_bank, fastmem_start >> 16, allocated_fastmem >> 16, 0);
     write_log ("Fastcard: mapped @$%lx: %dMB fast memory\n", fastmem_start, allocated_fastmem >> 20);
 }
 
@@ -753,8 +756,8 @@ static void expamem_init_fastcard (void)
 
     expamem_write (0x04, 1);
 
-    expamem_write (0x10, hackers_id >> 8);
-    expamem_write (0x14, hackers_id & 0xff);
+    expamem_write (0x10, uae_id >> 8);
+    expamem_write (0x14, uae_id & 0xff);
 
     expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
     expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
@@ -804,8 +807,8 @@ static void expamem_init_filesys (void)
     expamem_write (0x08, no_shutup);
 
     expamem_write (0x04, 2);
-    expamem_write (0x10, hackers_id >> 8);
-    expamem_write (0x14, hackers_id & 0xff);
+    expamem_write (0x10, uae_id >> 8);
+    expamem_write (0x14, uae_id & 0xff);
 
     expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
     expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
@@ -875,8 +878,8 @@ static void expamem_init_z3fastmem (void)
 
     expamem_write (0x04, 3);
 
-    expamem_write (0x10, hackers_id >> 8);
-    expamem_write (0x14, hackers_id & 0xff);
+    expamem_write (0x10, uae_id >> 8);
+    expamem_write (0x14, uae_id & 0xff);
 
     expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
     expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
@@ -901,7 +904,7 @@ static void expamem_init_z3fastmem (void)
 static void expamem_map_gfxcard (void)
 {
     gfxmem_start = ((expamem_hi | (expamem_lo >> 4)) << 16);
-    map_banks (&gfxmem_bank, gfxmem_start >> 16, allocated_gfxmem >> 16, allocated_gfxmem);
+    map_banks (&gfxmem_bank, gfxmem_start >> 16, allocated_gfxmem >> 16, 0);
     write_log ("UAEGFX-card: mapped @$%lx, %d MB RTG RAM\n", gfxmem_start, allocated_gfxmem / 0x100000);
 }
 
@@ -922,8 +925,8 @@ static void expamem_init_gfxcard (void)
     expamem_write (0x08, no_shutup | force_z3 | (allocated_gfxmem > 0x800000 ? ext_size : Z3_MEM_AUTO));
     expamem_write (0x04, 96);
 
-    expamem_write (0x10, hackers_id >> 8);
-    expamem_write (0x14, hackers_id & 0xff);
+    expamem_write (0x10, uae_id >> 8);
+    expamem_write (0x14, uae_id & 0xff);
 
     expamem_write (0x18, 0x00); /* ser.no. Byte 0 */
     expamem_write (0x1c, 0x00); /* ser.no. Byte 1 */
@@ -1026,24 +1029,18 @@ static void allocate_expamem (void)
 #endif /* SAVESTATE */
 }
 
-extern int cdtv_enabled;
-
 void expamem_reset (void)
 {
     int do_mount = 1;
     int cardno = 0;
     ecard = 0;
 
+    uae_id = hackers_id;
+
     allocate_expamem ();
 
-#ifdef CDTV
-#if 0
-    if (cdtv_enabled) {
-       map_banks (&dmac_bank, DMAC_START >> 16, 0x10000 >> 16, 0x10000);
+    if (currprefs.cs_cdtvcd)
        dmac_init ();
-    }
-#endif
-#endif
 
     /* check if Kickstart version is below 1.3 */
     if (! ersatzkickfile && kickstart_version
@@ -1058,7 +1055,7 @@ void expamem_reset (void)
     }
 #ifdef FILESYS
     /* No need for filesystem stuff if there aren't any mounted.  */
-    if (nr_units (currprefs.mountinfo) == 0)
+    if (nr_units() == 0)
        do_mount = 0;
 #endif
     if (fastmemory != NULL) {
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 23dd959..60acdaa
--- a/filesys.c
+++ b/filesys.c
@@ -96,6 +96,7 @@ static uae_u32 fsdevname, filesys_configdev;
 #define DEVNAMES_PER_HDF 32
 
 typedef struct {
+    int open;
     char *devname; /* device name, e.g. UAE0: */
     uaecptr devname_amiga;
     uaecptr startup;
@@ -105,7 +106,6 @@ typedef struct {
     int readonly; /* disallow write access? */
     int bootpri; /* boot priority */
     int devno;
-    int automounted; /* don't save to config if set */
 
     struct hardfiledata hf;
 
@@ -129,26 +129,27 @@ typedef struct {
 } UnitInfo;
 
 struct uaedev_mount_info {
-    int num_units;
     UnitInfo ui[MAX_FILESYSTEM_UNITS];
 };
 
-static struct uaedev_mount_info current_mountinfo;
-struct uaedev_mount_info options_mountinfo;
+static struct uaedev_mount_info mountinfo;
 
-int nr_units (struct uaedev_mount_info *mountinfo)
+int nr_units (void)
 {
-    return mountinfo->num_units;
+    int i, cnt = 0;
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+       if (mountinfo.ui[i].open)
+           cnt++;
+    }
+    return cnt;
 }
 
-int is_hardfile (struct uaedev_mount_info *mountinfo, int unit_no)
+int is_hardfile (int unit_no)
 {
-    if (!mountinfo)
-       mountinfo = &current_mountinfo;
-    if (mountinfo->ui[unit_no].volname)
+    if (mountinfo.ui[unit_no].volname)
        return FILESYS_VIRTUAL;
-    if (mountinfo->ui[unit_no].hf.secspertrack == 0) {
-       if (mountinfo->ui[unit_no].hf.flags & 1)
+    if (mountinfo.ui[unit_no].hf.secspertrack == 0) {
+       if (mountinfo.ui[unit_no].hf.flags & 1)
            return FILESYS_HARDDRIVE;
        return FILESYS_HARDFILE_RDB;
     }
@@ -157,6 +158,8 @@ int is_hardfile (struct uaedev_mount_info *mountinfo, int unit_no)
 
 static void close_filesys_unit (UnitInfo *uip)
 {
+    if (!uip->open)
+       return;
     if (uip->hf.handle_valid)
        hdf_close (&uip->hf);
     if (uip->volname != 0)
@@ -177,39 +180,51 @@ static void close_filesys_unit (UnitInfo *uip)
     uip->volname = 0;
     uip->devname = 0;
     uip->rootdir = 0;
+    uip->open = 0;
 }
 
-char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr,
-                       char **devname, char **volname, char **rootdir, int *readonly,
-                       int *secspertrack, int *surfaces, int *reserved,
-                       int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir, int *flags)
+static UnitInfo *getuip(struct uae_prefs *p, int index)
 {
-    UnitInfo *uip = mountinfo->ui + nr;
+    if (index < 0)
+       return NULL;
+    index = p->mountconfig[index].configoffset;
+    if (index < 0)
+       return NULL;
+    return &mountinfo.ui[index];
+}
 
-    if (nr >= mountinfo->num_units)
-       return "No slot allocated for this unit";
+int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo *mi)
+{
+    UnitInfo *ui = getuip(p, index);
+    struct uaedev_config_info *uci = &p->mountconfig[index];
+    UnitInfo uitmp;
 
-    *volname = uip->volname ? my_strdup (uip->volname) : 0;
-    if (uip->devname == 0 || strlen(uip->devname) == 0) {
-       *devname = xmalloc (10);
-       sprintf (*devname, "DH%d", nr);
+    memset(mi, 0, sizeof (struct mountedinfo));
+    memset(&uitmp, 0, sizeof uitmp);
+    if (!ui) {
+       ui = &uitmp;
+        if (uci->volname[0]) {
+           return FILESYS_VIRTUAL;
+       } else {
+           ui->hf.readonly = 1;
+           ui->hf.blocksize = uci->blocksize;
+           if (!hdf_open (&ui->hf, uci->rootdir))
+               return -1;
+           hdf_close (&ui->hf);
+       }
     } else {
-       *devname = my_strdup (uip->devname);
-    }
-    *rootdir = uip->rootdir ? my_strdup (uip->rootdir) : 0;
-    *readonly = uip->readonly;
-    *secspertrack = uip->hf.secspertrack;
-    *surfaces = uip->hf.surfaces;
-    *reserved = uip->hf.reservedblocks;
-    *cylinders = uip->hf.nrcyls;
-    *blocksize = uip->hf.blocksize;
-    *size = uip->hf.size;
-    *bootpri = uip->bootpri;
-    if (flags)
-       *flags = uip->automounted ? FILESYS_FLAG_DONOTSAVE : 0;
-    if (filesysdir)
-       *filesysdir = uip->filesysdir ? my_strdup (uip->filesysdir) : 0;
-    return 0;
+       mi->ismounted = 1;
+    }
+    mi->size = ui->hf.size;
+    mi->nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.size / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0);
+    if (ui->volname)
+       return FILESYS_VIRTUAL;
+    if (ui->hf.secspertrack == 0) {
+       if (ui->hf.flags & 1)
+           return FILESYS_HARDDRIVE;
+       return FILESYS_HARDFILE_RDB;
+    }
+    return FILESYS_HARDFILE;
 }
 
 static void stripsemicolon(char *s)
@@ -220,27 +235,36 @@ static void stripsemicolon(char *s)
        s[strlen(s) - 1] = 0;
 }
 
-static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr,
+static int set_filesys_unit_1 (int nr,
                                 char *devname, char *volname, char *rootdir, int readonly,
                                 int secspertrack, int surfaces, int reserved,
                                 int blocksize, int bootpri, char *filesysdir, int flags)
 {
-    UnitInfo *ui = mountinfo->ui + nr;
-    static char errmsg[1024];
+    UnitInfo *ui;
     int i;
 
-    if (nr >= mountinfo->num_units)
-       return "No slot allocated for this unit";
+    if (nr < 0) {
+       for (nr = 0; nr < MAX_FILESYSTEM_UNITS; nr++) {
+           if (!mountinfo.ui[nr].open)
+               break;
+       }
+       if (nr == MAX_FILESYSTEM_UNITS) {
+           write_log("No slot allocated for this unit\n");
+           return -1;
+       }
+    }
 
-    for (i = 0; i < mountinfo->num_units; i++) {
-        if (nr == i)
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+        if (nr == i || !mountinfo.ui[i].open)
            continue;
-       if (!strcmpi (mountinfo->ui[i].rootdir, rootdir)) {
-           sprintf (errmsg, "directory/hardfile '%s' already added", rootdir);
-           return errmsg;
+       if (!strcmpi (mountinfo.ui[i].rootdir, rootdir)) {
+           write_log ("directory/hardfile '%s' already added\n", rootdir);
+           return -1;
        }
     }
 
+    ui = &mountinfo.ui[nr];
+    ui->open = 0;
     ui->devname = 0;
     ui->volname = 0;
     ui->rootdir = 0;
@@ -249,16 +273,15 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr,
     ui->hf.handle_valid = 0;
     ui->bootpri = 0;
     ui->filesysdir = 0;
-    ui->automounted = flags & FILESYS_FLAG_DONOTSAVE;
 
-    if (volname != 0) {
+    if (volname != 0 && volname[0]) {
        int flags;
        ui->volname = my_strdup (volname);
        stripsemicolon(ui->volname);
        flags = my_getvolumeinfo (rootdir);
        if (flags < 0) {
-           sprintf (errmsg, "directory '%s' not found", rootdir);
-           return errmsg;
+           write_log ("directory '%s' not found\n", rootdir);
+           return -1;
        }
        if (flags & MYVOLUMEINFO_READONLY) {
            write_log ("'%s' set to read-only\n", rootdir);
@@ -277,16 +300,24 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr,
            hdf_open (&ui->hf, rootdir);
        }
        ui->hf.readonly = readonly;
-       if (ui->hf.handle_valid == 0)
-           return "Hardfile not found";
-       if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0)
-           return "Bad blocksize";
+       if (ui->hf.handle_valid == 0) {
+           write_log ("Hardfile %s not found\n", ui->hf.device_name);
+           goto err;
+       }
+       if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0) {
+           write_log("Hardfile %s bad blocksize\n", ui->hf.device_name);
+           goto err;
+       }
        if ((ui->hf.secspertrack || ui->hf.surfaces || ui->hf.reservedblocks) &&
            (ui->hf.secspertrack < 1 || ui->hf.surfaces < 1 || ui->hf.surfaces > 1023 ||
-           ui->hf.reservedblocks < 0 || ui->hf.reservedblocks > 1023) != 0)
-           return "Bad hardfile geometry";
-       if (ui->hf.blocksize > ui->hf.size || ui->hf.size == 0)
-           return "Hardfile too small";
+           ui->hf.reservedblocks < 0 || ui->hf.reservedblocks > 1023) != 0) {
+               write_log("Hardfile %s bad hardfile geometry\n", ui->hf.device_name);
+               goto err;
+       }
+       if (ui->hf.blocksize > ui->hf.size || ui->hf.size == 0) {
+           write_log("Hardfile %s Hardfile too small\n", ui->hf.device_name);
+           goto err;
+       }
        ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.size / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0);
     }
     ui->self = 0;
@@ -294,98 +325,98 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr,
     ui->rootdir = my_strdup (rootdir);
     ui->devname = my_strdup (devname);
     stripsemicolon(ui->devname);
-    if (filesysdir)
+    if (filesysdir && filesysdir[0])
        ui->filesysdir = my_strdup (filesysdir);
     ui->readonly = readonly;
     if (bootpri < -128) bootpri = -128;
     if (bootpri > 127) bootpri = 127;
     ui->bootpri = bootpri;
+    ui->open = 1;
 
-    return 0;
+    return nr;
+err:
+    if (ui->hf.handle_valid)
+       hdf_close(&ui->hf);
+    return -1;
 }
 
-char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int nr,
+static int set_filesys_unit (int nr,
                        char *devname, char *volname, char *rootdir, int readonly,
                        int secspertrack, int surfaces, int reserved,
                        int blocksize, int bootpri, char *filesysdir, int flags)
 {
-    char *result;
+    int ret;
 
-    UnitInfo ui = mountinfo->ui[nr];
-    hdf_close (&ui.hf);
-    result = set_filesys_unit_1 (mountinfo, nr, devname, volname, rootdir, readonly,
+    ret = set_filesys_unit_1 (nr, devname, volname, rootdir, readonly,
        secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, flags);
-    if (result)
-       mountinfo->ui[nr] = ui;
-    else
-       close_filesys_unit (&ui);
-
-    return result;
+    return ret;
 }
 
-char *add_filesys_unit (struct uaedev_mount_info *mountinfo,
-                       char *devname, char *volname, char *rootdir, int readonly,
+static int add_filesys_unit (char *devname, char *volname, char *rootdir, int readonly,
                        int secspertrack, int surfaces, int reserved,
                        int blocksize, int bootpri, char *filesysdir, int flags)
 {
-    char *retval;
-    int nr = mountinfo->num_units;
-    UnitInfo *uip = mountinfo->ui + nr;
+    int ret;
 
-    if (nr >= MAX_FILESYSTEM_UNITS)
-       return "Maximum number of file systems mounted";
+    if (nr_units() >= MAX_FILESYSTEM_UNITS)
+       return -1;
 
-    mountinfo->num_units++;
-    retval = set_filesys_unit_1 (mountinfo, nr, devname, volname, rootdir, readonly,
+    ret = set_filesys_unit_1 (-1, devname, volname, rootdir, readonly,
                                 secspertrack, surfaces, reserved, blocksize, bootpri, filesysdir, flags);
-    if (retval)
-       mountinfo->num_units--;
-    return retval;
+    return ret;
 }
 
-int kill_filesys_unit (struct uaedev_mount_info *mountinfo, int nr)
+int kill_filesys_unitconfig (struct uae_prefs *p, int nr)
 {
-    UnitInfo *uip = mountinfo->ui;
-    if (nr >= mountinfo->num_units || nr < 0)
-       return -1;
+    struct uaedev_config_info *uci;
 
-    close_filesys_unit (mountinfo->ui + nr);
-
-    mountinfo->num_units--;
-    for (; nr < mountinfo->num_units; nr++) {
-       uip[nr] = uip[nr+1];
+    if (nr < 0)
+       return 0;
+    uci = &p->mountconfig[nr];
+    while (nr < MOUNT_CONFIG_SIZE) {
+       memmove (&p->mountconfig[nr], &p->mountconfig[nr + 1], sizeof (struct uaedev_config_info));
+       nr++;
     }
-    return 0;
+    p->mountitems--;
+    memset (&p->mountconfig[MOUNT_CONFIG_SIZE - 1], 0, sizeof (struct uaedev_config_info));
+    return 1;
 }
 
-int move_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, int to)
+int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to)
 {
-    UnitInfo tmpui;
-    UnitInfo *uip = mountinfo->ui;
+    struct uaedev_config_info *uci1, *uci2, tmpuci;
 
-    if (nr >= mountinfo->num_units || nr < 0
-       || to >= mountinfo->num_units || to < 0
-       || to == nr)
-       return -1;
-    tmpui = uip[nr];
-    if (to > nr) {
-       int i;
-       for (i = nr; i < to; i++)
-           uip[i] = uip[i + 1];
-    } else {
-       int i;
-       for (i = nr; i > to; i--)
-           uip[i] = uip[i - 1];
+    uci1 = &p->mountconfig[nr];
+    uci2 = &p->mountconfig[to];
+    if (nr == to)
+       return 0;
+    memcpy (&tmpuci, uci1, sizeof (struct uaedev_config_info));
+    memcpy (uci1, uci2, sizeof (struct uaedev_config_info));
+    memcpy (uci2, &tmpuci, sizeof (struct uaedev_config_info));
+    return 1;
+}
+
+static void initialize_mountinfo(void)
+{
+    int i;
+    struct uaedev_config_info *uci;
+    UnitInfo *uip = &mountinfo.ui[0];
+
+    for (i = 0; i < currprefs.mountitems; i++) {
+       int idx;
+       uci = &currprefs.mountconfig[i];
+       idx = set_filesys_unit_1 (-1, uci->devname, uci->volname, uci->rootdir,
+           uci->readonly, uci->sectors, uci->surfaces, uci->reserved,
+           uci->blocksize, uci->bootpri, uci->filesys, 0);
+       if (idx >= 0)
+           uci->configoffset = idx;
     }
-    uip[to] = tmpui;
-    return 0;
 }
 
-int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int num)
+
+int sprintf_filesys_unit (char *buffer, int num)
 {
-    UnitInfo *uip = mountinfo->ui;
-    if (num >= mountinfo->num_units)
-       return -1;
+    UnitInfo *uip = mountinfo.ui;
 
     if (uip[num].volname != 0)
        sprintf (buffer, "(DH%d:) Filesystem, %s: %s %s", num, uip[num].volname,
@@ -396,81 +427,17 @@ int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int
     return 0;
 }
 
-void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mountinfo,
-                          const char *unexpanded, const char *default_path, struct zfile *f)
-{
-    UnitInfo *uip = mountinfo->ui;
-    int i;
-    char tmp[MAX_DPATH];
-
-    for (i = 0; i < mountinfo->num_units; i++) {
-       int dosave = 1;
-       char *str;
-
-#ifdef _WIN32
-       if (p->win32_automount_drives && uip[i].automounted)
-           dosave = 0;
-#endif
-       if (!dosave)
-           continue;
-       str = cfgfile_subst_path (default_path, unexpanded, uip[i].rootdir);
-       if (uip[i].volname != 0) {
-           sprintf (tmp, "filesystem2=%s,%s:%s:%s,%d\n", uip[i].readonly ? "ro" : "rw",
-               uip[i].devname ? uip[i].devname : "", uip[i].volname, str, uip[i].bootpri);
-           zfile_fputs (f, tmp);
-           sprintf (tmp, "filesystem=%s,%s:%s\n", uip[i].readonly ? "ro" : "rw",
-               uip[i].volname, str);
-           zfile_fputs (f, tmp);
-       } else {
-           sprintf (tmp, "hardfile2=%s,%s:%s,%d,%d,%d,%d,%d,%s\n",
-                    uip[i].readonly ? "ro" : "rw",
-                    uip[i].devname ? uip[i].devname : "", str,
-                    uip[i].hf.secspertrack, uip[i].hf.surfaces, uip[i].hf.reservedblocks, uip[i].hf.blocksize,
-                    uip[i].bootpri,uip[i].filesysdir ? uip[i].filesysdir : "");
-           zfile_fputs (f, tmp);
-           sprintf (tmp, "hardfile=%s,%d,%d,%d,%d,%s\n",
-                    uip[i].readonly ? "ro" : "rw", uip[i].hf.secspertrack,
-                    uip[i].hf.surfaces, uip[i].hf.reservedblocks, uip[i].hf.blocksize, str);
-           zfile_fputs (f, tmp);
-       }
-       xfree (str);
-    }
-}
-
-static void dup_mountinfo (struct uaedev_mount_info *mip, struct uaedev_mount_info *mip_d)
+void free_mountinfo (void)
 {
     int i;
-    struct uaedev_mount_info *i2 = mip_d;
-
-    memcpy (i2, mip, sizeof *i2);
-
-    for (i = 0; i < i2->num_units; i++) {
-       UnitInfo *uip = i2->ui + i;
-       if (uip->volname)
-           uip->volname = my_strdup (uip->volname);
-       if (uip->devname)
-           uip->devname = my_strdup (uip->devname);
-       if (uip->rootdir)
-           uip->rootdir = my_strdup (uip->rootdir);
-       if (uip->hf.handle_valid)
-           hdf_dup (&uip->hf, &uip->hf);
-    }
-}
-
-void free_mountinfo (struct uaedev_mount_info *mip)
-{
-    int i;
-    if (!mip)
-       return;
-    for (i = 0; i < mip->num_units; i++)
-       close_filesys_unit (mip->ui + i);
-    mip->num_units = 0;
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++)
+       close_filesys_unit (mountinfo.ui + i);
 }
 
 struct hardfiledata *get_hardfile_data (int nr)
 {
-    UnitInfo *uip = current_mountinfo.ui;
-    if (nr < 0 || nr >= current_mountinfo.num_units || uip[nr].volname != 0)
+    UnitInfo *uip = mountinfo.ui;
+    if (nr < 0 || uip[nr].open == 0 || uip[nr].volname != 0)
        return 0;
     return &uip[nr].hf;
 }
@@ -1304,7 +1271,7 @@ static Unit *startup_create_unit (UnitInfo *uinfo)
     int i;
     Unit *unit;
 
-    unit = (Unit *) xcalloc (sizeof (Unit), 1);
+    unit = xcalloc (sizeof (Unit), 1);
     unit->next = units;
     units = unit;
     uinfo->self = unit;
@@ -1368,24 +1335,26 @@ static uae_u32 REGPARAM2 startup_handler (TrapContext *context)
     if (s)
        *s = '\0';
 
-    for (i = 0; i < current_mountinfo.num_units; i++) {
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
        /* Hardfile volume name? */
-       if (current_mountinfo.ui[i].volname == 0)
+       if (!mountinfo.ui[i].open)
+           continue;
+       if (mountinfo.ui[i].volname == 0)
            continue;
 
-       if (current_mountinfo.ui[i].startup == arg2)
+       if (mountinfo.ui[i].startup == arg2)
            break;
     }
 
-    if (i == current_mountinfo.num_units
-       || !my_existsdir (current_mountinfo.ui[i].rootdir))
+    if (i == MAX_FILESYSTEM_UNITS
+       || !my_existsdir (mountinfo.ui[i].rootdir))
     {
        write_log ("Failed attempt to mount device '%s'\n", devname);
        put_long (pkt + dp_Res1, DOS_FALSE);
        put_long (pkt + dp_Res2, ERROR_DEVICE_NOT_MOUNTED);
        return 1;
     }
-    uinfo = current_mountinfo.ui + i;
+    uinfo = mountinfo.ui + i;
     unit = startup_create_unit (uinfo);
     unit->volflags = uinfo->volflags;
 
@@ -2063,8 +2032,8 @@ int get_native_path(uae_u32 lock, char *out)
 {
     int i = 0;
     for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
-       if (current_mountinfo.ui[i].self) {
-           a_inode *a = lookup_aino (current_mountinfo.ui[i].self, get_long ((lock << 2) + 4));
+       if (mountinfo.ui[i].self) {
+           a_inode *a = lookup_aino (mountinfo.ui[i].self, get_long ((lock << 2) + 4));
            if (a) {
                strcpy (out, a->nname);
                return 0;
@@ -3283,7 +3252,6 @@ action_is_filesystem (Unit *unit, dpacket packet)
 static void
 action_flush (Unit *unit, dpacket packet)
 {
-    /* sync(); */ /* pretty drastic, eh */
     PUT_PCK_RES1 (packet, DOS_TRUE);
 }
 
@@ -3293,7 +3261,7 @@ static uae_sem_t singlethread_int_sem;
 
 static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
 {
-    UnitInfo *uip = current_mountinfo.ui;
+    UnitInfo *uip = mountinfo.ui;
     uaecptr port;
     int n = m68k_dreg (&context->regs, 0);
     static int unit_no;
@@ -3399,10 +3367,10 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
         * Take care not to dereference self for units that didn't have their
         * startup packet sent. */
        for (;;) {
-           if (unit_no >= current_mountinfo.num_units)
+           if (unit_no >= MAX_FILESYSTEM_UNITS)
                return 0;
 
-           if (uip[unit_no].self != 0
+           if (uip[unit_no].open && uip[unit_no].self != 0
                && uip[unit_no].self->cmds_acked == uip[unit_no].self->cmds_complete
                && uip[unit_no].self->cmds_acked != uip[unit_no].self->cmds_sent)
                break;
@@ -3594,9 +3562,8 @@ static void init_filesys_diagentry (void)
     do_put_mem_long ((uae_u32 *)(filesysory + 0x2100), EXPANSION_explibname);
     do_put_mem_long ((uae_u32 *)(filesysory + 0x2104), filesys_configdev);
     do_put_mem_long ((uae_u32 *)(filesysory + 0x2108), EXPANSION_doslibname);
-    do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), current_mountinfo.num_units);
+    do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), nr_units());
     native2amiga_startup();
-    //cartridge_init();
 }
 
 void filesys_start_threads (void)
@@ -3604,11 +3571,11 @@ void filesys_start_threads (void)
     UnitInfo *uip;
     int i;
 
-    free_mountinfo (&current_mountinfo);
-    dup_mountinfo (&options_mountinfo, &current_mountinfo);
-    uip = current_mountinfo.ui;
-    for (i = 0; i < current_mountinfo.num_units; i++) {
+    uip = mountinfo.ui;
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
        UnitInfo *ui = &uip[i];
+       if (!ui->open)
+           continue;
        ui->unit_pipe = 0;
        ui->back_pipe = 0;
        ui->reset_state = FS_STARTUP;
@@ -3617,7 +3584,7 @@ void filesys_start_threads (void)
            ui->self = 0;
        }
 #ifdef UAE_FILESYS_THREADS
-       if (is_hardfile (&current_mountinfo, i) == FILESYS_VIRTUAL) {
+       if (is_hardfile (i) == FILESYS_VIRTUAL) {
            ui->unit_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe));
            ui->back_pipe = (smp_comm_pipe *)xmalloc (sizeof (smp_comm_pipe));
            init_comm_pipe (uip[i].unit_pipe, 100, 3);
@@ -3632,7 +3599,7 @@ void filesys_start_threads (void)
 
 void filesys_cleanup (void)
 {
-    free_mountinfo (&current_mountinfo);
+    free_mountinfo ();
 }
 
 void filesys_reset (void)
@@ -3652,6 +3619,8 @@ void filesys_reset (void)
     units = 0;
     key_uniq = 0;
     a_uniq = 0;
+    free_mountinfo ();
+    initialize_mountinfo();
 }
 
 static void free_all_ainos (Unit *u, a_inode *parent)
@@ -3675,10 +3644,10 @@ void filesys_prepare_reset (void)
 
     if (savestate_state == STATE_RESTORE)
        return;
-    uip = current_mountinfo.ui;
+    uip = mountinfo.ui;
 #ifdef UAE_FILESYS_THREADS
-    for (i = 0; i < current_mountinfo.num_units; i++) {
-       if (uip[i].unit_pipe != 0) {
+    for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+       if (uip[i].open && uip[i].unit_pipe != 0) {
            uae_sem_init (&uip[i].reset_sync_sem, 0, 0);
            uip[i].reset_state = FS_GO_DOWN;
            /* send death message */
@@ -3804,10 +3773,10 @@ static uae_u32 REGPARAM2 filesys_dev_bootfilesys (TrapContext *context)
     uaecptr fsres = get_long (parmpacket + PP_FSRES);
     uaecptr fsnode;
     uae_u32 dostype, dostype2;
-    UnitInfo *uip = current_mountinfo.ui;
+    UnitInfo *uip = mountinfo.ui;
     int no = m68k_dreg (&context->regs, 6);
     int unit_no = no & 65535;
-    int type = is_hardfile (&current_mountinfo, unit_no);
+    int type = is_hardfile (unit_no);
 
     if (type == FILESYS_VIRTUAL)
        return 0;
@@ -3834,7 +3803,7 @@ static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *context)
     int no = m68k_dreg (&context->regs, 6);
     int unit_no = no & 65535;
     int sub_no = no >> 16;
-    UnitInfo *uip = &current_mountinfo.ui[unit_no];
+    UnitInfo *uip = &mountinfo.ui[unit_no];
     int i;
     uaecptr devicenode = m68k_areg (&context->regs, 3);
     uaecptr parmpacket = m68k_areg (&context->regs, 1);
@@ -4028,7 +3997,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
     flags = rl (buf + 20);
     if (flags & 2) { /* do not mount */
        err = -1;
-       write_log("Automount disabled, not mounting\n");
+       write_log("RDB: Automount disabled, not mounting\n");
        goto error;
     }
 
@@ -4047,22 +4016,23 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
     dostype = get_long (parmpacket + 80);
 
     if (dostype == 0) {
-       write_log("failed, dostype==0\n");
+       write_log("RDB: mount failed, dostype=0\n");
        err = -1;
        goto error;
     }
 
     if (hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->size)
-       write_log("WARNING: end of partition > size of disk!\n");
+       write_log("RDB: WARNING: end of partition > size of disk!\n");
 
     err = 2;
 
     /* load custom filesystems if needed */
     if (fileblock == -1 || !legalrdbblock (uip, fileblock))
        goto error;
+
     fsres = get_long (parmpacket + PP_FSRES);
     if (!fsres) {
-       write_log ("FileSystem.resource not found, this shouldn't happen!\n");
+       write_log ("RDB: FileSystem.resource not found, this shouldn't happen!\n");
        goto error;
     }
     fsnode = get_long (fsres + 18);
@@ -4224,22 +4194,22 @@ static void get_new_device (int type, uaecptr parmpacket, char **devname, uaecpt
     }
     *devname_amiga = ds (device_dupfix (get_long (parmpacket + PP_EXPLIB), buffer));
     if (type == FILESYS_VIRTUAL)
-       write_log ("FS: mounted virtual unit %s (%s)\n", buffer, current_mountinfo.ui[unit_no].rootdir);
+       write_log ("FS: mounted virtual unit %s (%s)\n", buffer, mountinfo.ui[unit_no].rootdir);
     else
        write_log ("FS: mounted HDF unit %s (%04.4x-%08.8x, %s)\n", buffer,
-           (uae_u32)(current_mountinfo.ui[unit_no].hf.size >> 32),
-           (uae_u32)(current_mountinfo.ui[unit_no].hf.size),
-           current_mountinfo.ui[unit_no].rootdir);
+           (uae_u32)(mountinfo.ui[unit_no].hf.size >> 32),
+           (uae_u32)(mountinfo.ui[unit_no].hf.size),
+           mountinfo.ui[unit_no].rootdir);
 }
 
 /* Fill in per-unit fields of a parampacket */
 static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *context)
 {
-    UnitInfo *uip = current_mountinfo.ui;
+    UnitInfo *uip = mountinfo.ui;
     int no = m68k_dreg (&context->regs, 6);
     int unit_no = no & 65535;
     int sub_no = no >> 16;
-    int type = is_hardfile (&current_mountinfo, unit_no);
+    int type = is_hardfile (unit_no);
     uaecptr parmpacket = m68k_areg (&context->regs, 0);
 
     if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) {
@@ -4396,10 +4366,10 @@ uae_u8 *save_filesys (int num, int *len)
 {
     uae_u8 *dstbak, *dst;
     UnitInfo *ui;
-    int type = is_hardfile (&current_mountinfo, num);
+    int type = is_hardfile (num);
 
     dstbak = dst = malloc (10000);
-    ui = &current_mountinfo.ui[num];
+    ui = &mountinfo.ui[num];
     save_u32 (1); /* version */
     save_u32 (ui->devno);
     save_u16 (type);
@@ -4427,8 +4397,6 @@ uae_u8 *restore_filesys (uae_u8 *src)
     if (restore_u32 () != 1)
        return src;
     devno = restore_u32 ();
-    if (devno >= current_mountinfo.num_units)
-       return src;
     type = restore_u16 ();
     rootdir = restore_string ();
     devname = restore_string ();
@@ -4436,12 +4404,12 @@ uae_u8 *restore_filesys (uae_u8 *src)
     filesysdir = restore_string ();
     bootpri = restore_u8 ();
     readonly = restore_u8 ();
-    if (set_filesys_unit (&current_mountinfo, devno, devname, volname, rootdir, readonly,
+    if (set_filesys_unit (devno, devname, volname, rootdir, readonly,
        0, 0, 0, 0, bootpri, filesysdir[0] ? filesysdir : NULL, 0)) {
        write_log ("filesys '%s' failed to restore\n", rootdir);
        goto end;
     }
-    ui = &current_mountinfo.ui[devno];
+    ui = &mountinfo.ui[devno];
     ui->startup = restore_u32 ();
     filesys_configdev = restore_u32 ();
     if (type == FILESYS_VIRTUAL)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/fpp.c b/fpp.c
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/fsdb.c b/fsdb.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/gayle.c b/gayle.c
old mode 100755 (executable)
new mode 100644 (file)
index ec2ea54..5659063
--- a/gayle.c
+++ b/gayle.c
@@ -1,7 +1,7 @@
  /*
   * UAE - The Un*x Amiga Emulator
   *
-  * Gayle memory bank
+  * Gayle (and motherboard resources) memory bank
   *
   * (c) 2006 Toni Wilen
   */
@@ -9,9 +9,12 @@
 #include "sysconfig.h"
 #include "sysdeps.h"
 
+#include "options.h"
+
 #include "memory.h"
 #include "custom.h"
 #include "newcpu.h"
+#include "gayle.h"
 
 /*
 D80000 to D8FFFF               64 KB SPARE chip select
@@ -22,7 +25,7 @@ DA8000 to DAFFFF              32 KB Credit Card and IDE configregisters
 DB0000 to DBFFFF               64 KB Not used(reserved for external IDE)
 * DC0000 to DCFFFF             64 KB Real Time Clock(RTC)
 DD0000 to DDFFFF               64 KB RESERVED for DMA controller
-DE0000 to DEFFFF               64 KB Not Used
+DE0000 to DEFFFF               64 KB Motherboard resources
 */
 
 /* Gayle definitions from Linux driver */
@@ -65,7 +68,6 @@ DE0000 to DEFFFF              64 KB Not Used
 
 #define GAYLE_LOG 0
 
-static int gayle_type = -1; // 0=A600/A1200 1=A4000
 static uae_u8 gayle_irq;
 
 static void ide_interrupt(void)
@@ -74,7 +76,6 @@ static void ide_interrupt(void)
     INTREQ (0x8000 | 0x0008);
 }
 
-
 static int ide_read (uaecptr addr, int size)
 {
     addr &= 0xffff;
@@ -82,21 +83,21 @@ static int ide_read (uaecptr addr, int size)
        write_log ("IDE_READ %08.8X\n", addr);
     if (addr == 0x201c) // AR1200 IDE detection hack
        return 0;
-    if (gayle_type < 0)
+    if (currprefs.cs_ide <= 0)
        return 0xffff;
     if (addr == GAYLE_IRQ_4000) {
-       if (gayle_type) {
+       if (currprefs.cs_ide == 2) {
            uae_u8 v = gayle_irq;
            gayle_irq = 0;
            return v;
        }
        return 0;
     } else if (addr == GAYLE_IRQ_1200) {
-       if (!gayle_type)
+       if (currprefs.cs_ide == 1)
            return gayle_irq;
        return 0;
     }
-    if (gayle_type && (addr & 0x2020) == 0x2020)
+    if (currprefs.cs_ide == 2 && (addr & 0x2020) == 0x2020)
        addr &= ~0x2020;
     switch (addr)
     {
@@ -113,18 +114,18 @@ static int ide_read (uaecptr addr, int size)
     return 0xffff;
 }
 
-static void ide_write (uaecptr addr, int val, int size)
+static void ide_write (uaecptr addr, uae_u32 val, int size)
 {
     addr &= 0xffff;
     if (GAYLE_LOG)
        write_log ("IDE_WRITE %08.8X=%08.8X (%d)\n", addr, val, size);
-    if (gayle_type < 0)
+    if (currprefs.cs_ide <= 0)
        return;
-    if (addr == GAYLE_IRQ_1200 && !gayle_type) {
+    if (addr == GAYLE_IRQ_1200 && currprefs.cs_ide == 1) {
        gayle_irq &= val;
        return;
     }
-    if (gayle_type && (addr & 0x2020) == 0x2020)
+    if (currprefs.cs_ide == 2 && (addr & 0x2020) == 0x2020)
        addr &= ~0x2020;
     switch (addr)
     {
@@ -152,8 +153,6 @@ static int gayle_read (uaecptr addr, int size)
        return ide_read(addr, size);
     else if(addr >= 0xd0000 && addr <= 0xdffff)
        return ide_read(addr, size);
-    else if(addr >= 0xe0000 && addr <= 0xeffff)
-        return 0x7f7f;
     return 0;
 }
 static void gayle_write (uaecptr addr, int val, int size)
@@ -213,3 +212,172 @@ void REGPARAM2 gayle_bput (uaecptr addr, uae_u32 value)
 {
     gayle_write (addr, value, 1);
 }
+
+static uae_u8 ramsey_config;
+static int gary_coldboot, gary_toenb, gary_timeout;
+static int garyidoffset;
+
+static void mbres_write (uaecptr addr, uae_u32 val, int size)
+{
+    addr &= 0xffff;
+
+    if (GAYLE_LOG)
+       write_log ("MBRES_WRITE %08.8X=%08.8X (%d) PC=%08.8X\n", addr, val, size, M68K_GETPC);
+    if (addr == 0x1002)
+       garyidoffset = -1;
+    if (addr == 0x03)
+       ramsey_config = val;
+    if (addr == 0x02)
+       gary_coldboot = (val & 0x80) ? 1 : 0;
+    if (addr == 0x01)
+       gary_toenb = (val & 0x80) ? 1 : 0;
+    if (addr == 0x00)
+       gary_timeout = (val & 0x80) ? 1 : 0;
+}
+
+static uae_u32 mbres_read (uaecptr addr, int size)
+{
+    addr &= 0xffff;
+
+    if (GAYLE_LOG)
+       write_log ("MBRES_READ %08.8X\n", addr);
+
+    /* Gary ID (I don't think this exists in real chips..) */
+    if (addr == 0x1002 && currprefs.cs_fatgaryrev >= 0) {
+       garyidoffset++;
+       garyidoffset &= 7;
+       return (currprefs.cs_fatgaryrev << garyidoffset) & 0x80;
+    }
+    if (addr == 0x43) { /* RAMSEY revision */
+       if (currprefs.cs_ramseyrev >= 0)
+           return currprefs.cs_ramseyrev;
+    }
+    if (addr == 0x03) { /* RAMSEY config */
+       if (currprefs.cs_ramseyrev >= 0)
+           return ramsey_config;
+    }
+    if (addr == 0x02) { /* coldreboot flag */
+       if (currprefs.cs_fatgaryrev >= 0)
+           return gary_coldboot ? 0x80 : 0x00;
+    }
+    if (addr == 0x01) { /* toenb flag */
+       if (currprefs.cs_fatgaryrev >= 0)
+           return gary_toenb ? 0x80 : 0x00;
+    }
+    if (addr == 0x00) { /* timeout flag */
+       if (currprefs.cs_fatgaryrev >= 0)
+           return gary_timeout ? 0x80 : 0x00;
+    }
+    return 0;
+}
+
+static uae_u32 REGPARAM3 mbres_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 mbres_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 mbres_bget (uaecptr) REGPARAM;
+static void REGPARAM3 mbres_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 mbres_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 mbres_bput (uaecptr, uae_u32) REGPARAM;
+
+uae_u32 REGPARAM2 mbres_lget (uaecptr addr)
+{
+    addr &= 0xFFFF;
+    return (uae_u32)(mbres_wget (addr) << 16) + mbres_wget (addr + 2);
+}
+uae_u32 REGPARAM2 mbres_wget (uaecptr addr)
+{
+    return mbres_read (addr, 2);
+}
+uae_u32 REGPARAM2 mbres_bget (uaecptr addr)
+{
+    return mbres_read (addr, 1);
+}
+
+void REGPARAM2 mbres_lput (uaecptr addr, uae_u32 value)
+{
+    mbres_wput (addr, value >> 16);
+    mbres_wput (addr + 2, value & 0xffff);
+}
+
+void REGPARAM2 mbres_wput (uaecptr addr, uae_u32 value)
+{
+    mbres_write (addr, value, 2);
+}
+
+void REGPARAM2 mbres_bput (uaecptr addr, uae_u32 value)
+{
+    mbres_write (addr, value, 1);
+}
+
+addrbank mbres_bank = {
+    mbres_lget, mbres_wget, mbres_bget,
+    mbres_lput, mbres_wput, mbres_bput,
+    default_xlate, default_check, NULL, "Motherboard Resources",
+    dummy_lgeti, dummy_wgeti, ABFLAG_IO
+};
+
+static void mbdmac_write (uae_u32 addr, uae_u32 val, int size)
+{
+    if (GAYLE_LOG)
+       write_log ("DMAC_WRITE %08.8X=%08.8X (%d) PC=%08.8X\n", addr, val, size, M68K_GETPC);
+}
+
+static uae_u32 mbdmac_read (uae_u32 addr, int size)
+{
+    if (GAYLE_LOG)
+       write_log ("DMAC_READ %08.8X\n", addr);
+    return 0xff;
+}
+
+static uae_u32 REGPARAM3 mbdmac_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 mbdmac_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 mbdmac_bget (uaecptr) REGPARAM;
+static void REGPARAM3 mbdmac_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 mbdmac_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 mbdmac_bput (uaecptr, uae_u32) REGPARAM;
+
+uae_u32 REGPARAM2 mbdmac_lget (uaecptr addr)
+{
+    addr &= 0xFFFF;
+    return (uae_u32)(mbdmac_wget (addr) << 16) + mbdmac_wget (addr + 2);
+}
+uae_u32 REGPARAM2 mbdmac_wget (uaecptr addr)
+{
+    return mbdmac_read (addr, 2);
+}
+uae_u32 REGPARAM2 mbdmac_bget (uaecptr addr)
+{
+    return mbdmac_read (addr, 1);
+}
+
+void REGPARAM2 mbdmac_lput (uaecptr addr, uae_u32 value)
+{
+    mbdmac_wput (addr, value >> 16);
+    mbdmac_wput (addr + 2, value & 0xffff);
+}
+
+void REGPARAM2 mbdmac_wput (uaecptr addr, uae_u32 value)
+{
+    mbdmac_write (addr, value, 2);
+}
+
+void REGPARAM2 mbdmac_bput (uaecptr addr, uae_u32 value)
+{
+    mbdmac_write (addr, value, 1);
+}
+
+addrbank mbdmac_bank = {
+    mbdmac_lget, mbdmac_wget, mbdmac_bget,
+    mbdmac_lput, mbdmac_wput, mbdmac_bput,
+    default_xlate, default_check, NULL, "DMAC",
+    dummy_lgeti, dummy_wgeti, ABFLAG_IO
+};
+
+void gayle_reset (int hardreset)
+{
+    if (hardreset) {
+       ramsey_config = 0;
+       gary_coldboot = 1;
+       gary_timeout = 0;
+       gary_toenb = 0;
+    }
+}
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/gtkui.c b/gtkui.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 633363d..1b5d6a5
@@ -406,7 +406,7 @@ static uae_u32 REGPARAM2 hardfile_open (TrapContext *context)
        hf_log ("hardfile_open, unit %d (%d), OK\n", unit, m68k_dreg (&context->regs, 0));
        return 0;
     }
-    if (is_hardfile(NULL, unit) == FILESYS_VIRTUAL)
+    if (is_hardfile(unit) == FILESYS_VIRTUAL)
        err = -6;
     hf_log ("hardfile_open, unit %d (%d), ERR=%d\n", unit, m68k_dreg (&context->regs, 0), err);
     put_long (tmp1 + 20, (uae_u32)err);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index de84a01..087ccda
@@ -6,18 +6,10 @@
 extern void akiko_reset (void);
 extern int akiko_init (void);
 extern void akiko_free (void);
-extern int cd32_enabled;
 
 extern void akiko_entergui (void);
 extern void akiko_exitgui (void);
 extern void AKIKO_hsync_handler (void);
 
-extern uae_u32 REGPARAM3 akiko_lget (uaecptr addr) REGPARAM;
-extern uae_u32 REGPARAM3 akiko_wget (uaecptr addr) REGPARAM;
-extern uae_u32 REGPARAM3 akiko_bget (uaecptr addr) REGPARAM;
-extern void REGPARAM3 akiko_bput (uaecptr addr, uae_u32 value) REGPARAM;
-extern void REGPARAM3 akiko_wput (uaecptr addr, uae_u32 value) REGPARAM;
-extern void REGPARAM3 akiko_lput (uaecptr addr, uae_u32 value) REGPARAM;
-
 extern int cd32_enabled;
 extern uae_u8 *extendedkickmemory;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 6aa0916..2adb1c1
@@ -36,28 +36,22 @@ extern uaecptr ROM_hardfile_resname, ROM_hardfile_resid;
 extern uaecptr ROM_hardfile_init;
 extern uaecptr filesys_initcode;
 
-extern int nr_units (struct uaedev_mount_info *mountinfo);
-extern int is_hardfile (struct uaedev_mount_info *mountinfo, int unit_no);
-extern char *set_filesys_unit (struct uaedev_mount_info *mountinfo, int,
-                              char *devname, char *volname, char *rootdir, int readonly,
-                              int secs, int surfaces, int reserved,
-                              int blocksize, int bootpri, char *filesysdir, int flags);
-extern char *add_filesys_unit (struct uaedev_mount_info *mountinfo,
-                              char *devname, char *volname, char *rootdir, int readonly,
-                              int secs, int surfaces, int reserved,
-                              int blocksize, int bootpri, char *filesysdir, int flags);
-extern char *get_filesys_unit (struct uaedev_mount_info *mountinfo, int nr,
-                              char **devname, char **volame, char **rootdir, int *readonly,
-                              int *secspertrack, int *surfaces, int *reserved,
-                              int *cylinders, uae_u64 *size, int *blocksize, int *bootpri, char **filesysdir, int *flags);
-extern int kill_filesys_unit (struct uaedev_mount_info *mountinfo, int);
-extern int move_filesys_unit (struct uaedev_mount_info *mountinfo, int nr, int to);
-extern int sprintf_filesys_unit (struct uaedev_mount_info *mountinfo, char *buffer, int num);
-extern void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mountinfo, const char *unexpanded,
-                                 const char *defaultpath, struct zfile *f);
+extern int is_hardfile (int unit_no);
+extern int nr_units (void);
 
-extern void dup_mountinfo (struct uaedev_mount_info *,  struct uaedev_mount_info *);
-extern void free_mountinfo (struct uaedev_mount_info *);
+struct mountedinfo
+{
+    uae_u64 size;
+    int ismounted;
+    int nrcyls;
+};
+
+extern int add_filesys_unitconfig (struct uae_prefs *p, int index, char *error);
+extern int get_filesys_unitconfig (struct uae_prefs *p, int index, struct mountedinfo*);
+extern int kill_filesys_unitconfig (struct uae_prefs *p, int nr);
+extern int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to);
+
+extern int sprintf_filesys_unit (char *buffer, int num);
 
 extern void filesys_reset (void);
 extern void filesys_cleanup (void);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index a90c2ba..61af3bc
@@ -65,6 +65,7 @@ typedef uae_u8* (*toc_func)(int);
 typedef uae_u8* (*read_func)(int, int);
 typedef int (*write_func)(int, int);
 typedef int (*isatapi_func)(int);
+typedef int (*ismedia_func)(int);
 
 struct device_functions {
     open_bus_func openbus;
@@ -88,6 +89,7 @@ struct device_functions {
 
     scsiinfo_func scsiinfo;
 
+    ismedia_func ismedia;
     
 };
 
@@ -107,6 +109,7 @@ extern uae_u8 *sys_command_cd_read (int mode, int unitnum, int offset);
 extern uae_u8 *sys_command_read (int mode, int unitnum, int offset);
 extern int sys_command_write (int mode, int unitnum, int offset);
 extern int sys_command_scsi_direct (int unitnum, uaecptr request);
+extern int sys_command_ismedia (int mode, int unitnum);
 
 void scsi_atapi_fixup_pre (uae_u8 *scsi_cmd, int *len, uae_u8 **data, int *datalen, int *parm);
 void scsi_atapi_fixup_post (uae_u8 *scsi_cmd, int len, uae_u8 *olddata, uae_u8 *data, int *datalen, int parm);
old mode 100755 (executable)
new mode 100644 (file)
index 1062bc6..55053e7
@@ -38,7 +38,7 @@ struct socketbase {
     struct socketbase *next;
     struct socketbase *nextsig;        /* queue for tasks to signal */
 
-    //int dosignal;            /* signal flag */
+    int dosignal;              /* signal flag */
     uae_u32 ownertask;         /* task that opened the library */
     int signal;                        /* signal allocated for that task */
     int sb_errno, sb_herrno;   /* errno and herrno variables */
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7aeb21a..7c68cd1
@@ -4,9 +4,16 @@
 extern int cdtv_enabled;
 extern addrbank dmac_bank;
 
-#define DMAC_START 0xe90000
-
 extern void dmac_init (void);
+extern void CDTV_hsync_handler(void);
+
+extern void cdtv_entergui (void);
+extern void cdtv_exitgui (void);
+
+void cdtv_battram_write (int addr, int v);
+uae_u8 cdtv_battram_read (int addr);
+
+extern void cdtv_loadcardmem(uae_u8*, int);
 
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
index dcc0471..e223460
@@ -24,3 +24,5 @@ extern int parallel_direct_write_status (uae_u8, uae_u8);
 extern int parallel_direct_read_status (uae_u8*);
 
 extern void CIA_inprec_prepare(void);
+
+extern void rtc_hardreset(void);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 2b782d2..23fa2e4
@@ -6,7 +6,7 @@
   * (c) 1995 Bernd Schmidt
   */
 
-typedef enum { DRV_35_DD, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM } drive_type;
+typedef enum { DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM } drive_type;
 
 extern void DISK_init (void);
 extern void DISK_free (void);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 1d202e2..fa082aa
@@ -38,8 +38,6 @@ struct hardfiledata {
 #define FILESYS_HARDFILE_RDB 2
 #define FILESYS_HARDDRIVE 3
 
-#define FILESYS_FLAG_DONOTSAVE 1
-
 #define MAX_FILESYSTEM_UNITS 30
 
 struct uaedev_mount_info;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/include/gayle.h b/include/gayle.h
new file mode 100644 (file)
index 0000000..ef6f89b
--- /dev/null
@@ -0,0 +1,2 @@
+
+void gayle_reset(int);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 4c7d4cd..8b811ea
@@ -43,6 +43,7 @@ extern uae_u32 allocated_bogomem;
 extern uae_u32 allocated_gfxmem;
 extern uae_u32 allocated_z3fastmem, max_z3fastmem;
 extern uae_u32 allocated_a3000mem;
+extern uae_u32 allocated_cardmem;
 
 extern uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode);
 extern uae_u32 wait_cpu_cycle_read_cycles (uaecptr addr, int mode, int *cycles);
@@ -53,14 +54,16 @@ extern void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v);
 
 #define chipmem_start 0x00000000
 #define bogomem_start 0x00C00000
-#define a3000mem_start 0x07000000
+#define cardmem_start 0x00E00000
 #define kickmem_start 0x00F80000
 extern uaecptr z3fastmem_start;
 extern uaecptr fastmem_start;
+extern uaecptr a3000lmem_start, a3000hmem_start;
 
 extern int ersatzkickfile;
 extern int cloanto_rom;
 extern uae_u16 kickstart_version;
+extern int uae_boot_rom;
 
 extern uae_u8* baseaddr[];
 
@@ -105,6 +108,10 @@ extern addrbank expamem_bank;
 extern addrbank fastmem_bank;
 extern addrbank gfxmem_bank;
 extern addrbank gayle_bank;
+extern addrbank mbres_bank;
+extern addrbank akiko_bank;
+extern addrbank mbdmac_bank;
+extern addrbank cardmem_bank;
 
 extern void rtarea_init (void);
 extern void rtarea_setup (void);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 8b666cc..0ffcc38
@@ -8,15 +8,13 @@
   */
 
 #define UAEMAJOR 1
-#define UAEMINOR 3
-#define UAESUBREV 4
+#define UAEMINOR 4
+#define UAESUBREV 0
 
 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
 
 extern long int version;
 
-struct uaedev_mount_info;
-
 struct strlist {
     struct strlist *next;
     char *option, *value;
@@ -52,6 +50,21 @@ struct wh {
     int width, height;
 };
 
+#define MOUNT_CONFIG_SIZE 30
+struct uaedev_config_info {
+    char devname[MAX_DPATH];
+    char volname[MAX_DPATH];
+    char rootdir[MAX_DPATH];
+    int readonly;
+    int bootpri;
+    char filesys[MAX_DPATH];
+    int surfaces;
+    int sectors;
+    int reserved;
+    int blocksize;
+    int configoffset;
+};
+
 struct uae_prefs {
 
     struct strlist *all_lines;
@@ -170,6 +183,28 @@ struct uae_prefs {
     int tod_hack;
     uae_u32 maprom;
 
+    int cs_compatible;
+    int cs_ciaatod;
+    int cs_rtc;
+    int cs_rtc_adjust;
+    int cs_rtc_adjust_mode;
+    int cs_ksmirror;
+    int cs_cd32cd;
+    int cs_cd32c2p;
+    int cs_cd32nvram;
+    int cs_cdtvcd;
+    int cs_cdtvram;
+    int cs_cdtvcard;
+    int cs_ide;
+    int cs_pcmcia;
+    int cs_a1000ram;
+    int cs_fatgaryrev;
+    int cs_ramseyrev;
+    int cs_agnusrev;
+    int cs_deniserev;
+    int cs_mbdmac;
+    int cs_df0idhw;
+
     char df[4][MAX_DPATH];
     char dfxlist[MAX_SPARE_DRIVES][MAX_DPATH];
     char romfile[MAX_DPATH];
@@ -199,7 +234,8 @@ struct uae_prefs {
     uae_u32 fastmem_size;
     uae_u32 chipmem_size;
     uae_u32 bogomem_size;
-    uae_u32 a3000mem_size;
+    uae_u32 mbresmem_low_size;
+    uae_u32 mbresmem_high_size;
     uae_u32 gfxmem_size;
 
     int kickshifter;
@@ -207,7 +243,8 @@ struct uae_prefs {
     int filesys_custom_uaefsdb;
     int mmkeyboard;
 
-    struct uaedev_mount_info *mountinfo;
+    int mountitems;
+    struct uaedev_config_info mountconfig[MOUNT_CONFIG_SIZE];
 
     int nr_floppies;
     int dfxtype[4];
@@ -227,6 +264,7 @@ struct uae_prefs {
     int win32_notaskbarbutton;
     int win32_alwaysontop;
     int win32_powersavedisabled;
+    int win32_outsidemouse;
 
     int win32_active_priority;
     int win32_inactive_priority;
@@ -276,6 +314,10 @@ extern void save_options (struct zfile *, struct uae_prefs *, int);
 extern void cfgfile_write (struct zfile *, char *format,...);
 extern void cfgfile_target_write (struct zfile *, char *format,...);
 extern void cfgfile_backup (const char *path);
+extern int add_filesys_config (struct uae_prefs *p, int index,
+                       char *devname, char *volname, char *rootdir, int readonly,
+                       int secspertrack, int surfaces, int reserved,
+                       int blocksize, int bootpri, char *filesysdir, int flags);
 
 extern void default_prefs (struct uae_prefs *, int);
 extern void discard_prefs (struct uae_prefs *, int);
@@ -305,6 +347,7 @@ extern uae_u32 cfgfile_uaelib_modify (uae_u32 mode, uae_u32 parms, uae_u32 size,
 extern uae_u32 cfgfile_modify (uae_u32 index, char *parms, uae_u32 size, char *out, uae_u32 outsize);
 extern void cfgfile_addcfgparam (char *);
 extern int build_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck);
+extern int build_in_chipset_prefs (struct uae_prefs *p);
 extern int cmdlineparser (char *s, char *outp[], int max);
 extern int cfgfile_configuration_change(int);
 extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 6394e2a..02a3cee
@@ -88,6 +88,9 @@ extern void restore_bram (int, size_t);
 extern void restore_fram (int, size_t);
 extern void restore_zram (int, size_t);
 extern void restore_pram (int, size_t);
+extern void restore_a3000lram (int, size_t);
+extern void restore_a3000hram (int, size_t);
+
 extern void restore_ram (size_t, uae_u8*);
 
 extern uae_u8 *save_cram (int *);
@@ -95,6 +98,8 @@ extern uae_u8 *save_bram (int *);
 extern uae_u8 *save_fram (int *);
 extern uae_u8 *save_zram (int *);
 extern uae_u8 *save_pram (int *);
+extern uae_u8 *save_a3000lram (int *);
+extern uae_u8 *save_a3000hram (int *);
 
 extern uae_u8 *restore_rom (uae_u8 *);
 extern uae_u8 *save_rom (int, int *, uae_u8 *);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7704a27..5b2977e
@@ -746,24 +746,140 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
 static int ievent_alive = 0;
 static int lastmx, lastmy;
 
-int mousehack_alive (void)
+static uaecptr get_intuitionbase(void)
 {
-    return ievent_alive > 0;
+    uaecptr v = get_long(4);
+    addrbank *b = &get_mem_bank(v);
+
+    if (!b || !b->check(v, 128) || b->flags != ABFLAG_RAM)
+       return 0;
+    v += 378; // liblist
+    while ((v = get_long(v))) {
+       uae_u32 v2 = get_long(v + 10); // name
+       uae_u8 *p;
+       b = &get_mem_bank(v2);
+       if (!b || !b->check (v2, 20))
+           continue;
+       p = b->xlateaddr(v2);
+       if (!strcmp(p, "intuition.library"))
+           return v;
+    }
+    return 0;
 }
 
 static void mousehack_enable (void)
 {
-    if (!mousehack_allowed())
+    if (!uae_boot_rom)
        return;
     if (rtarea[get_long (RTAREA_BASE + 40) + 12 - 1])
        return;
     rtarea[get_long (RTAREA_BASE + 40) + 12 - 1] = 1;
 }
 
+static void mousehack_setpos(int mousexpos, int mouseypos)
+{
+    uae_u8 *p;
+    if (!uae_boot_rom)
+       return;
+    p = rtarea + get_long (RTAREA_BASE + 40) + 12;
+    p[0] = mousexpos >> 8;
+    p[1] = mousexpos;
+    p[2] = mouseypos >> 8;
+    p[3] = mouseypos;
+    //write_log("%dx%d\n", mousexpos, mouseypos);
+}
+
+static int mouseedge_x, mouseedge_y, mouseedge_time;
+#define MOUSEEDGE_RANGE 1000
+#define MOUSEEDGE_RANGE_MENU 1000
+#define MOUSEEDGE_TIME 2
+
+void setamigamouse(int x, int y)
+{
+    mousehack_enable();
+    mousehack_setpos(x, y);
+}
+
+extern void setmouseactivexy(int,int,int);
+extern void drawing_adjust_mousepos(int*,int*);
+static void mouseedge(void)
+{
+    int x, y, dir;
+    uaecptr ib;
+    static int melast_x, melast_y;
+    static int isnonzero;
+
+    if (!currprefs.win32_outsidemouse)
+       return;
+    dir = 0;
+    if (!mouseedge_time) {
+       isnonzero = 0;
+       goto end;
+    }
+    ib = get_intuitionbase();
+    if (!ib)
+       return;
+    x = get_word(ib + 70);
+    y = get_word(ib + 68);
+    if (x || y)
+       isnonzero = 1;
+    //write_log("%x x %d\n", x, y);
+    if (!isnonzero)
+       return;
+    if (melast_x == x) {
+       if (mouseedge_x < -MOUSEEDGE_RANGE) {
+           mouseedge_x = 0;
+           dir |= 1;
+           goto end;
+       }
+       if (mouseedge_x > MOUSEEDGE_RANGE) {
+           mouseedge_x = 0;
+           dir |= 2;
+           goto end;
+       }
+    } else {
+       mouseedge_x = 0;
+        melast_x = x;
+    }
+    if (melast_y == y) {
+       if (mouseedge_y < -MOUSEEDGE_RANGE_MENU) {
+           mouseedge_y = 0;
+           dir |= 4;
+           goto end;
+       }
+       if (mouseedge_y > MOUSEEDGE_RANGE) {
+           mouseedge_y = 0;
+           dir |= 8;
+           goto end;
+       }
+    } else {
+       mouseedge_y = 0;
+        melast_y = y;
+    }
+    return;
+
+end:
+    mouseedge_time = 0;
+    if (dir) {
+       if (!picasso_on) {
+           drawing_adjust_mousepos(&x, &y);
+       }
+       //write_log("%d\n", dir);
+       if (!dmaen(DMA_SPRITE))
+           setmouseactivexy(x, y, 0);
+       else
+           setmouseactivexy(x, y, dir);
+    }
+}
+
+int mousehack_alive (void)
+{
+    return ievent_alive > 0;
+}
+
 static void mousehack_helper (void)
 {
     int mousexpos, mouseypos;
-    uae_u8 *p;
 
     if (!mousehack_allowed())
        return;
@@ -777,13 +893,7 @@ static void mousehack_helper (void)
        mouseypos = coord_native_to_amiga_y (lastmy) << 1;
        mousexpos = coord_native_to_amiga_x (lastmx);
     }
-    if (!mousehack_allowed())
-       mousexpos = mouseypos = 0;
-    p = rtarea + get_long (RTAREA_BASE + 40) + 12;
-    p[0] = mousexpos >> 8;
-    p[1] = mousexpos;
-    p[2] = mouseypos >> 8;
-    p[3] = mouseypos;
+    mousehack_setpos(mousexpos, mouseypos);
 }
 
 STATIC_INLINE int adjust (int val)
@@ -828,6 +938,44 @@ static void mouseupdate (int pct)
 {
     int v, i;
 
+    if (pct == 100) {
+       if (mouse_delta[0][0] < 0) {
+           if (mouseedge_x > 0)
+               mouseedge_x = 0;
+           else
+               mouseedge_x += mouse_delta[0][0];
+           mouseedge_time = MOUSEEDGE_TIME;
+       }
+       if (mouse_delta[0][0] > 0) {
+           if (mouseedge_x < 0)
+               mouseedge_x = 0;
+           else
+               mouseedge_x += mouse_delta[0][0];
+           mouseedge_time = MOUSEEDGE_TIME;
+       }
+       if (mouse_delta[0][1] < 0) {
+           if (mouseedge_y > 0)
+               mouseedge_y = 0;
+           else
+               mouseedge_y += mouse_delta[0][1];
+           mouseedge_time = MOUSEEDGE_TIME;
+       }
+       if (mouse_delta[0][1] > 0) {
+           if (mouseedge_y < 0)
+               mouseedge_y = 0;
+           else
+               mouseedge_y += mouse_delta[0][1];
+           mouseedge_time = MOUSEEDGE_TIME;
+       }
+       if (mouseedge_time > 0) {
+           mouseedge_time--;
+           if (mouseedge_time == 0) {
+               mouseedge_x = 0;
+               mouseedge_y = 0;
+           }
+       }
+    }
+
     for (i = 0; i < 2; i++) {
 
        v = mouse_delta[i][0] * pct / 100;
@@ -1017,6 +1165,7 @@ uae_u8 handle_joystick_buttons (uae_u8 dra)
            but |= 0x40 << i;
        }
     }
+    //write_log("%02.2X:%02.2X %x\n", dra, but, M68K_GETPC);
     return but;
 }
 
@@ -1613,6 +1762,7 @@ void inputdevice_vsync (void)
     if (arcadia_rom)
        arcadia_vsync ();
 #endif
+    mouseedge();
 }
 
 void inputdevice_reset (void)
@@ -1977,7 +2127,8 @@ void inputdevice_updateconfig (struct uae_prefs *prefs)
        cd32_pad_enabled[1] = 1;
 #endif
 
-    mousehack_enable();
+    if (mousehack_allowed())
+        mousehack_enable();
 }
 
 static void set_kbr_default (struct uae_prefs *p, int index, int num)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 6ef67f9..1de629e
--- a/keybuf.c
+++ b/keybuf.c
@@ -189,7 +189,7 @@ void record_key_direct (int kc)
 
 void joystick_setting_changed (void)
 {
-    fs_np = fs_ck = fs_se;
+    fs_np = fs_ck = fs_se = 0;
 #ifdef ARCADIA 
     fs_xa1 = fs_xa2 = 0;
 #endif
diff --git a/main.c b/main.c
old mode 100755 (executable)
new mode 100644 (file)
index 64ad24c..5d41543
--- a/main.c
+++ b/main.c
@@ -96,7 +96,6 @@ void discard_prefs (struct uae_prefs *p, int type)
     }
 #ifdef FILESYS
     filesys_cleanup ();
-    free_mountinfo (p->mountinfo);
 #endif
 }
 
@@ -124,6 +123,7 @@ void fixup_prefs (struct uae_prefs *p)
 {
     int err = 0;
 
+    build_in_chipset_prefs (p);
     if ((p->chipmem_size & (p->chipmem_size - 1)) != 0
        || p->chipmem_size < 0x40000
        || p->chipmem_size > 0x800000)
@@ -169,16 +169,24 @@ void fixup_prefs (struct uae_prefs *p)
        write_log ("Unsupported bogomem size!\n");
        err = 1;
     }
-    if (p->bogomem_size > 0x100000 && ((p->chipset_mask & CSMASK_AGA) || p->cpu_level >= 2)) {
+    if (p->bogomem_size > 0x100000 && (p->cs_fatgaryrev >= 0 || p->cs_ide || p->cs_ramseyrev >= 0)) {
        p->bogomem_size = 0x100000;
        write_log ("Possible Gayle bogomem conflict fixed\n");
     }
-
     if (p->chipmem_size > 0x200000 && p->fastmem_size != 0) {
        write_log ("You can't use fastmem and more than 2MB chip at the same time!\n");
        p->fastmem_size = 0;
        err = 1;
     }
+    if (p->mbresmem_low_size > 0x04000000 || (p->mbresmem_low_size & 0xfffff)) {
+       p->mbresmem_low_size = 0;
+       write_log ("Unsupported A3000 MB RAM size\n");
+    }
+    if (p->mbresmem_high_size > 0x04000000 || (p->mbresmem_high_size & 0xfffff)) {
+       p->mbresmem_high_size = 0;
+       write_log ("Unsupported Motherboard RAM size\n");
+    }
+
 #if 0
     if (p->m68k_speed < -1 || p->m68k_speed > 20) {
        write_log ("Bad value for -w parameter: must be -1, 0, or within 1..20.\n");
@@ -279,7 +287,16 @@ void fixup_prefs (struct uae_prefs *p)
     }
     if (p->parallel_postscript_emulation)
        p->parallel_postscript_detection = 1;
-
+    if (p->cs_compatible) {
+       p->cs_fatgaryrev = p->cs_ramseyrev = p->cs_mbdmac = -1;
+       p->cs_ide = 0;
+       if (p->cpu_level >= 2) {
+           p->cs_fatgaryrev = 0;
+           p->cs_ide = -1;
+           p->cs_ramseyrev = 0x0f;
+           p->cs_mbdmac = 0;
+       }
+    }
     fixup_prefs_dimensions (p);
 
 #ifdef CPU_68000_ONLY
@@ -402,9 +419,6 @@ static void parse_cmdline (int argc, char **argv)
            if (i + 1 < argc)
                i++;
        } else if (strncmp (argv[i], "-config=", 8) == 0) {
-#ifdef FILESYS
-           free_mountinfo (currprefs.mountinfo);
-#endif
            target_cfgfile_load (&currprefs, argv[i] + 8, -1, 1);
        }
        /* Check for new-style "-f xxx" argument, where xxx is config-file */
@@ -412,9 +426,6 @@ static void parse_cmdline (int argc, char **argv)
            if (i + 1 == argc) {
                write_log ("Missing argument for '-f' option.\n");
            } else {
-#ifdef FILESYS
-               free_mountinfo (currprefs.mountinfo);
-#endif
                target_cfgfile_load (&currprefs, argv[++i], -1, 1);
            }
        } else if (strcmp (argv[i], "-s") == 0) {
@@ -476,12 +487,14 @@ void reset_all_systems (void)
 {
     init_eventtab ();
 
+#ifdef FILESYS
+    filesys_reset ();
+#endif
     memory_reset ();
 #if defined(BSDSOCKET)
     bsdlib_reset ();
 #endif
 #ifdef FILESYS
-    filesys_reset ();
     filesys_start_threads ();
     hardfile_reset ();
 #endif
@@ -572,9 +585,6 @@ static void real_main2 (int argc, char **argv)
 #endif
 
     if (restart_config[0]) {
-#ifdef FILESYS
-       free_mountinfo (currprefs.mountinfo);
-#endif
        default_prefs (&currprefs, 0);
        fixup_prefs (&currprefs);
     }
@@ -631,6 +641,8 @@ static void real_main2 (int argc, char **argv)
                       a config using the cmd-line.  This case handles loads through the GUI. */
     fixup_prefs (&currprefs);
     changed_prefs = currprefs;
+    /* force sound settings change */
+    currprefs.produce_sound = 0;
 
     savestate_init ();
 #ifdef SCSIEMU
@@ -649,12 +661,12 @@ static void real_main2 (int argc, char **argv)
 #ifdef AUTOCONFIG
     expansion_init ();
 #endif
-    memory_init ();
-    memory_reset ();
-
 #ifdef FILESYS
     filesys_install ();
 #endif
+    memory_init ();
+    memory_reset ();
+
 #ifdef AUTOCONFIG
     gfxlib_install ();
 #if defined(BSDSOCKET)
@@ -705,8 +717,6 @@ static void real_main2 (int argc, char **argv)
 
 void real_main (int argc, char **argv)
 {
-    free_mountinfo (&options_mountinfo);
-    currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo;
     restart_program = 1;
     fetch_configurationpath (restart_config, sizeof (restart_config));
     strcat (restart_config, OPTIONSFILENAME);
old mode 100755 (executable)
new mode 100644 (file)
index 0bbf2cc..48fcc21
--- a/memory.c
+++ b/memory.c
@@ -40,7 +40,9 @@ uae_u32 allocated_fastmem;
 uae_u32 allocated_bogomem;
 uae_u32 allocated_gfxmem;
 uae_u32 allocated_z3fastmem;
-uae_u32 allocated_a3000mem;
+uae_u32 allocated_a3000lmem;
+uae_u32 allocated_a3000hmem;
+uae_u32 allocated_cardmem;
 
 #if defined(CPU_64_BIT)
 uae_u32 max_z3fastmem = 2048UL * 1024 * 1024;
@@ -48,9 +50,7 @@ uae_u32 max_z3fastmem = 2048UL * 1024 * 1024;
 uae_u32 max_z3fastmem = 512 * 1024 * 1024;
 #endif
 
-static size_t chip_filepos;
-static size_t bogo_filepos;
-static size_t rom_filepos;
+static size_t chip_filepos, bogo_filepos, rom_filepos, a3000lmem_filepos, a3000hmem_filepos;
 
 static struct romlist *rl;
 static int romlist_cnt;
@@ -95,7 +95,7 @@ static struct romdata roms[] = {
     { "KS ROM v1.1 (A1000)(PAL)", 1, 1, 31, 34, "A1000\0", 0xec86dae2, 262144, 3, 0, 0, ROMTYPE_KICK },
     { "KS ROM v1.2 (A1000)", 1, 2, 33, 166, "A1000\0", 0x9ed783d0, 262144, 4, 0, 0, ROMTYPE_KICK },
     { "KS ROM v1.2 (A500,A1000,A2000)", 1, 2, 33, 180, "A500\0A1000\0A2000\0", 0xa6ce1636, 262144, 5, 0, 0, ROMTYPE_KICK },
-    { "KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, "A500\0A1000\0A2000\0", 0xc4f0f55f, 262144, 6, 60, 0, ROMTYPE_KICK },
+    { "KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, "A500\0A1000\0A2000\0", 0xc4f0f55f, 262144, 6, 0, 0, ROMTYPE_KICK },
     { "KS ROM v1.3 (A3000)", 1, 3, 34, 5, "A3000\0", 0xe0f37258, 262144, 32, 0, 0, ROMTYPE_KICK },
 
     { "KS ROM v2.04 (A500+)", 2, 4, 37, 175, "A500+\0", 0xc3bdb240, 524288, 7, 0, 0, ROMTYPE_KICK },
@@ -104,14 +104,14 @@ static struct romdata roms[] = {
     { "KS ROM v2.05 (A600HD)", 2, 5, 37, 350, "A600HD\0A600\0", 0x43b0df7b, 524288, 10, 0, 0, ROMTYPE_KICK },
 
     { "KS ROM v3.0 (A1200)", 3, 0, 39, 106, "A1200\0", 0x6c9b07d2, 524288, 11, 0, 0, ROMTYPE_KICK },
-    { "KS ROM v3.0 (A4000)", 3, 0, 39, 106, "A4000\0", 0x9e6ac152, 524288, 12, 2, 0, ROMTYPE_KICK },
-    { "KS ROM v3.1 (A4000)", 3, 1, 40, 70, "A4000\0", 0x2b4566f1, 524288, 13, 2, 0, ROMTYPE_KICK },
+    { "KS ROM v3.0 (A4000)", 3, 0, 39, 106, "A4000\0", 0x9e6ac152, 524288, 12, 2 | 4, 0, ROMTYPE_KICK },
+    { "KS ROM v3.1 (A4000)", 3, 1, 40, 70, "A4000\0", 0x2b4566f1, 524288, 13, 2 | 4, 0, ROMTYPE_KICK },
     { "KS ROM v3.1 (A500,A600,A2000)", 3, 1, 40, 63, "A500\0A600\0A2000\0", 0xfc24ae0d, 524288, 14, 0, 0, ROMTYPE_KICK },
     { "KS ROM v3.1 (A1200)", 3, 1, 40, 68, "A1200\0", 0x1483a091, 524288, 15, 1, 0, ROMTYPE_KICK },
-    { "KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, "A4000\0", 0x43b6dd22, 524288, 31, 2, 1, ROMTYPE_KICK },
-    { "KS ROM v3.1 (A4000)", 3, 1, 40, 68, "A4000\0", 0xd6bae334, 524288, 16, 2, 0, ROMTYPE_KICK },
-    { "KS ROM v3.1 (A4000T)", 3, 1, 40, 70, "A4000T\0", 0x75932c3a, 524288, 17, 2, 0, ROMTYPE_KICK },
-    { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 0x08b69382, 524288, 46, 2, 0, ROMTYPE_KICK },
+    { "KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, "A4000\0", 0x43b6dd22, 524288, 31, 2 | 4, 1, ROMTYPE_KICK },
+    { "KS ROM v3.1 (A4000)", 3, 1, 40, 68, "A4000\0", 0xd6bae334, 524288, 16, 2 | 4, 0, ROMTYPE_KICK },
+    { "KS ROM v3.1 (A4000T)", 3, 1, 40, 70, "A4000T\0", 0x75932c3a, 524288, 17, 2 | 4, 0, ROMTYPE_KICK },
+    { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 0x08b69382, 524288, 46, 2 | 4, 0, ROMTYPE_KICK },
 
     { "CD32 KS ROM v3.1", 3, 1, 40, 60, "CD32\0", 0x1e62d4a5, 524288, 18, 1, 0, ROMTYPE_KICKCD32 },
     { "CD32 extended ROM", 3, 1, 40, 60, "CD32\0", 0x87746be2, 524288, 19, 1, 0, ROMTYPE_EXTCD32 },
@@ -586,7 +586,8 @@ __inline__ void byteput (uaecptr addr, uae_u32 b)
 #endif
 
 uae_u32        chipmem_mask, chipmem_full_mask;
-uae_u32 kickmem_mask, extendedkickmem_mask, bogomem_mask, a3000mem_mask;
+uae_u32 kickmem_mask, extendedkickmem_mask, bogomem_mask;
+uae_u32 a3000lmem_mask, a3000hmem_mask, cardmem_mask;
 
 static int illegal_count;
 /* A dummy bank that only contains zeros */
@@ -726,90 +727,6 @@ static int REGPARAM2 dummy_check (uaecptr addr, uae_u32 size)
     return 0;
 }
 
-#ifdef AUTOCONFIG
-
-/* A3000 "motherboard resources" bank. */
-static uae_u32 REGPARAM3 mbres_lget (uaecptr) REGPARAM;
-static uae_u32 REGPARAM3 mbres_wget (uaecptr) REGPARAM;
-static uae_u32 REGPARAM3 mbres_bget (uaecptr) REGPARAM;
-static void REGPARAM3 mbres_lput (uaecptr, uae_u32) REGPARAM;
-static void REGPARAM3 mbres_wput (uaecptr, uae_u32) REGPARAM;
-static void REGPARAM3 mbres_bput (uaecptr, uae_u32) REGPARAM;
-static int REGPARAM3 mbres_check (uaecptr addr, uae_u32 size) REGPARAM;
-
-static int mbres_val = 0;
-
-static uae_u32 REGPARAM2 mbres_lget (uaecptr addr)
-{
-#ifdef JIT
-    special_mem |= S_READ;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal lget at %08lx\n", addr);
-
-    return 0;
-}
-
-static uae_u32 REGPARAM2 mbres_wget (uaecptr addr)
-{
-#ifdef JIT
-    special_mem |= S_READ;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal wget at %08lx\n", addr);
-
-    return 0;
-}
-
-static uae_u32 REGPARAM2 mbres_bget (uaecptr addr)
-{
-#ifdef JIT
-    special_mem |= S_READ;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal bget at %08lx\n", addr);
-
-    return (addr & 0xFFFF) == 3 ? mbres_val : 0;
-}
-
-static void REGPARAM2 mbres_lput (uaecptr addr, uae_u32 l)
-{
-#ifdef JIT
-    special_mem |= S_WRITE;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal lput at %08lx\n", addr);
-}
-static void REGPARAM2 mbres_wput (uaecptr addr, uae_u32 w)
-{
-#ifdef JIT
-    special_mem |= S_WRITE;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal wput at %08lx\n", addr);
-}
-static void REGPARAM2 mbres_bput (uaecptr addr, uae_u32 b)
-{
-#ifdef JIT
-    special_mem |= S_WRITE;
-#endif
-    if (currprefs.illegal_mem)
-       write_log ("Illegal bput at %08lx\n", addr);
-
-    if ((addr & 0xFFFF) == 3)
-       mbres_val = b;
-}
-
-static int REGPARAM2 mbres_check (uaecptr addr, uae_u32 size)
-{
-    if (currprefs.illegal_mem)
-       write_log ("Illegal check at %08lx\n", addr);
-
-    return 0;
-}
-
-#endif
-
 /* Chip memory */
 
 uae_u8 *chipmemory;
@@ -833,7 +750,6 @@ static uae_u32 REGPARAM2 chipmem_lget_ce2 (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u32 *)(chipmemory + addr);
     ce2_timeout ();
@@ -847,7 +763,6 @@ static uae_u32 REGPARAM2 chipmem_wget_ce2 (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u16 *)(chipmemory + addr);
     ce2_timeout ();
@@ -859,7 +774,6 @@ static uae_u32 REGPARAM2 chipmem_bget_ce2 (uaecptr addr)
 #ifdef JIT
     special_mem |= S_READ;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     ce2_timeout ();
     return chipmemory[addr];
@@ -872,7 +786,6 @@ static void REGPARAM2 chipmem_lput_ce2 (uaecptr addr, uae_u32 l)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u32 *)(chipmemory + addr);
     ce2_timeout ();
@@ -886,7 +799,6 @@ static void REGPARAM2 chipmem_wput_ce2 (uaecptr addr, uae_u32 w)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u16 *)(chipmemory + addr);
     ce2_timeout ();
@@ -898,7 +810,6 @@ static void REGPARAM2 chipmem_bput_ce2 (uaecptr addr, uae_u32 b)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     ce2_timeout ();
     chipmemory[addr] = b;
@@ -910,7 +821,6 @@ uae_u32 REGPARAM2 chipmem_lget (uaecptr addr)
 {
     uae_u32 *m;
 
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u32 *)(chipmemory + addr);
     return do_get_mem_long (m);
@@ -920,7 +830,6 @@ static uae_u32 REGPARAM2 chipmem_wget (uaecptr addr)
 {
     uae_u16 *m;
 
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u16 *)(chipmemory + addr);
     return do_get_mem_word (m);
@@ -928,7 +837,6 @@ static uae_u32 REGPARAM2 chipmem_wget (uaecptr addr)
 
 static uae_u32 REGPARAM2 chipmem_bget (uaecptr addr)
 {
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     return chipmemory[addr];
 }
@@ -937,7 +845,6 @@ void REGPARAM2 chipmem_lput (uaecptr addr, uae_u32 l)
 {
     uae_u32 *m;
 
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u32 *)(chipmemory + addr);
     do_put_mem_long (m, l);
@@ -947,7 +854,6 @@ void REGPARAM2 chipmem_wput (uaecptr addr, uae_u32 w)
 {
     uae_u16 *m;
 
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     m = (uae_u16 *)(chipmemory + addr);
     do_put_mem_word (m, w);
@@ -955,7 +861,6 @@ void REGPARAM2 chipmem_wput (uaecptr addr, uae_u32 w)
 
 void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b)
 {
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     chipmemory[addr] = b;
 }
@@ -964,7 +869,6 @@ static uae_u32 REGPARAM2 chipmem_agnus_lget (uaecptr addr)
 {
     uae_u32 *m;
 
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     m = (uae_u32 *)(chipmemory + addr);
     return do_get_mem_long (m);
@@ -974,7 +878,6 @@ uae_u32 REGPARAM2 chipmem_agnus_wget (uaecptr addr)
 {
     uae_u16 *m;
 
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     m = (uae_u16 *)(chipmemory + addr);
     return do_get_mem_word (m);
@@ -982,7 +885,6 @@ uae_u32 REGPARAM2 chipmem_agnus_wget (uaecptr addr)
 
 static uae_u32 REGPARAM2 chipmem_agnus_bget (uaecptr addr)
 {
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     return chipmemory[addr];
 }
@@ -991,7 +893,6 @@ static void REGPARAM2 chipmem_agnus_lput (uaecptr addr, uae_u32 l)
 {
     uae_u32 *m;
 
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     if (addr >= allocated_chipmem)
        return;
@@ -1003,7 +904,6 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w)
 {
     uae_u16 *m;
 
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     if (addr >= allocated_chipmem)
        return;
@@ -1013,7 +913,6 @@ void REGPARAM2 chipmem_agnus_wput (uaecptr addr, uae_u32 w)
 
 static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b)
 {
-    addr -= chipmem_start & chipmem_full_mask;
     addr &= chipmem_full_mask;
     if (addr >= allocated_chipmem)
        return;
@@ -1022,14 +921,12 @@ static void REGPARAM2 chipmem_agnus_bput (uaecptr addr, uae_u32 b)
 
 static int REGPARAM2 chipmem_check (uaecptr addr, uae_u32 size)
 {
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     return (addr + size) <= allocated_chipmem;
 }
 
 static uae_u8 *REGPARAM2 chipmem_xlate (uaecptr addr)
 {
-    addr -= chipmem_start & chipmem_mask;
     addr &= chipmem_mask;
     return chipmemory + addr;
 }
@@ -1050,7 +947,6 @@ static uae_u8 *REGPARAM3 bogomem_xlate (uaecptr addr) REGPARAM;
 static uae_u32 REGPARAM2 bogomem_lget (uaecptr addr)
 {
     uae_u32 *m;
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     m = (uae_u32 *)(bogomemory + addr);
     return do_get_mem_long (m);
@@ -1059,7 +955,6 @@ static uae_u32 REGPARAM2 bogomem_lget (uaecptr addr)
 static uae_u32 REGPARAM2 bogomem_wget (uaecptr addr)
 {
     uae_u16 *m;
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     m = (uae_u16 *)(bogomemory + addr);
     return do_get_mem_word (m);
@@ -1067,7 +962,6 @@ static uae_u32 REGPARAM2 bogomem_wget (uaecptr addr)
 
 static uae_u32 REGPARAM2 bogomem_bget (uaecptr addr)
 {
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     return bogomemory[addr];
 }
@@ -1075,7 +969,6 @@ static uae_u32 REGPARAM2 bogomem_bget (uaecptr addr)
 static void REGPARAM2 bogomem_lput (uaecptr addr, uae_u32 l)
 {
     uae_u32 *m;
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     m = (uae_u32 *)(bogomemory + addr);
     do_put_mem_long (m, l);
@@ -1084,7 +977,6 @@ static void REGPARAM2 bogomem_lput (uaecptr addr, uae_u32 l)
 static void REGPARAM2 bogomem_wput (uaecptr addr, uae_u32 w)
 {
     uae_u16 *m;
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     m = (uae_u16 *)(bogomemory + addr);
     do_put_mem_word (m, w);
@@ -1092,111 +984,230 @@ static void REGPARAM2 bogomem_wput (uaecptr addr, uae_u32 w)
 
 static void REGPARAM2 bogomem_bput (uaecptr addr, uae_u32 b)
 {
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     bogomemory[addr] = b;
 }
 
 static int REGPARAM2 bogomem_check (uaecptr addr, uae_u32 size)
 {
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     return (addr + size) <= allocated_bogomem;
 }
 
 static uae_u8 *REGPARAM2 bogomem_xlate (uaecptr addr)
 {
-    addr -= bogomem_start & bogomem_mask;
     addr &= bogomem_mask;
     return bogomemory + addr;
 }
 
-#ifdef AUTOCONFIG
+/* CDTV expension memory card memory */
 
-/* A3000 motherboard fast memory */
+static uae_u8 *cardmemory;
+
+static uae_u32 REGPARAM3 cardmem_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 cardmem_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 cardmem_bget (uaecptr) REGPARAM;
+static void REGPARAM3 cardmem_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 cardmem_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 cardmem_bput (uaecptr, uae_u32) REGPARAM;
+static int REGPARAM3 cardmem_check (uaecptr addr, uae_u32 size) REGPARAM;
+static uae_u8 *REGPARAM3 cardmem_xlate (uaecptr addr) REGPARAM;
+
+static uae_u32 REGPARAM2 cardmem_lget (uaecptr addr)
+{
+    uae_u32 *m;
+    addr &= cardmem_mask;
+    m = (uae_u32 *)(cardmemory + addr);
+    return do_get_mem_long (m);
+}
+
+static uae_u32 REGPARAM2 cardmem_wget (uaecptr addr)
+{
+    uae_u16 *m;
+    addr &= cardmem_mask;
+    m = (uae_u16 *)(cardmemory + addr);
+    return do_get_mem_word (m);
+}
+
+static uae_u32 REGPARAM2 cardmem_bget (uaecptr addr)
+{
+    addr &= cardmem_mask;
+    return cardmemory[addr];
+}
+
+static void REGPARAM2 cardmem_lput (uaecptr addr, uae_u32 l)
+{
+    uae_u32 *m;
+    addr &= cardmem_mask;
+    m = (uae_u32 *)(cardmemory + addr);
+    do_put_mem_long (m, l);
+}
+
+static void REGPARAM2 cardmem_wput (uaecptr addr, uae_u32 w)
+{
+    uae_u16 *m;
+    addr &= cardmem_mask;
+    m = (uae_u16 *)(cardmemory + addr);
+    do_put_mem_word (m, w);
+}
+
+static void REGPARAM2 cardmem_bput (uaecptr addr, uae_u32 b)
+{
+    addr &= cardmem_mask;
+    cardmemory[addr] = b;
+}
+
+static int REGPARAM2 cardmem_check (uaecptr addr, uae_u32 size)
+{
+    addr &= cardmem_mask;
+    return (addr + size) <= allocated_cardmem;
+}
+
+static uae_u8 *REGPARAM2 cardmem_xlate (uaecptr addr)
+{
+    addr &= cardmem_mask;
+    return cardmemory + addr;
+}
 
-static uae_u8 *a3000memory;
+/* A3000 motherboard fast memory */
+static uae_u8 *a3000lmemory, *a3000hmemory;
+uae_u32 a3000lmem_start, a3000hmem_start;
 
-static uae_u32 REGPARAM3 a3000mem_lget (uaecptr) REGPARAM;
-static uae_u32 REGPARAM3 a3000mem_wget (uaecptr) REGPARAM;
-static uae_u32 REGPARAM3 a3000mem_bget (uaecptr) REGPARAM;
-static void REGPARAM3 a3000mem_lput (uaecptr, uae_u32) REGPARAM;
-static void REGPARAM3 a3000mem_wput (uaecptr, uae_u32) REGPARAM;
-static void REGPARAM3 a3000mem_bput (uaecptr, uae_u32) REGPARAM;
-static int REGPARAM3 a3000mem_check (uaecptr addr, uae_u32 size) REGPARAM;
-static uae_u8 *REGPARAM3 a3000mem_xlate (uaecptr addr) REGPARAM;
+static uae_u32 REGPARAM3 a3000lmem_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 a3000lmem_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 a3000lmem_bget (uaecptr) REGPARAM;
+static void REGPARAM3 a3000lmem_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 a3000lmem_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 a3000lmem_bput (uaecptr, uae_u32) REGPARAM;
+static int REGPARAM3 a3000lmem_check (uaecptr addr, uae_u32 size) REGPARAM;
+static uae_u8 *REGPARAM3 a3000lmem_xlate (uaecptr addr) REGPARAM;
 
-static uae_u32 REGPARAM2 a3000mem_lget (uaecptr addr)
+static uae_u32 REGPARAM2 a3000lmem_lget (uaecptr addr)
 {
     uae_u32 *m;
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    m = (uae_u32 *)(a3000memory + addr);
+    addr &= a3000lmem_mask;
+    m = (uae_u32 *)(a3000lmemory + addr);
     return do_get_mem_long (m);
 }
 
-static uae_u32 REGPARAM2 a3000mem_wget (uaecptr addr)
+static uae_u32 REGPARAM2 a3000lmem_wget (uaecptr addr)
 {
     uae_u16 *m;
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    m = (uae_u16 *)(a3000memory + addr);
+    addr &= a3000lmem_mask;
+    m = (uae_u16 *)(a3000lmemory + addr);
     return do_get_mem_word (m);
 }
 
-static uae_u32 REGPARAM2 a3000mem_bget (uaecptr addr)
+static uae_u32 REGPARAM2 a3000lmem_bget (uaecptr addr)
 {
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    return a3000memory[addr];
+    addr &= a3000lmem_mask;
+    return a3000lmemory[addr];
 }
 
-static void REGPARAM2 a3000mem_lput (uaecptr addr, uae_u32 l)
+static void REGPARAM2 a3000lmem_lput (uaecptr addr, uae_u32 l)
 {
     uae_u32 *m;
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    m = (uae_u32 *)(a3000memory + addr);
+    addr &= a3000lmem_mask;
+    m = (uae_u32 *)(a3000lmemory + addr);
     do_put_mem_long (m, l);
 }
 
-static void REGPARAM2 a3000mem_wput (uaecptr addr, uae_u32 w)
+static void REGPARAM2 a3000lmem_wput (uaecptr addr, uae_u32 w)
 {
     uae_u16 *m;
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    m = (uae_u16 *)(a3000memory + addr);
+    addr &= a3000lmem_mask;
+    m = (uae_u16 *)(a3000lmemory + addr);
     do_put_mem_word (m, w);
 }
 
-static void REGPARAM2 a3000mem_bput (uaecptr addr, uae_u32 b)
+static void REGPARAM2 a3000lmem_bput (uaecptr addr, uae_u32 b)
 {
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    a3000memory[addr] = b;
+    addr &= a3000lmem_mask;
+    a3000lmemory[addr] = b;
 }
 
-static int REGPARAM2 a3000mem_check (uaecptr addr, uae_u32 size)
+static int REGPARAM2 a3000lmem_check (uaecptr addr, uae_u32 size)
 {
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    return (addr + size) <= allocated_a3000mem;
+    addr &= a3000lmem_mask;
+    return (addr + size) <= allocated_a3000lmem;
 }
 
-static uae_u8 *REGPARAM2 a3000mem_xlate (uaecptr addr)
+static uae_u8 *REGPARAM2 a3000lmem_xlate (uaecptr addr)
 {
-    addr -= a3000mem_start & a3000mem_mask;
-    addr &= a3000mem_mask;
-    return a3000memory + addr;
+    addr &= a3000lmem_mask;
+    return a3000lmemory + addr;
 }
 
-#endif
+static uae_u32 REGPARAM3 a3000hmem_lget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 a3000hmem_wget (uaecptr) REGPARAM;
+static uae_u32 REGPARAM3 a3000hmem_bget (uaecptr) REGPARAM;
+static void REGPARAM3 a3000hmem_lput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 a3000hmem_wput (uaecptr, uae_u32) REGPARAM;
+static void REGPARAM3 a3000hmem_bput (uaecptr, uae_u32) REGPARAM;
+static int REGPARAM3 a3000hmem_check (uaecptr addr, uae_u32 size) REGPARAM;
+static uae_u8 *REGPARAM3 a3000hmem_xlate (uaecptr addr) REGPARAM;
+
+static uae_u32 REGPARAM2 a3000hmem_lget (uaecptr addr)
+{
+    uae_u32 *m;
+    addr &= a3000hmem_mask;
+    m = (uae_u32 *)(a3000hmemory + addr);
+    return do_get_mem_long (m);
+}
+
+static uae_u32 REGPARAM2 a3000hmem_wget (uaecptr addr)
+{
+    uae_u16 *m;
+    addr &= a3000hmem_mask;
+    m = (uae_u16 *)(a3000hmemory + addr);
+    return do_get_mem_word (m);
+}
+
+static uae_u32 REGPARAM2 a3000hmem_bget (uaecptr addr)
+{
+    addr &= a3000hmem_mask;
+    return a3000hmemory[addr];
+}
+
+static void REGPARAM2 a3000hmem_lput (uaecptr addr, uae_u32 l)
+{
+    uae_u32 *m;
+    addr &= a3000hmem_mask;
+    m = (uae_u32 *)(a3000hmemory + addr);
+    do_put_mem_long (m, l);
+}
+
+static void REGPARAM2 a3000hmem_wput (uaecptr addr, uae_u32 w)
+{
+    uae_u16 *m;
+    addr &= a3000hmem_mask;
+    m = (uae_u16 *)(a3000hmemory + addr);
+    do_put_mem_word (m, w);
+}
+
+static void REGPARAM2 a3000hmem_bput (uaecptr addr, uae_u32 b)
+{
+    addr &= a3000hmem_mask;
+    a3000hmemory[addr] = b;
+}
+
+static int REGPARAM2 a3000hmem_check (uaecptr addr, uae_u32 size)
+{
+    addr &= a3000hmem_mask;
+    return (addr + size) <= allocated_a3000hmem;
+}
+
+static uae_u8 *REGPARAM2 a3000hmem_xlate (uaecptr addr)
+{
+    addr &= a3000hmem_mask;
+    return a3000hmemory + addr;
+}
 
 /* Kick memory */
 
 uae_u8 *kickmemory;
 uae_u16 kickstart_version;
-int kickmem_size = 0x80000;
+static int kickmem_size;
 
 /*
  * A1000 kickstart RAM handling
@@ -1217,9 +1228,7 @@ static void a1000_handle_kickstart (int mode)
        kickstart_version = (kickmemory[262144 + 12] << 8) | kickmemory[262144 + 13];
     } else {
        a1000_kickstart_mode = 1;
-       memset (kickmemory, 0, 262144);
-       memcpy (kickmemory, a1000_bootrom, 65536);
-       memcpy (kickmemory + 131072, a1000_bootrom, 65536);
+       memcpy (kickmemory, a1000_bootrom, 262144);
        kickstart_version = 0;
     }
 }
@@ -1241,7 +1250,6 @@ static uae_u8 *REGPARAM3 kickmem_xlate (uaecptr addr) REGPARAM;
 static uae_u32 REGPARAM2 kickmem_lget (uaecptr addr)
 {
     uae_u32 *m;
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     m = (uae_u32 *)(kickmemory + addr);
     return do_get_mem_long (m);
@@ -1250,7 +1258,6 @@ static uae_u32 REGPARAM2 kickmem_lget (uaecptr addr)
 static uae_u32 REGPARAM2 kickmem_wget (uaecptr addr)
 {
     uae_u16 *m;
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     m = (uae_u16 *)(kickmemory + addr);
     return do_get_mem_word (m);
@@ -1258,7 +1265,6 @@ static uae_u32 REGPARAM2 kickmem_wget (uaecptr addr)
 
 static uae_u32 REGPARAM2 kickmem_bget (uaecptr addr)
 {
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     return kickmemory[addr];
 }
@@ -1271,7 +1277,6 @@ static void REGPARAM2 kickmem_lput (uaecptr addr, uae_u32 b)
 #endif
     if (a1000_kickstart_mode) {
        if (addr >= 0xfc0000) {
-           addr -= kickmem_start & kickmem_mask;
            addr &= kickmem_mask;
            m = (uae_u32 *)(kickmemory + addr);
            do_put_mem_long (m, b);
@@ -1290,7 +1295,6 @@ static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
 #endif
     if (a1000_kickstart_mode) {
        if (addr >= 0xfc0000) {
-           addr -= kickmem_start & kickmem_mask;
            addr &= kickmem_mask;
            m = (uae_u16 *)(kickmemory + addr);
            do_put_mem_word (m, b);
@@ -1308,7 +1312,6 @@ static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
 #endif
     if (a1000_kickstart_mode) {
        if (addr >= 0xfc0000) {
-           addr -= kickmem_start & kickmem_mask;
            addr &= kickmem_mask;
            kickmemory[addr] = b;
            return;
@@ -1324,7 +1327,6 @@ static void REGPARAM2 kickmem2_lput (uaecptr addr, uae_u32 l)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     m = (uae_u32 *)(kickmemory + addr);
     do_put_mem_long (m, l);
@@ -1336,7 +1338,6 @@ static void REGPARAM2 kickmem2_wput (uaecptr addr, uae_u32 w)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     m = (uae_u16 *)(kickmemory + addr);
     do_put_mem_word (m, w);
@@ -1347,21 +1348,18 @@ static void REGPARAM2 kickmem2_bput (uaecptr addr, uae_u32 b)
 #ifdef JIT
     special_mem |= S_WRITE;
 #endif
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     kickmemory[addr] = b;
 }
 
 static int REGPARAM2 kickmem_check (uaecptr addr, uae_u32 size)
 {
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     return (addr + size) <= kickmem_size;
 }
 
 static uae_u8 *REGPARAM2 kickmem_xlate (uaecptr addr)
 {
-    addr -= kickmem_start & kickmem_mask;
     addr &= kickmem_mask;
     return kickmemory + addr;
 }
@@ -1508,15 +1506,6 @@ addrbank dummy_bank = {
     dummy_lgeti, dummy_wgeti, ABFLAG_NONE
 };
 
-#ifdef AUTOCONFIG
-addrbank mbres_bank = {
-    mbres_lget, mbres_wget, mbres_bget,
-    mbres_lput, mbres_wput, mbres_bput,
-    default_xlate, mbres_check, NULL, "MBRES",
-    dummy_lgeti, dummy_wgeti, ABFLAG_RAM
-};
-#endif
-
 addrbank chipmem_bank = {
     chipmem_lget, chipmem_wget, chipmem_bget,
     chipmem_lput, chipmem_wput, chipmem_bput,
@@ -1547,14 +1536,26 @@ addrbank bogomem_bank = {
     bogomem_lget, bogomem_wget, ABFLAG_RAM
 };
 
-#ifdef AUTOCONFIG
-addrbank a3000mem_bank = {
-    a3000mem_lget, a3000mem_wget, a3000mem_bget,
-    a3000mem_lput, a3000mem_wput, a3000mem_bput,
-    a3000mem_xlate, a3000mem_check, NULL, "A3000 memory",
-    a3000mem_lget, a3000mem_wget, ABFLAG_RAM
+addrbank cardmem_bank = {
+    cardmem_lget, cardmem_wget, cardmem_bget,
+    cardmem_lput, cardmem_wput, cardmem_bput,
+    cardmem_xlate, cardmem_check, NULL, "CDTV memory card",
+    cardmem_lget, cardmem_wget, ABFLAG_RAM
+};
+
+addrbank a3000lmem_bank = {
+    a3000lmem_lget, a3000lmem_wget, a3000lmem_bget,
+    a3000lmem_lput, a3000lmem_wput, a3000lmem_bput,
+    a3000lmem_xlate, a3000lmem_check, NULL, "RAMSEY memory (low)",
+    a3000lmem_lget, a3000lmem_wget, ABFLAG_RAM
+};
+
+addrbank a3000hmem_bank = {
+    a3000hmem_lget, a3000hmem_wget, a3000hmem_bget,
+    a3000hmem_lput, a3000hmem_wput, a3000hmem_bput,
+    a3000hmem_xlate, a3000hmem_check, NULL, "RAMSEY memory (high)",
+    a3000hmem_lget, a3000hmem_wget, ABFLAG_RAM
 };
-#endif
 
 addrbank kickmem_bank = {
     kickmem_lget, kickmem_wget, kickmem_bget,
@@ -1620,7 +1621,7 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
     if (kickdisk && i > 262144)
        i = 262144;
 
-    if ((i != 8192 && i != 65536) && i != 131072 && i != 262144 && i != 524288 && i != 524288 * 2) {
+    if (i != 8192 && i != 65536 && i != 131072 && i != 262144 && i != 524288 && i != 524288 * 2) {
        notify_user (NUMSG_KSROMREADERROR);
        return 0;
     }
@@ -1631,14 +1632,19 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
        if (!decode_cloanto_rom (mem, size, i))
            return 0;
     }
-    if (i == 8192 || i == 65536) {
-       a1000_bootrom = xmalloc (65536);
-       memcpy (a1000_bootrom, kickmemory, 65536);
+    if (currprefs.cs_a1000ram) {
+       int off = 0;
+       a1000_bootrom = xmalloc (262144);
+       while (off + i < 262144) {
+           memcpy (a1000_bootrom + off, kickmemory, i);
+           off += i;
+       }
        memset (kickmemory, 0, kickmem_size);
        a1000_handle_kickstart (1);
-       i = 524288;
        dochecksum = 0;
+       i = 524288;
     }
+
     for (j = 0; j < 256 && i >= 262144; j++) {
        if (!memcmp (mem + j, kickstring, strlen (kickstring) + 1))
            break;
@@ -1737,21 +1743,21 @@ static int patch_shapeshifter (uae_u8 *kickmemory)
 }
 
 /* disable incompatible drivers */
-static int patch_residents (uae_u8 *kickmemory)
+static int patch_residents (uae_u8 *kickmemory, int size)
 {
     int i, j, patched = 0;
     char *residents[] = { "NCR scsi.device", 0 };
     // "scsi.device", "carddisk.device", "card.resource" };
-    uaecptr base = 0xf80000;
+    uaecptr base = size == 524288 ? 0xf80000 : 0xfc0000;
 
-    for (i = 0; i < kickmem_size - 100; i++) {
+    for (i = 0; i < size - 100; i++) {
        if (kickmemory[i] == 0x4a && kickmemory[i + 1] == 0xfc) {
            uaecptr addr;
            addr = (kickmemory[i + 2] << 24) | (kickmemory[i + 3] << 16) | (kickmemory[i + 4] << 8) | (kickmemory[i + 5] << 0);
            if (addr != i + base)
                continue;
            addr = (kickmemory[i + 14] << 24) | (kickmemory[i + 15] << 16) | (kickmemory[i + 16] << 8) | (kickmemory[i + 17] << 0);
-           if (addr >= base && addr < base + 524288) {
+           if (addr >= base && addr < base + size) {
                j = 0;
                while (residents[j]) {
                    if (!memcmp (residents[j], kickmemory + addr - base, strlen (residents[j]) + 1)) {
@@ -1768,6 +1774,21 @@ static int patch_residents (uae_u8 *kickmemory)
     return patched;
 }
 
+static void patch_kick(void)
+{
+    int patched = 0;
+    if (kickmem_size >= 524288 && currprefs.kickshifter)
+        patched += patch_shapeshifter (kickmemory);
+    patched += patch_residents (kickmemory, kickmem_size);
+    if (extendedkickmemory) {
+       patched += patch_residents (extendedkickmemory, extendedkickmem_size);
+       if (patched)
+           kickstart_fix_checksum (extendedkickmemory, extendedkickmem_size);
+    }
+    if (patched)
+       kickstart_fix_checksum (kickmemory, kickmem_size);
+}
+
 static int load_kickstart (void)
 {
     struct zfile *f = zfile_fopen (currprefs.romfile, "rb");
@@ -1814,16 +1835,22 @@ static int load_kickstart (void)
     }
 
     if (f != NULL) {
-       int filesize, size;
+       int filesize, size, maxsize;
+       maxsize = 524288;
        zfile_fseek (f, 0, SEEK_END);
        filesize = zfile_ftell (f);
        zfile_fseek (f, 0, SEEK_SET);
+       if (filesize == 1760 * 512) {
+           filesize = 262144;
+           maxsize = 262144;
+       }
        if (filesize >= 524288 * 2)
            zfile_fseek (f, 524288, SEEK_SET);
-       size = read_kickstart (f, kickmemory, 0x80000, 1, &cloanto_rom);
+       size = read_kickstart (f, kickmemory, maxsize, 1, &cloanto_rom);
        if (size == 0)
            goto err;
         kickmem_mask = size - 1;
+       kickmem_size = size;
        if (filesize >= 524288 * 2 && !extendedkickmem_type) {
            zfile_fseek (f, 0, SEEK_SET);
            extendedkickmem_size = 0x80000;
@@ -2055,35 +2082,73 @@ static void allocate_memory (void)
        }
        memory_hardreset();
     }
-#ifdef AUTOCONFIG
-    if (allocated_a3000mem != currprefs.a3000mem_size) {
-       if (a3000memory)
-           mapped_free (a3000memory);
-       a3000memory = 0;
-
-       allocated_a3000mem = currprefs.a3000mem_size;
-       a3000mem_mask = allocated_a3000mem - 1;
-
-       if (allocated_a3000mem) {
-           a3000memory = mapped_malloc (allocated_a3000mem, "a3000");
-           if (a3000memory == 0) {
-               write_log ("Out of memory for a3000mem.\n");
-               allocated_a3000mem = 0;
+    if (allocated_a3000lmem != currprefs.mbresmem_low_size) {
+       if (a3000lmemory)
+           mapped_free (a3000lmemory);
+       a3000lmemory = 0;
+
+       allocated_a3000lmem = currprefs.mbresmem_low_size;
+       a3000lmem_mask = allocated_a3000lmem - 1;
+       a3000lmem_start = 0x08000000 - allocated_a3000lmem;
+       if (allocated_a3000lmem) {
+           a3000lmemory = mapped_malloc (allocated_a3000lmem, "ramsey_low");
+           if (a3000lmemory == 0) {
+               write_log ("Out of memory for a3000lowmem.\n");
+               allocated_a3000lmem = 0;
            }
        }
        memory_hardreset();
     }
-#endif
+    if (allocated_a3000hmem != currprefs.mbresmem_high_size) {
+       if (a3000hmemory)
+           mapped_free (a3000hmemory);
+       a3000hmemory = 0;
+
+       allocated_a3000hmem = currprefs.mbresmem_high_size;
+       a3000hmem_mask = allocated_a3000hmem - 1;
+       a3000hmem_start = 0x08000000;
+       if (allocated_a3000hmem) {
+           a3000hmemory = mapped_malloc (allocated_a3000hmem, "ramsey_high");
+           if (a3000hmemory == 0) {
+               write_log ("Out of memory for a3000highmem.\n");
+               allocated_a3000hmem = 0;
+           }
+       }
+       memory_hardreset();
+    }
+    if (allocated_cardmem != currprefs.cs_cdtvcard * 1024) {
+       if (cardmemory)
+           mapped_free (cardmemory);
+       cardmemory = 0;
+
+       allocated_cardmem = currprefs.cs_cdtvcard * 1024;
+       cardmem_mask = allocated_cardmem - 1;
+       if (allocated_cardmem) {
+           cardmemory = mapped_malloc (allocated_cardmem, "rom_e0");
+           if (cardmemory == 0) {
+               write_log ("Out of memory for cardmem.\n");
+               allocated_cardmem = 0;
+           }
+       }
+       cdtv_loadcardmem(cardmemory, allocated_cardmem);
+    }
     if (savestate_state == STATE_RESTORE) {
        restore_ram (chip_filepos, chipmemory);
        if (allocated_bogomem > 0)
            restore_ram (bogo_filepos, bogomemory);
+       if (allocated_a3000lmem > 0)
+           restore_ram (a3000lmem_filepos, a3000lmemory);
+       if (allocated_a3000hmem > 0)
+           restore_ram (a3000hmem_filepos, a3000hmemory);
     }
     chipmem_bank.baseaddr = chipmemory;
 #ifdef AGA
     chipmem_bank_ce2.baseaddr = chipmemory;
 #endif
     bogomem_bank.baseaddr = bogomemory;
+    a3000lmem_bank.baseaddr = a3000lmemory;
+    a3000hmem_bank.baseaddr = a3000hmemory;
+    cardmem_bank.baseaddr = cardmemory;
 }
 
 void map_overlay (int chip)
@@ -2111,7 +2176,9 @@ void memory_reset (void)
     be_cnt = 0;
     currprefs.chipmem_size = changed_prefs.chipmem_size;
     currprefs.bogomem_size = changed_prefs.bogomem_size;
-    currprefs.a3000mem_size = changed_prefs.a3000mem_size;
+    currprefs.mbresmem_low_size = changed_prefs.mbresmem_low_size;
+    currprefs.mbresmem_high_size = changed_prefs.mbresmem_high_size;
+    currprefs.cs_cdtvcard = changed_prefs.cs_cdtvcard;
 
     init_mem_banks ();
     allocate_memory ();
@@ -2148,25 +2215,24 @@ void memory_reset (void)
        } else {
            struct romdata *rd = getromdatabydata (kickmemory, kickmem_size);
            if (rd) {
-               if (rd->cpu == 1 && changed_prefs.cpu_level < 2) {
+               if ((rd->cpu & 3) == 1 && changed_prefs.cpu_level < 2) {
                    notify_user (NUMSG_KS68EC020);
                    uae_restart (-1, NULL);
-               } else if (rd->cpu == 2 && (changed_prefs.cpu_level < 2 || changed_prefs.address_space_24)) {
+               } else if ((rd->cpu & 3) == 2 && (changed_prefs.cpu_level < 2 || changed_prefs.address_space_24)) {
                    notify_user (NUMSG_KS68020);
                    uae_restart (-1, NULL);
                }
                if (rd->cloanto)
                    cloanto_rom = 1;
+               if (rd->cpu & 4) { /* A4000 ROM = need some mb resources */
+                   if (currprefs.cs_ramseyrev < 0) 
+                       changed_prefs.cs_ramseyrev = currprefs.cs_ramseyrev = 0x0f;
+                   changed_prefs.cs_fatgaryrev = currprefs.cs_fatgaryrev = 0;
+                   changed_prefs.cs_mbdmac = currprefs.cs_mbdmac = 0;
+               }
            }
        }
-       if (kickmem_size == 524288) {
-           int patched = 0;
-           if (currprefs.kickshifter)
-               patched += patch_shapeshifter (kickmemory);
-           patched += patch_residents (kickmemory);
-           if (patched)
-               kickstart_fix_checksum (kickmemory, kickmem_size);
-       }
+       patch_kick ();
     }
 
     if (cloanto_rom)
@@ -2181,7 +2247,6 @@ void memory_reset (void)
     if (bnk < 0x20 + (currprefs.fastmem_size >> 16))
        bnk = 0x20 + (currprefs.fastmem_size >> 16);
     map_banks (&dummy_bank, bnk, 0xA0 - bnk, 0);
-    /*map_banks (&mbres_bank, 0xDE, 1); */
 
     if (bogomemory != 0) {
        int t = allocated_bogomem >> 16;
@@ -2191,22 +2256,34 @@ void memory_reset (void)
            t = 0x10;
        map_banks (&bogomem_bank, 0xC0, t, 0);
     }
-    if ((currprefs.chipset_mask & CSMASK_AGA) || currprefs.cpu_level >= 2)
-       map_banks (&gayle_bank, 0xD8, 7, 0);
-    map_banks (&clock_bank, 0xDC, 1, 0);
+    if (currprefs.cs_ide)
+       map_banks (&gayle_bank, 0xD8, 6, 0);
+    if (currprefs.cs_rtc)
+       map_banks (&clock_bank, 0xDC, 1, 0);
+    if (currprefs.cs_fatgaryrev >= 0|| currprefs.cs_ramseyrev >= 0)
+       map_banks (&mbres_bank, 0xDE, 1, 0);
+    if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram)
+       map_banks (&akiko_bank, AKIKO_BASE >> 16, 1, 0);
+    if (currprefs.cs_mbdmac >= 0)
+       map_banks (&mbdmac_bank, 0xDD, 1, 0);
+    if (a3000lmemory != 0)
+        map_banks (&a3000lmem_bank, a3000lmem_start >> 16, allocated_a3000lmem >> 16, 0);
+    if (a3000hmemory != 0)
+        map_banks (&a3000hmem_bank, a3000hmem_start >> 16, allocated_a3000hmem >> 16, 0);
+    if (cardmemory != 0)
+       map_banks (&cardmem_bank, cardmem_start >> 16, allocated_cardmem >> 16, 0);
 
 #ifdef AUTOCONFIG
-    if (a3000memory != 0)
-       map_banks (&a3000mem_bank, a3000mem_start >> 16, allocated_a3000mem >> 16,
-                  allocated_a3000mem);
-    if (nr_units (currprefs.mountinfo) > 0)
+    if (nr_units()) {
+       uae_boot_rom = 1;
        map_banks (&rtarea_bank, RTAREA_BASE >> 16, 1, 0);
+    }
 #endif
 
     map_banks (&kickmem_bank, 0xF8, 8, 0);
     if (currprefs.maprom)
        map_banks (&kickram_bank, currprefs.maprom >> 16, 8, 0);
-    /* map beta Kickstarts to 0x200000 */
+    /* map beta Kickstarts at 0x200000 */
     if (kickmemory[2] == 0x4e && kickmemory[3] == 0xf9 && kickmemory[4] == 0x00) {
        uae_u32 addr = kickmemory[5];
        if (addr == 0x20 && currprefs.chipmem_size <= 0x200000 && currprefs.fastmem_size == 0)
@@ -2251,10 +2328,10 @@ void memory_reset (void)
        cd32_enabled = 1;
        break;
 #endif
-    default:
-       if (cloanto_rom && !currprefs.maprom && !extendedkickmem_type)
-           map_banks (&kickmem_bank, 0xE0, 8, 0);
     }
+    
+    if ((cloanto_rom || currprefs.cs_ksmirror) && !currprefs.maprom && !extendedkickmem_type)
+        map_banks (&kickmem_bank, 0xE0, 8, 0);
 
 #ifdef ARCADIA
     is_arcadia_rom (currprefs.cartfile);
@@ -2287,14 +2364,13 @@ void memory_init (void)
     extendedkickmem_size = 0;
     extendedkickmem_type = 0;
     chipmemory = 0;
-#ifdef AUTOCONFIG
-    allocated_a3000mem = 0;
-    a3000memory = 0;
-#endif
+    allocated_a3000lmem = allocated_a3000hmem = 0;
+    a3000lmemory = a3000hmemory = 0;
     bogomemory = 0;
+    cardmemory = 0;
 
-    kickmemory = mapped_malloc (kickmem_size, "kick");
-    memset (kickmemory, 0, kickmem_size);
+    kickmemory = mapped_malloc (0x80000, "kick");
+    memset (kickmemory, 0, 0x80000);
     kickmem_bank.baseaddr = kickmemory;
     strcpy (currprefs.romfile, "<none>");
     currprefs.romextfile[0] = 0;
@@ -2316,11 +2392,10 @@ void memory_init (void)
 
 void memory_cleanup (void)
 {
-#ifdef AUTOCONFIG
-    if (a3000memory)
-       mapped_free (a3000memory);
-    a3000memory = 0;
-#endif
+    if (a3000lmemory)
+       mapped_free (a3000lmemory);
+    if (a3000hmemory)
+       mapped_free (a3000hmemory);
     if (bogomemory)
        mapped_free (bogomemory);
     if (kickmemory)
@@ -2329,12 +2404,16 @@ void memory_cleanup (void)
        xfree (a1000_bootrom);
     if (chipmemory)
        mapped_free (chipmemory);
+    if (cardmemory)
+       mapped_free (cardmemory);
 
     bogomemory = 0;
     kickmemory = 0;
+    a3000lmemory = a3000hmemory = 0;
     a1000_bootrom = 0;
     a1000_kickstart_mode = 0;
     chipmemory = 0;
+    cardmemory = 0;
 
     #ifdef ACTION_REPLAY
     action_replay_cleanup();
@@ -2350,6 +2429,10 @@ void memory_hardreset(void)
        memset (chipmemory, 0, allocated_chipmem);
     if (bogomemory)
        memset (bogomemory, 0, allocated_bogomem);
+    if (a3000lmemory)
+       memset (a3000lmemory, 0, allocated_a3000lmem);
+    if (a3000hmemory)
+       memset (a3000hmemory, 0, allocated_a3000hmem);
     expansion_clear();
 }
 
@@ -2360,7 +2443,7 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
     addrbank *orgbank = bank;
     uae_u32 realstart = start;
 
-    flush_icache (1);          /* Sure don't want to keep any old mappings around! */
+    flush_icache (1); /* Sure don't want to keep any old mappings around! */
 #ifdef NATMEM_OFFSET
     delete_shmmaps (start << 16, size << 16);
 #endif
@@ -2427,6 +2510,18 @@ uae_u8 *save_bram (int *len)
     return bogomemory;
 }
 
+uae_u8 *save_a3000lram (int *len)
+{
+    *len = allocated_a3000lmem;
+    return a3000lmemory;
+}
+
+uae_u8 *save_a3000hram (int *len)
+{
+    *len = allocated_a3000hmem;
+    return a3000hmemory;
+}
+
 void restore_cram (int len, size_t filepos)
 {
     chip_filepos = filepos;
@@ -2439,6 +2534,18 @@ void restore_bram (int len, size_t filepos)
     changed_prefs.bogomem_size = len;
 }
 
+void restore_a3000lram (int len, size_t filepos)
+{
+    a3000lmem_filepos = filepos;
+    changed_prefs.mbresmem_low_size = len;
+}
+
+void restore_a3000hram (int len, size_t filepos)
+{
+    a3000hmem_filepos = filepos;
+    changed_prefs.mbresmem_high_size = len;
+}
+
 uae_u8 *restore_rom (uae_u8 *src)
 {
     uae_u32 crc32, mem_start, mem_size, mem_type, version;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 2b412e2..829a578
--- a/newcpu.c
+++ b/newcpu.c
@@ -24,6 +24,8 @@
 #include "savestate.h"
 #include "blitter.h"
 #include "ar.h"
+#include "gayle.h"
+#include "cia.h"
 
 #ifdef JIT
 extern uae_u8* compiled_code;
@@ -1790,6 +1792,78 @@ void doint (void)
 //static uae_u32 pcs[1000];
 
 
+#define DEBUG_CD32IO
+#ifdef DEBUG_CD32IO
+
+static uae_u32 cd32nextpc, cd32request;
+
+static void out_cd32io2(void)
+{
+    uae_u32 request = cd32request;
+    //write_log ("ACTUAL=%d ERROR=%d\n", get_long (request + 32), get_byte (request + 31));
+    cd32nextpc = 0;
+    cd32request = 0;
+}
+
+static void out_cd32io (uae_u32 pc)
+{
+    char out[100];
+    int ioreq = 0;
+    uae_u32 request = m68k_areg (&regs, 1);
+
+    if (pc == cd32nextpc) {
+       out_cd32io2();
+       return;
+    }
+    out[0] = 0;
+    switch (pc)
+    {
+       case 0xe57cc0:
+       case 0xf04c34:
+       sprintf (out, "opendevice");
+       break;
+       case 0xe57ce6:
+       case 0xf04c56:
+       sprintf (out, "closedevice");
+       break;
+       case 0xe57e44:
+       case 0xf04f2c:
+       sprintf (out, "beginio");
+       ioreq = 1;
+       break;
+       case 0xe57ef2:
+       case 0xf0500e:
+       sprintf (out, "abortio");
+       ioreq = -1;
+       break;
+    }
+    if (out[0] == 0)
+       return;
+    if (cd32request)
+       write_log ("old request still not returned!\n");
+    cd32request = request;
+    cd32nextpc = get_long(m68k_areg (&regs, 7));
+    write_log("%s A1=%08.8X\n", out, request);
+    if (ioreq) {
+       static int cnt = 26;
+       int cmd = get_word (request + 28);
+#if 0
+       if (cmd == 2) {
+           cnt--;
+           if (cnt == 0)
+               activate_debugger();
+       }
+#endif
+       write_log ("CMD=%d DATA=%08.8X LEN=%d %OFF=%d\n",
+           cmd, get_long(request + 40),
+           get_long(request + 36), get_long(request + 44));
+    }
+    if (ioreq < 0)
+       ;//activate_debugger();
+}
+
+#endif
+
 #ifndef CPUEMU_5
 
 static void m68k_run_1 (void)
@@ -1811,6 +1885,8 @@ static void m68k_run_1 (void)
 
        count_instr (opcode);
 
+       //out_cd32io(m68k_getpc(&regs));
+
 #if 0
        int pc = m68k_getpc();
        if (pc == 0xdff002)
@@ -1946,12 +2022,6 @@ static void m68k_run_2a (void)
            intreq |= 0x0008;
            set_special (&regs, SPCFLAG_INT);
        }
-#if 0
-       if (bsd_int_requested) {
-           intreq |= 0x2000;
-           set_special (&regs, SPCFLAG_INT);
-       }
-#endif
        if (regs.spcflags) {
            if (do_specialties (0, &regs)) {
                return;
@@ -1969,57 +2039,6 @@ static void m68k_run_2 (void)
 
 #else
 
-//#define DEBUG_CD32IO
-#ifdef DEBUG_CD32IO
-
-static uae_u32 cd32nextpc, cd32request;
-
-static void out_cd32io2(void)
-{
-    uae_u32 request = cd32request;
-    write_log ("ACTUAL=%d ERROR=%d\n", get_long (request + 32), get_byte (request + 31));
-    cd32nextpc = 0;
-    cd32request = 0;
-}
-
-static void out_cd32io (uae_u32 pc)
-{
-    char out[100];
-    int ioreq = 0;
-    uae_u32 request = m68k_areg (regs, 1);
-
-    out[0] = 0;
-    switch (pc)
-       {
-       case 0xe57cc0:
-       sprintf (out, "opendevice");
-       break;
-       case 0xe57ce6:
-       sprintf (out, "closedevice");
-       break;
-       case 0xe57e44:
-       sprintf (out, "beginio");
-       ioreq = 1;
-       break;
-       case 0xe57ef2:
-       sprintf (out, "abortio");
-       ioreq = 1;
-       break;
-    }
-    if (out[0] == 0)
-       return;
-    if (cd32request)
-       write_log ("old request still not returned!\n");
-    cd32request = request;
-    cd32nextpc = get_long(m68k_areg (regs, 7));
-    write_log("%s A1=%08.8X\n", out, request);
-    if (ioreq) {
-       write_log ("CMD=%d DATA=%08.8X LEN=%d %OFF=%d\n",
-       get_word(request + 28),get_long(request + 40),get_long(request + 36),get_long(request + 44));
-    }
-}
-#endif
-
 /* emulate simple prefetch  */
 static void m68k_run_2p (void)
 {
@@ -2032,6 +2051,8 @@ static void m68k_run_2p (void)
        uae_u32 opcode;
        uae_u32 pc = m68k_getpc (r);
 
+       out_cd32io(m68k_getpc(&regs));
+
        do_cycles (cpu_cycles);
 
        if (pc == prefetch_pc)
@@ -2109,6 +2130,8 @@ static void exception2_handle (uaecptr addr, uaecptr fault)
 
 void m68k_go (int may_quit)
 {
+    int hardboot = 1;
+
     if (in_m68k_go || !may_quit) {
        write_log ("Bug! m68k_go is not reentrant.\n");
        abort ();
@@ -2121,10 +2144,12 @@ void m68k_go (int may_quit)
     for (;;) {
        void (*run_func)(void);
        if (quit_program > 0) {
-           int hardreset = quit_program == 3 ? 1 : 0;
+           int hardreset = (quit_program == 3 ? 1 : 0) | hardboot;
            if (quit_program == 1)
                break;
+
            quit_program = 0;
+           hardboot = 0;
 #ifdef SAVESTATE
            if (savestate_state == STATE_RESTORE)
                restore_state (savestate_fname);
@@ -2135,7 +2160,10 @@ void m68k_go (int may_quit)
             * fastram state restore breaks
             */
            reset_all_systems ();
+           gayle_reset (hardreset);
            customreset ();
+           if (hardreset)
+               rtc_hardreset();
            m68k_reset ();
            if (hardreset) {
                memory_hardreset();
diff --git a/nogui.c b/nogui.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 6679d5b..f47d182
@@ -20,6 +20,8 @@
 
 #include <devioctl.h>
 #include <ntddcdrm.h>
+#include <windows.h>
+#include <mmsystem.h>
 
 struct dev_info_ioctl {
     HANDLE h;
@@ -29,26 +31,40 @@ struct dev_info_ioctl {
     int mediainserted;
     int type;
     int blocksize;
+    int mciid;
+    int mcimode;
+    CDROM_TOC toc;
+    UINT errormode;
+    int playend;
 };
 
 #define IOCTL_DATA_BUFFER 4096
 
-static UINT errormode;
+static int MCICDA = 1;
+
+static struct dev_info_ioctl ciw32[MAX_TOTAL_DEVICES];
 
-static void seterrormode (void)
+static void seterrormode (int unitnum)
 {
-    errormode = SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX );
+    ciw32[unitnum].errormode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
 }
-static void reseterrormode (void)
+static void reseterrormode (int unitnum)
 {
-    SetErrorMode (errormode);
+    SetErrorMode (ciw32[unitnum].errormode);
 }
 
-static struct dev_info_ioctl ciw32[MAX_TOTAL_DEVICES + 64 + 32];
-
 static void close_device (int unitnum);
 static int open_device (int unitnum);
 
+static void mcierr(char *str, DWORD err)
+{
+    char es[1000];
+    if (err == MMSYSERR_NOERROR)
+       return;
+    if (mciGetErrorString(err, es, sizeof es))
+       write_log("MCIErr: %s: '%s'\n", str, es);
+}
+
 static int win32_error (int unitnum, const char *format,...)
 {
     LPVOID lpMsgBuf;
@@ -66,32 +82,136 @@ static int win32_error (int unitnum, const char *format,...)
     va_start (arglist, format );
     vsprintf (buf, format, arglist);
     FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
-       NULL,err,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-       (LPTSTR) &lpMsgBuf,0,NULL);
+       NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+       (LPTSTR)&lpMsgBuf, 0, NULL);
     if (log_scsi)
        write_log ("IOCTL: unit=%d %s,%d: %s ", unitnum, buf, err, (char*)lpMsgBuf);
-    va_end( arglist );
+    va_end(arglist);
     return err;
 }
 
+static int close_createfile(int unitnum)
+{
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+
+    if (ciw->h != INVALID_HANDLE_VALUE) {
+       CloseHandle(ciw->h);
+       ciw->h = INVALID_HANDLE_VALUE;
+       return 1;
+    }
+    return 0;
+}
+
+static int close_mci(int unitnum)
+{
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+    MCI_GENERIC_PARMS gp = { 0 };
+
+    ciw->playend = -1;
+    if (ciw->mciid) {
+       mcierr("MCI_STOP", mciSendCommand(ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
+       mcierr("MCI_CLOSE", mciSendCommand(ciw->mciid, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)&gp));
+        ciw->mciid = 0;
+       return 1;
+    }
+    return 0;
+}
+
+static int open_createfile(int unitnum)
+{
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+    int closed = 0;
+    int cnt = 10;
+    DWORD flags;
+
+    if (ciw->h != INVALID_HANDLE_VALUE)
+       return 1;
+    closed = close_mci(unitnum);
+    for (;;) {
+       flags = GENERIC_READ;
+       ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+       if (ciw->h == INVALID_HANDLE_VALUE) {
+           flags |= GENERIC_WRITE;
+           ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+           if (ciw->h == INVALID_HANDLE_VALUE) {
+               DWORD err = GetLastError();
+               if (err == ERROR_SHARING_VIOLATION) {
+                   if (cnt > 0) {
+                       Sleep(10);
+                       continue;
+                   }
+                   cnt--;
+               }
+               if (closed)
+                   write_log("IOCTL: failed to re-open '%s', err=%d\n", ciw->devname, GetLastError());
+               return 0;
+           }
+       }
+       break;
+    }
+    return 1;
+}
+
+static int open_mci(int unitnum)
+{
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+    char elname[10];
+    char alname[100];
+    MCI_OPEN_PARMS mciOpen;
+    DWORD err, flags;
+    int closed = 0;
+
+    if (ciw->mciid > 0 || MCICDA == 0)
+       return 1;
+    ciw->playend = -1;
+    closed = close_createfile(unitnum);
+    memset (&mciOpen, 0, sizeof(mciOpen));
+    mciOpen.lpstrDeviceType = (LPSTR)MCI_DEVTYPE_CD_AUDIO;
+    sprintf(elname,"%c:", ciw->drvletter);
+    sprintf(alname,"CD%u:", GetCurrentTime());
+    mciOpen.lpstrElementName = elname;
+    mciOpen.lpstrAlias = alname;
+    flags = MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
+    err = mciSendCommand(0, MCI_OPEN, flags, (DWORD)(LPVOID)&mciOpen);
+    ciw->mciid = mciOpen.wDeviceID;
+    if (err != MMSYSERR_NOERROR) {
+       if (closed)
+           mcierr("MCI_OPEN", err);
+       return 0;
+    }
+    return 1;
+}
 
 /* pause/unpause CD audio */
 static int ioctl_command_pause (int unitnum, int paused)
 {
-    DWORD len;
-    int command = paused ? IOCTL_CDROM_PAUSE_AUDIO : IOCTL_CDROM_RESUME_AUDIO;
-    int cnt = 3;
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
 
-    while (cnt-- > 0) {
-       seterrormode ();
-       if (!DeviceIoControl(ciw32[unitnum].h, command, NULL, 0, NULL, 0, &len, NULL)) {
-           reseterrormode ();
-           if (win32_error (unitnum, paused ? "IOCTL_CDROM_PAUSE_AUDIO" : "IOCTL_CDROM_RESUME_AUDIO") < 0)
-               continue;
-           return 0;
+    if (ciw->mciid > 0) {
+
+        MCI_GENERIC_PARMS gp = { 0 };
+       if (paused)
+           mcierr("MCI_PAUSE", mciSendCommand(ciw->mciid, MCI_PAUSE, MCI_WAIT, (DWORD_PTR)&gp));
+       else
+           mcierr("MCI_RESUME", mciSendCommand(ciw->mciid, MCI_RESUME, MCI_WAIT, (DWORD_PTR)&gp));
+
+    } else {
+
+       DWORD len;
+       int command = paused ? IOCTL_CDROM_PAUSE_AUDIO : IOCTL_CDROM_RESUME_AUDIO;
+       int cnt = 3;
+
+       while (cnt-- > 0) {
+           seterrormode (unitnum);
+           if (!DeviceIoControl(ciw32[unitnum].h, command, NULL, 0, NULL, 0, &len, NULL)) {
+               reseterrormode (unitnum);
+               if (win32_error (unitnum, paused ? "IOCTL_CDROM_PAUSE_AUDIO" : "IOCTL_CDROM_RESUME_AUDIO") < 0)
+                   continue;
+               return 0;
+           }
+           reseterrormode (unitnum);
+           break;
        }
-       reseterrormode ();
-       break;
     }
     return 1;
 }
@@ -99,19 +219,30 @@ static int ioctl_command_pause (int unitnum, int paused)
 /* stop CD audio */
 static int ioctl_command_stop (int unitnum)
 {
-    DWORD len;
-    int cnt = 3;
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
 
-    while (cnt-- > 0) {
-       seterrormode ();
-       if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &len, NULL)) {
-           reseterrormode ();
-           if (win32_error (unitnum, "IOCTL_CDROM_STOP_AUDIO") < 0)
-               continue;
-           return 0;
+    if (ciw->mciid > 0) {
+
+        MCI_GENERIC_PARMS gp = { 0 };
+       mcierr("MCI_STOP", mciSendCommand(ciw->mciid, MCI_STOP, MCI_WAIT, (DWORD_PTR)&gp));
+       ciw->playend = -1;
+
+    } else {
+
+       DWORD len;
+       int cnt = 3;
+
+       while (cnt-- > 0) {
+           seterrormode (unitnum);
+           if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &len, NULL)) {
+               reseterrormode (unitnum);
+               if (win32_error (unitnum, "IOCTL_CDROM_STOP_AUDIO") < 0)
+                   continue;
+               return 0;
+           }
+           reseterrormode (unitnum);
+           break;
        }
-       reseterrormode ();
-       break;
     }
     return 1;
 }
@@ -119,65 +250,180 @@ static int ioctl_command_stop (int unitnum)
 /* play CD audio */
 static int ioctl_command_play (int unitnum, uae_u32 start, uae_u32 end, int scan)
 {
-    DWORD len;
-    CDROM_PLAY_AUDIO_MSF pa;
-    int cnt = 3;
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
 
-    while (cnt-- > 0) {
-       pa.StartingM = start >> 16;
-       pa.StartingS = start >> 8;
-       pa.StartingF = start >> 0;
-       pa.EndingM = end >> 16;
-       pa.EndingS = end >> 8;
-       pa.EndingF = end >> 0;
-       seterrormode ();
-       if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_PLAY_AUDIO_MSF, &pa, sizeof(pa), NULL, 0, &len, NULL)) {
-           reseterrormode ();
-           if (win32_error (unitnum, "IOCTL_CDROM_PLAY_AUDIO_MSF %02.%02.%02-%02.%02.%02",
-               pa.StartingM, pa.StartingS, pa.StartingF, pa.EndingM, pa.EndingS, pa.EndingF ) < 0) continue;
-           return 0;
+    open_mci(unitnum);
+
+    if (ciw->mciid > 0) {
+
+       MCI_SET_PARMS setParms = {0};
+       MCI_PLAY_PARMS playParms = {0};
+
+       setParms.dwTimeFormat = MCI_FORMAT_MSF;
+       mcierr("MCI_SET", mciSendCommand(ciw->mciid, MCI_SET, MCI_SET_TIME_FORMAT | MCI_WAIT, (DWORD_PTR)&setParms));
+       playParms.dwFrom = MCI_MAKE_MSF((start >> 16) & 0xff, (start >> 8) & 0xff, start & 0xff);
+       playParms.dwTo = MCI_MAKE_MSF((end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff);
+       mcierr("MCI_PLAY", mciSendCommand(ciw->mciid, MCI_PLAY, MCI_FROM | MCI_TO, (DWORD_PTR)&playParms));
+       ciw->playend = end;
+
+    } else {
+
+       DWORD len;
+       CDROM_PLAY_AUDIO_MSF pa;
+       int cnt = 3;
+
+#if 0
+       {
+       VOLUME_CONTROL vc;
+       if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_GET_VOLUME, NULL, 0, &vc, sizeof(vc), &len, NULL))
+           write_log("IOCTL_CDROM_GET_VOLUME %d\n", GetLastError());
+       vc.PortVolume[0] = 0xff;
+       vc.PortVolume[1] = 0xff;
+       vc.PortVolume[2] = 0xff;
+       vc.PortVolume[3] = 0xff;
+       if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_SET_VOLUME, &vc, sizeof(vc), NULL, 0, &len, NULL))
+           write_log("IOCTL_CDROM_SET_VOLUME %d\n", GetLastError());
+       }
+#endif   
+
+       while (cnt-- > 0) {
+           pa.StartingM = start >> 16;
+           pa.StartingS = start >> 8;
+           pa.StartingF = start >> 0;
+           pa.EndingM = end >> 16;
+           pa.EndingS = end >> 8;
+           pa.EndingF = end >> 0;
+           seterrormode (unitnum);
+           if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_PLAY_AUDIO_MSF, &pa, sizeof(pa), NULL, 0, &len, NULL)) {
+               reseterrormode (unitnum);
+               if (win32_error (unitnum, "IOCTL_CDROM_PLAY_AUDIO_MSF %02.%02.%02-%02.%02.%02",
+                   pa.StartingM, pa.StartingS, pa.StartingF, pa.EndingM, pa.EndingS, pa.EndingF ) < 0) continue;
+               return 0;
+           }
+           reseterrormode (unitnum);
+           break;
        }
-       reseterrormode ();
-       break;
     }
+
     return 1;
 }
 
+/* convert minutes, seconds and frames -> logical sector number */
+static int msf2lsn (int        msf)
+{
+    int sector = (((msf >> 16) & 0xff) * 60 * 75 + ((msf >> 8) & 0xff) * 75 + ((msf >> 0) & 0xff));
+    return sector;
+}
+
+/* convert logical sector number -> minutes, seconds and frames */
+static int lsn2msf (int        sectors)
+{
+    int msf;
+    msf = (sectors / (75 * 60)) << 16;
+    msf |= ((sectors / 75) % 60) << 8;
+    msf |= (sectors % 75) << 0;
+    return msf;
+}
+
 /* read qcode */
 static uae_u8 *ioctl_command_qcode (int unitnum)
 {
-    SUB_Q_CHANNEL_DATA qcd;
-    DWORD len;
-    ULONG in = 1;
-    uae_u8 *p = ciw32[unitnum].tempbuffer;
-    int cnt = 3;
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
 
-    memset (p, 0, 4 + 12);
-    p[1] = 0x15;
-    p[3] = 12;
-    while (cnt-- > 0) {
-       reseterrormode ();
-       if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_Q_CHANNEL, &in, sizeof(in), &qcd, sizeof (qcd), &len, NULL)) {
-           reseterrormode ();
-           if (win32_error (unitnum, "IOCTL_CDROM_READ_Q_CHANNEL") < 0)
-               continue;
+    if (ciw->mciid > 0) {
+
+        static uae_u8 buf[4 + 12];
+        MCI_STATUS_PARMS mciStatusParms;
+       DWORD err, mode;
+       uae_u8 *p;
+       uae_u32 pos, pos2;
+       int trk;
+
+       memset(buf, 0, sizeof buf);
+       memset(&mciStatusParms, 0, sizeof mciStatusParms);
+       mciStatusParms.dwItem = MCI_STATUS_MODE;
+        err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+       if (err != MMSYSERR_NOERROR)
+           return 0;
+       mode = mciStatusParms.dwReturn;
+       mciStatusParms.dwItem = MCI_STATUS_CURRENT_TRACK;
+        err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+       if (err != MMSYSERR_NOERROR)
            return 0;
+       trk = mciStatusParms.dwReturn - 1;
+       if (trk < 0)
+           trk = 0;
+       mciStatusParms.dwItem = MCI_STATUS_POSITION;
+        err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+       if (err != MMSYSERR_NOERROR)
+           return 0;
+       pos = (((mciStatusParms.dwReturn >> 16) & 0xff) << 0) | (((mciStatusParms.dwReturn >> 8) & 0xff) << 8) | (((mciStatusParms.dwReturn >> 0) & 0xff) << 16);
+
+       p = buf;
+       p[1] = AUDIO_STATUS_NO_STATUS;
+       if (mode == MCI_MODE_PLAY)
+           p[1] = AUDIO_STATUS_IN_PROGRESS;
+       else if (mode == MCI_MODE_PAUSE)
+           p[1] = AUDIO_STATUS_PAUSED;
+       p[3] = 12;
+
+       p = buf + 4;
+       p[1] = (ciw->toc.TrackData[trk].Control << 0) | (ciw->toc.TrackData[trk].Adr << 4);
+       p[2] = trk + 1;
+       p[3] = 1;
+
+       p[5] = (pos >> 16) & 0xff;
+       p[6] = (pos >> 8) & 0xff;
+       p[7] = (pos >> 0) & 0xff;
+
+       pos = msf2lsn(pos);
+       pos2 = (ciw->toc.TrackData[trk].Address[1] << 16) | (ciw->toc.TrackData[trk].Address[2] << 8) | (ciw->toc.TrackData[trk].Address[3] << 0);
+       pos -= msf2lsn(pos2);
+       if (pos < 0)
+           pos = 0;
+       pos = lsn2msf(pos);
+
+       p[9] = (pos >> 16) & 0xff;
+       p[10] = (pos >> 8) & 0xff;
+       p[11] = (pos >> 0) & 0xff;
+
+       return buf;
+
+    } else {
+
+       SUB_Q_CHANNEL_DATA qcd;
+       DWORD len;
+       ULONG in = 1;
+       uae_u8 *p = ciw32[unitnum].tempbuffer;
+       int cnt = 3;
+
+       memset (p, 0, 4 + 12);
+       p[1] = 0x15;
+       p[3] = 12;
+       while (cnt-- > 0) {
+           reseterrormode (unitnum);
+           if(!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_Q_CHANNEL, &in, sizeof(in), &qcd, sizeof (qcd), &len, NULL)) {
+               reseterrormode (unitnum);
+               if (win32_error (unitnum, "IOCTL_CDROM_READ_Q_CHANNEL") < 0)
+                   continue;
+               return 0;
+           }
+           break;
        }
-       break;
+       reseterrormode (unitnum);
+       p[1] = qcd.CurrentPosition.Header.AudioStatus;
+       p += 4;
+       p[1] = (qcd.CurrentPosition.Control << 0) | (qcd.CurrentPosition.ADR << 4);
+       p[2] = qcd.CurrentPosition.TrackNumber;
+       p[3] = qcd.CurrentPosition.IndexNumber;
+       p[5] = qcd.CurrentPosition.AbsoluteAddress[1];
+       p[6] = qcd.CurrentPosition.AbsoluteAddress[2];
+       p[7] = qcd.CurrentPosition.AbsoluteAddress[3];
+       p[9] = qcd.CurrentPosition.TrackRelativeAddress[1];
+       p[10] = qcd.CurrentPosition.TrackRelativeAddress[2];
+       p[11] = qcd.CurrentPosition.TrackRelativeAddress[3];
+       return ciw32[unitnum].tempbuffer;
     }
-    reseterrormode ();
-    p[1] = qcd.CurrentPosition.Header.AudioStatus;
-    p += 4;
-    p[1] = (qcd.CurrentPosition.Control << 0) | (qcd.CurrentPosition.ADR << 4);
-    p[2] = qcd.CurrentPosition.TrackNumber;
-    p[3] = qcd.CurrentPosition.IndexNumber;
-    p[5] = qcd.CurrentPosition.AbsoluteAddress[1];
-    p[6] = qcd.CurrentPosition.AbsoluteAddress[2];
-    p[7] = qcd.CurrentPosition.AbsoluteAddress[3];
-    p[9] = qcd.CurrentPosition.TrackRelativeAddress[1];
-    p[10] = qcd.CurrentPosition.TrackRelativeAddress[2];
-    p[11] = qcd.CurrentPosition.TrackRelativeAddress[3];
-    return ciw32[unitnum].tempbuffer;
 }
 
 static int ioctl_command_readwrite (int unitnum, int sector, int write)
@@ -185,16 +431,18 @@ static int ioctl_command_readwrite (int unitnum, int sector, int write)
     DWORD dtotal;
     int cnt = 3;
 
+    if (!open_createfile(unitnum))
+       return 0;
     while (cnt-- > 0) {
        gui_cd_led (1);
-       seterrormode ();
+       seterrormode (unitnum);
        if (SetFilePointer (ciw32[unitnum].h, sector * ciw32[unitnum].blocksize, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
-           reseterrormode ();
+           reseterrormode (unitnum);
            if (win32_error (unitnum, "SetFilePointer") < 0)
                continue;
            return 0;
        }
-       reseterrormode ();
+       reseterrormode (unitnum);
        break;
     }
     cnt = 3;
@@ -203,7 +451,7 @@ static int ioctl_command_readwrite (int unitnum, int sector, int write)
        if (write) {
            if (!WriteFile (ciw32[unitnum].h, ciw32[unitnum].tempbuffer, ciw32[unitnum].blocksize, &dtotal, 0)) {
                int err;
-               reseterrormode ();
+               reseterrormode (unitnum);
                err = win32_error (unitnum, "WriteFile");
                if (err < 0)
                    continue;
@@ -213,13 +461,13 @@ static int ioctl_command_readwrite (int unitnum, int sector, int write)
            }
        } else {
            if (!ReadFile (ciw32[unitnum].h, ciw32[unitnum].tempbuffer, ciw32[unitnum].blocksize, &dtotal, 0)) {
-               reseterrormode ();
+               reseterrormode (unitnum);
                if (win32_error (unitnum, "ReadFile") < 0)
                    continue;
                return 0;
            }
        }
-       reseterrormode ();
+       reseterrormode (unitnum);
        gui_cd_led (1);
        break;
     }
@@ -243,15 +491,17 @@ static int fetch_geometry (int unitnum, struct device_info *di)
     DWORD len;
     int cnt = 3;
 
+    if (!open_createfile(unitnum))
+       return 0;
     while (cnt-- > 0) {
-       seterrormode ();
+       seterrormode (unitnum);
        if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_GET_DRIVE_GEOMETRY, NULL, 0, &geom, sizeof(geom), &len, NULL)) {
-           reseterrormode ();
+           reseterrormode (unitnum);
            if (win32_error (unitnum, "IOCTL_CDROM_GET_DRIVE_GEOMETRY") < 0)
                continue;
            return 0;
        }
-       reseterrormode ();
+       reseterrormode (unitnum);
        break;
     }
     if (di) {
@@ -263,37 +513,62 @@ static int fetch_geometry (int unitnum, struct device_info *di)
     return 1;
 }
 
+static int ismedia (int unitnum)
+{
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+
+    if (ciw->mciid > 0) {
+
+       DWORD err;
+       MCI_STATUS_PARMS mciStatusParms;
+
+       mciStatusParms.dwItem = MCI_STATUS_MEDIA_PRESENT;
+       err = mciSendCommand(ciw->mciid, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD)(LPVOID)&mciStatusParms);
+       if (err != MMSYSERR_NOERROR)
+           return 0;
+       if (mciStatusParms.dwReturn)
+           return 1;
+       return 0;
+
+    } else {
+       struct device_info di;
+       memset(&di, 0, sizeof di);
+       return fetch_geometry (unitnum, &di);
+    }
+}
 
 /* read toc */
 static uae_u8 *ioctl_command_toc (int unitnum)
 {
-    CDROM_TOC toc;
     DWORD len;
     int i;
     uae_u8 *p = ciw32[unitnum].tempbuffer;
     int cnt = 3;
+    CDROM_TOC *toc = &ciw32[unitnum].toc;
 
+    if (!open_createfile(unitnum))
+       return 0;
     gui_cd_led (1);
     while (cnt-- > 0) {
-       seterrormode ();
-       if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &len, NULL)) {
-           reseterrormode ();
+       seterrormode (unitnum);
+       if (!DeviceIoControl(ciw32[unitnum].h, IOCTL_CDROM_READ_TOC, NULL, 0, toc, sizeof(CDROM_TOC), &len, NULL)) {
+           reseterrormode (unitnum);
            if (win32_error (unitnum, "IOCTL_CDROM_READ_TOC") < 0)
                continue;
            return 0;
        }
-       reseterrormode ();
+       reseterrormode (unitnum);
        break;
     }
 
-    p[0] = ((toc.LastTrack + 4) * 11) >> 8;
-    p[1] = ((toc.LastTrack + 4) * 11) & 0xff;
+    p[0] = ((toc->LastTrack + 4) * 11) >> 8;
+    p[1] = ((toc->LastTrack + 4) * 11) & 0xff;
     p[2] = 1;
-    p[3] = toc.LastTrack;
+    p[3] = toc->LastTrack;
     p += 4;
     memset (p, 0, 11);
     p[0] = 1;
-    p[1] = (toc.TrackData[0].Control << 0) | (toc.TrackData[0].Adr << 4);
+    p[1] = (toc->TrackData[0].Control << 0) | (toc->TrackData[0].Adr << 4);
     p[3] = 0xa0;
     p[8] = 1;
     p += 11;
@@ -301,25 +576,25 @@ static uae_u8 *ioctl_command_toc (int unitnum)
     p[0] = 1;
     p[1] = 0x10;
     p[3] = 0xa1;
-    p[8] = toc.LastTrack;
+    p[8] = toc->LastTrack;
     p += 11;
     memset (p, 0, 11);
     p[0] = 1;
     p[1] = 0x10;
     p[3] = 0xa2;
-    p[8] = toc.TrackData[toc.LastTrack].Address[1];
-    p[9] = toc.TrackData[toc.LastTrack].Address[2];
-    p[10] = toc.TrackData[toc.LastTrack].Address[3];
+    p[8] = toc->TrackData[toc->LastTrack].Address[1];
+    p[9] = toc->TrackData[toc->LastTrack].Address[2];
+    p[10] = toc->TrackData[toc->LastTrack].Address[3];
     p += 11;
-    for (i = 0; i < toc.LastTrack; i++) {
+    for (i = 0; i < toc->LastTrack; i++) {
        memset (p, 0, 11);
        p[0] = 1;
-       p[1] = (toc.TrackData[i].Control << 0) | (toc.TrackData[i].Adr << 4);
+       p[1] = (toc->TrackData[i].Control << 0) | (toc->TrackData[i].Adr << 4);
        p[2] = 0;
        p[3] = i + 1;
-       p[8] = toc.TrackData[i].Address[1];
-       p[9] = toc.TrackData[i].Address[2];
-       p[10] = toc.TrackData[i].Address[3];
+       p[8] = toc->TrackData[i].Address[1];
+       p[9] = toc->TrackData[i].Address[2];
+       p[10] = toc->TrackData[i].Address[3];
        p += 11;
     }
     gui_cd_led (1);
@@ -329,9 +604,7 @@ static uae_u8 *ioctl_command_toc (int unitnum)
 /* open device level access to cd rom drive */
 static int sys_cddev_open (int unitnum)
 {
-    DWORD len;
     struct dev_info_ioctl *ciw = &ciw32[unitnum];
-    DWORD flags;
 
     /* buffer must be page aligned for device access */
     ciw->tempbuffer = VirtualAlloc (NULL, IOCTL_DATA_BUFFER, MEM_COMMIT, PAGE_READWRITE);
@@ -339,17 +612,10 @@ static int sys_cddev_open (int unitnum)
        write_log ("IOCTL: failed to allocate buffer");
        return 1;
     }
-    flags = GENERIC_READ;
-    ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-    if (ciw->h == INVALID_HANDLE_VALUE) {
-       flags |= GENERIC_WRITE;
-       ciw->h = CreateFile(ciw->devname, flags, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-       if (ciw->h == INVALID_HANDLE_VALUE) {
-           write_log ("IOCTL: failed to open device handle (%s)\n", ciw->devname);
-           goto error;
-       }
+    if (!open_createfile(unitnum)) {
+       write_log ("IOCTL: failed to open '%s', err=%d\n", ciw->devname, GetLastError());
+       goto error;
     }
-    DeviceIoControl(ciw->h, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &len, NULL);
     ciw->mediainserted = ioctl_command_toc (unitnum) ? 1 : 0;
     write_log ("IOCTL: device '%s' opened succesfully (unit number=%d,media=%d)\n", ciw->devname, unitnum, ciw->mediainserted);
     ioctl_command_stop (unitnum);
@@ -378,12 +644,14 @@ static int unitcheck (int unitnum)
 /* close device handle */
 void sys_cddev_close (int unitnum)
 {
+    struct dev_info_ioctl *ciw = &ciw32[unitnum];
+
     if (!unitcheck (unitnum))
        return;
-    CloseHandle (ciw32[unitnum].h);
-    ciw32[unitnum].h = NULL;
-    VirtualFree (ciw32[unitnum].tempbuffer, 0, MEM_RELEASE);
-    ciw32[unitnum].tempbuffer = NULL;
+    close_createfile(unitnum);
+    close_mci(unitnum);
+    VirtualFree (ciw->tempbuffer, 0, MEM_RELEASE);
+    ciw->tempbuffer = NULL;
 }
 
 static int open_device (int unitnum)
@@ -411,8 +679,10 @@ static int open_bus (int flags)
     int drive, i;
     char tmp[10];
 
-    for (i = 0; i < MAX_TOTAL_DEVICES; i++)
+    for (i = 0; i < MAX_TOTAL_DEVICES; i++) {
        memset (&ciw32[i], 0, sizeof (struct dev_info_ioctl));
+       ciw32[i].h = INVALID_HANDLE_VALUE;
+    }
     total_devices = 0;
     dwDriveMask = GetLogicalDrives();
     if (log_scsi)
@@ -440,6 +710,13 @@ static int open_bus (int flags)
     return total_devices;
 }
 
+static int ioctl_ismedia (int unitnum)
+{
+    if (!unitcheck (unitnum))
+       return 0;
+    return ismedia(unitnum);
+}
+
 static struct device_info *info_device (int unitnum, struct device_info *di)
 {
     if (!unitcheck (unitnum))
@@ -485,7 +762,7 @@ struct device_functions devicefunc_win32_ioctl = {
     open_bus, close_bus, open_device, close_device, info_device,
     0, 0, 0,
     ioctl_command_pause, ioctl_command_stop, ioctl_command_play, ioctl_command_qcode,
-    ioctl_command_toc, ioctl_command_read, ioctl_command_write, 0, ioctl_scsi_info
+    ioctl_command_toc, ioctl_command_read, ioctl_command_write, 0, ioctl_scsi_info, ioctl_ismedia
 };
 
 #endif
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index a85af11..f784838
 
 #include "direct3d.h"
 
-#if 0
-typedef D3DXMATRIX (CALLBACK* D3DXMATRIXPERSPECTIVEFOVLH)
-    (D3DXMATRIX *pOut,FLOAT fovy,FLOAT Aspect,FLOAT zn,FLOAT zf);
-static D3DXMATRIXPERSPECTIVEFOVLH pD3DXMatrixPerspectiveFovLH;
-typedef HRESULT (CALLBACK* D3DXCREATETEXTURE)
-    (LPDIRECT3DDEVICE9 pDevice,UINT Width,UINT Height,UINT MipLevels,DWORD Usage,
-    D3DFORMAT Format,D3DPOOL Pool,LPDIRECT3DTEXTURE9 *ppTexture);
-static D3DXCREATETEXTURE pD3DXCreateTexture;
-typedef HRESULT (CALLBACK* D3DXCHECKTEXTUREREQUIREMENTS)
-    (LPDIRECT3DDEVICE9 pDevice,UINT *pWidth,UINT *pHeight,UINT *pNumMipLevels,
-    DWORD Usage,D3DFORMAT *pFormat,D3DPOOL Pool);
-static D3DXCHECKTEXTUREREQUIREMENTS pD3DXCheckTextureRequirements;
-#endif
+#define USAGE (D3DCREATE_SOFTWARE_VERTEXPROCESSING)
 
 static int tformat;
 static int d3d_enabled, scanlines_ok;
@@ -64,6 +52,25 @@ static char *D3D_ErrorString (HRESULT dival)
     return dierr;
 }
 
+static D3DXMATRIX* xD3DXMatrixPerspectiveFovLH(D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf)
+{
+    double xscale, yscale, sine, dz;
+    memset(pOut, 0, sizeof(D3DXMATRIX));
+    fovy /= 2;
+    sine = sin(fovy);
+    dz = zf - zn;
+    if (sine == 0 || dz == 0 || Aspect == 0)
+        return pOut;
+    yscale = cos(fovy) / sine;
+    xscale = yscale / Aspect;
+    pOut->_11 = xscale;
+    pOut->_22 = yscale;
+    pOut->_33 = zf / dz;
+    pOut->_34 = 1;
+    pOut->_43 = -zn * zf / dz;
+    return pOut;
+}
+
 void D3D_free (void)
 {
     if (texture) {
@@ -114,7 +121,7 @@ static int restoredeviceobjects(void)
 
     // Set the projection matrix
     aspect = ((FLOAT)dsdbb.Width) / dsdbb.Height;
-    D3DXMatrixPerspectiveFovLH (&matrix, D3DX_PI/4, aspect, 1.0f, 100.0f);
+    xD3DXMatrixPerspectiveFovLH (&matrix, D3DX_PI/4, aspect, 1.0f, 100.0f);
     hr = IDirect3DDevice9_SetTransform(d3ddev, D3DTS_PROJECTION, &matrix);
 
     // turn off lighting
@@ -135,21 +142,55 @@ static int restoredeviceobjects(void)
     return 1;
 }
 
-static int createtexture (int w, int h)
+static LPDIRECT3DTEXTURE9 createtext(int *ww, int *hh, D3DFORMAT format)
 {
+    LPDIRECT3DTEXTURE9 t;
     HRESULT hr;
+    int w = *ww;
+    int h = *hh;
+
+    if (w < 256)
+       w = 256;
+    else if (w < 512)
+       w = 512;
+    else if (w < 1024)
+       w = 1024;
+    else if (w < 2048)
+       w = 2048;
+    else
+       w = 4096;
+
+    if (h < 256)
+       h = 256;
+    else if (h < 512)
+       h = 512;
+    else if (h < 1024)
+       h = 1024;
+    else if (h < 2048)
+       h = 2048;
+    else
+       h = 4096;
+
+    hr = IDirect3DDevice9_CreateTexture(d3ddev, w, h, 1, 0, format, D3DPOOL_MANAGED, &t, NULL);
+    if (FAILED (hr)) {
+       write_log ("DIDirect3DDevice9_CreateTexture failed: %s\n", D3D_ErrorString (hr));
+       return 0;
+    }
+
+    *ww = w;
+    *hh = h;
+    return t;
+}
+
+
+static int createtexture (int w, int h)
+{
     UINT ww = w;
     UINT hh = h;
-    D3DFORMAT format = tformat;
 
-    hr = D3DXCheckTextureRequirements(d3ddev, &ww, &hh, NULL, 0, &format, D3DPOOL_MANAGED);
-    if (FAILED (hr)) {
-       write_log ("D3DXCheckTextureRequirements failed: %s\n", D3D_ErrorString (hr));
-    }
-    hr = D3DXCreateTexture(d3ddev, ww, hh, 0, 0, format, D3DPOOL_MANAGED, &texture);
-    if (FAILED (hr)) {
-       write_log ("D3DXCreateTexture failed: %s\n", D3D_ErrorString (hr));
-    }
+    texture = createtext(&ww, &hh, tformat);
+    if (!texture)
+       return 0;
     twidth = ww;
     theight = hh;
     write_log ("D3D: %d*%d texture allocated, bits per pixel %d\n", ww, hh, t_depth);
@@ -157,21 +198,12 @@ static int createtexture (int w, int h)
 }
 static int createsltexture (void)
 {
-    HRESULT hr;
     UINT ww = required_sl_texture_w;
     UINT hh = required_sl_texture_h;
-    D3DFORMAT format = D3DFMT_A4R4G4B4;
 
-    hr = D3DXCheckTextureRequirements(d3ddev, &ww, &hh, NULL, 0, &format, D3DPOOL_MANAGED);
-    if (FAILED (hr)) {
-       write_log ("SL D3DXCheckTextureRequirements failed: %s\n", D3D_ErrorString (hr));
+    sltexture = createtext(&ww, &hh, D3DFMT_A4R4G4B4);
+    if (!sltexture)
        return 0;
-    }
-    hr = D3DXCreateTexture(d3ddev, ww, hh, 0, 0, format, D3DPOOL_MANAGED, &sltexture);
-    if (FAILED (hr)) {
-       write_log ("SL D3DXCreateTexture failed: %s\n", D3D_ErrorString (hr));
-       return 0;
-    }
     required_sl_texture_w = ww;
     required_sl_texture_h = hh;
     write_log ("D3D: SL %d*%d texture allocated\n", ww, hh);
@@ -242,10 +274,6 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
     D3DDISPLAYMODE mode;
     D3DCAPS9 d3dCaps;
     int adapter;
-#if 0
-    char d3dxdlls[100];
-    HINSTANCE d3dxDLL;
-#endif
 
     adapter = currprefs.gfx_display - 1;
     if (adapter < 0)
@@ -263,16 +291,6 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
        return errmsg;
     }
 
-#if 0
-    sprintf (d3dxdlls, "d3dx9_%d.dll", 27);
-    d3dxDLL = LoadLibrary(d3dxdlls);
-    pD3DXMatrixPerspectiveFovLH = (D3DXMATRIXPERSPECTIVEFOVLH)GetProcAddress(
-       d3dxDLL, "D3DXMatrixPerspectiveFovLH");
-    pD3DXCreateTexture = (D3DXCREATETEXTURE)GetProcAddress(
-       d3dxDLL, "D3DXCreateTexture");
-    pD3DXCheckTextureRequirements = (D3DXCHECKTEXTUREREQUIREMENTS)GetProcAddress(
-       d3dxDLL, "D3DXCheckTextureRequirements");
-#endif
     D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT))
        GetProcAddress(d3dDLL, "Direct3DCreate9");
     if(D3DCreate == NULL) {
@@ -314,7 +332,7 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
     }
 
     ret = IDirect3D9_CreateDevice(d3d, adapter, D3DDEVTYPE_HAL, ahwnd,
-       D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dpp, &d3ddev);
+       USAGE, &dpp, &d3ddev);
     if(FAILED(ret)) {
        sprintf (errmsg, "CreateDevice failed, %s\n", D3D_ErrorString (ret));
        D3D_free ();
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 0a52656..d33b316
@@ -150,6 +150,7 @@ int hdf_open (struct hardfiledata *hfd, char *name)
     int i;
     struct uae_driveinfo *udi;
 
+    hfd->flags = 0;
     hdf_close (hfd);
     hfd->cache = VirtualAlloc (NULL, CACHE_SIZE, MEM_COMMIT, PAGE_READWRITE);
     hfd->cache_valid = 0;
@@ -262,7 +263,6 @@ void hdf_close (struct hardfiledata *hfd)
     if (!hfd->handle_valid)
        return;
     hfd_log ("close handle=%p\n", hfd->handle);
-    hfd->flags = 0;
     if (hfd->handle && hfd->handle != INVALID_HANDLE_VALUE) {
        if (hfd->handle_valid == HDF_HANDLE_WIN32)
            CloseHandle (hfd->handle);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index ab0bc1f..7f96c5e
@@ -259,6 +259,45 @@ static int handlearcadia (int scancode, int state)
 
 #endif
 
+#ifdef CDTV
+
+static int handlecdtv (int scancode, int state)
+{
+    int e = 0;
+    switch (scancode)
+    {
+        case DIK_UP:
+        if (specialpressed())
+           e = INPUTEVENT_KEY_CDTV_PLAYPAUSE;
+       break;
+       case DIK_DOWN:
+       if (specialpressed())
+           e = INPUTEVENT_KEY_CDTV_STOP;
+       break;
+       case DIK_LEFT:
+       if (specialpressed()) {
+           if (shiftpressed())
+               e = INPUTEVENT_KEY_CDTV_REW;
+           else
+               e = INPUTEVENT_KEY_CDTV_PREV;
+       }
+       break;
+       case DIK_RIGHT:
+       if (specialpressed()) {
+           if (shiftpressed())
+               e = INPUTEVENT_KEY_CDTV_FF;
+           else
+               e = INPUTEVENT_KEY_CDTV_NEXT;
+       }
+       break;
+    }
+    if (!e)
+       return 0;
+    handle_input_event (e, state, 1, 0);
+    return 1;
+}
+#endif
+
 #ifdef CD32
 
 static int handlecd32 (int scancode, int state)
@@ -442,6 +481,9 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
            if (specialpressed ())
                code = AKS_STATEREWIND;
            break;
+           case DIK_ESCAPE:
+           bleh();
+           break;
        }
     }
 
@@ -450,10 +492,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
        return;
     }
 
-    if (specialpressed())
-       return;
-
-    if (scancode == DIK_CAPITAL) {
+    if (!specialpressed() && scancode == DIK_CAPITAL) {
        if (!newstate)
            return;
        capslockstate = capslockstate ? 0 : 1;
@@ -465,11 +504,18 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
        if (handlecd32 (scancode, newstate))
            return;
 #endif
+#ifdef CDTV
+       if (handlecdtv (scancode, newstate))
+           return;
+#endif
 #ifdef ARCADIA
        if (handlearcadia (scancode, newstate))
            return;
 #endif
     }
+    if (specialpressed())
+       return;
+
     inputdevice_translatekeycode (keyboard, scancode, newstate);
 }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 59b3e15..13c9cf1
@@ -15,7 +15,6 @@
 #if defined(NATMEM_OFFSET)
 
 static struct shmid_ds shmids[MAX_SHMID];
-static uae_u32 gfxoffs;
 
 uae_u8 *natmem_offset = NULL;
 #ifdef CPU_64_BIT
@@ -85,7 +84,6 @@ void init_shm(void)
     size = max_z3fastmem = (uae_u32)size64;
 
     canbang = 0;
-    gfxoffs = 0;
     shm_start = 0;
     for (i = 0; i < MAX_SHMID; i++) {
        shmids[i].attached = 0;
@@ -140,19 +138,16 @@ void mapped_free(uae_u8 *mem)
 {
     shmpiece *x = shm_start;
     while(x) {
-       if( mem == x->native_address )
-           shmdt( x->native_address);
+       if(mem == x->native_address)
+           shmdt(x->native_address);
        x = x->next;
     }
     x = shm_start;
     while(x) {
        struct shmid_ds blah;
        if (mem == x->native_address) {
-           if (shmctl(x->id, IPC_STAT, &blah) == 0) {
+           if (shmctl(x->id, IPC_STAT, &blah) == 0)
                shmctl(x->id, IPC_RMID, &blah);
-           } else {
-               VirtualFree((LPVOID)mem, 0, os_winnt ? MEM_DECOMMIT : MEM_RELEASE);
-           }
        }
        x = x->next;
     }
@@ -194,14 +189,12 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
        
 #ifdef NATMEM_OFFSET
     unsigned int size=shmids[shmid].size;
-    if(shmids[shmid].attached )
+    if(shmids[shmid].attached)
        return shmids[shmid].attached;
     if ((uae_u8*)shmaddr<natmem_offset) {
        if(!strcmp(shmids[shmid].name,"chip")) {
            shmaddr=natmem_offset;
            got = TRUE;
-//         if(!currprefs.fastmem_size)
-//             size+=32;
        }
        if(!strcmp(shmids[shmid].name,"kick")) {
            shmaddr=natmem_offset+0xf80000;
@@ -226,21 +219,26 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
            got = TRUE;
            size+=32;
        }
+       if(!strcmp(shmids[shmid].name,"ramsey_low")) {
+           shmaddr=natmem_offset + a3000lmem_start;
+           got = TRUE;
+       }
+       if(!strcmp(shmids[shmid].name,"ramsey_high")) {
+           shmaddr=natmem_offset + a3000hmem_start;
+           got = TRUE;
+       }
        if(!strcmp(shmids[shmid].name,"z3")) {
            shmaddr=natmem_offset+currprefs.z3fastmem_start;
-           if (allocated_z3fastmem<0x1000000)
-               gfxoffs=0x1000000;
-           else
-               gfxoffs=allocated_z3fastmem;
            got = TRUE;
        }
        if(!strcmp(shmids[shmid].name,"gfx")) {
-           shmaddr=natmem_offset+currprefs.z3fastmem_start+gfxoffs;
+           shmaddr=natmem_offset+currprefs.z3fastmem_start+currprefs.z3fastmem_size;
            got = TRUE;
-           size+=32;
+#if 0
            result=malloc(size);
            shmids[shmid].attached=result;
            return result;
+#endif
        }
        if(!strcmp(shmids[shmid].name,"bogo")) {
            shmaddr=natmem_offset+0x00C00000;
@@ -278,11 +276,14 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
                PAGE_EXECUTE_READWRITE);
            if (result == NULL) {
                result = (void*)-1;
-               write_log ("VirtualAlloc %p-%p %x (%dk) failed %d\n", shmaddr, (uae_u8*)shmaddr + size,
+               write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) failed %d\n",
+                   (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
                    size, size >> 10, GetLastError());
            } else {
                shmids[shmid].attached = result; 
-               write_log ("VirtualAlloc %p-%p %x (%dk) ok\n", shmaddr, (uae_u8*)shmaddr + size, size, size >> 10);
+               write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok\n",
+                   (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
+                   size, size >> 10);
            }
        } else {
            shmids[shmid].attached = shmaddr;
@@ -325,9 +326,12 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
                result = 0;
            break;
            case IPC_RMID:
+               VirtualFree(shmids[shmid].attached, os_winnt ? shmids[shmid].size : 0,
+                   os_winnt ? MEM_DECOMMIT : MEM_RELEASE);
                shmids[shmid].key = -1;
                shmids[shmid].name[0] = '\0';
                shmids[shmid].size = 0;
+               shmids[shmid].attached = 0;
                result = 0;
            break;
        }
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 0b99e2e..a1835f6
@@ -23,6 +23,7 @@
 #define IDS_PATHS                       17
 #define IDS_QUICKSTART                  18
 #define IDS_FRONTEND                    19
+#define IDS_CHIPSET2                    20
 #define IDS_EXTTEXT                     100
 #define IDS_EXTACTUAL                   101
 #define IDS_SOUND                       102
 #define IDD_CHIPSET                     154
 #define IDS_MUSTSELECTNAME              155
 #define IDI_MOVE_UP                     155
+#define IDD_CHIPSET2                    155
 #define IDS_MUSTSELECTFILE              156
 #define IDI_MOVE_DOWN                   156
 #define IDS_FAILEDHARDFILECREATION      157
 #define IDC_FASTMEM                     1027
 #define IDC_SHOWLEDS                    1027
 #define IDC_PORT1_JOYS                  1027
+#define IDC_MBMEM1                      1028
 #define IDC_SLOWMEM                     1030
+#define IDC_MBMEM2                      1031
 #define IDC_PARALLEL                    1033
 #define IDC_JULIAN                      1040
 #define IDC_FASTTEXT                    1043
 #define IDC_Z3TEXT                      1047
 #define IDC_Z3FASTRAM                   1048
 #define IDC_Z3FASTMEM                   1049
+#define IDC_MBRAM1                      1050
+#define IDC_MBRAM2                      1051
 #define IDC_UAEHOME                     1070
 #define IDC_PICASSOHOME                 1071
 #define IDC_AMIGAHOME                   1072
 #define IDC_POWERSAVE                   1612
 #define IDC_AVIOUTPUT_VIDEO             1613
 #define IDC_INPUTAUTOFIRE               1613
+#define IDC_MOUSETRICK                  1613
 #define IDC_AVIOUTPUT_AUDIO             1614
 #define IDC_INPUTCOPYFROM               1614
 #define IDC_AVIOUTPUT_VIDEO_CODEC       1615
 #define IDC_CREATE_NAME                 1707
 #define IDC_FILTERAUTORES               1708
 #define IDC_SOUND_AUTO                  1709
+#define IDC_CS_RTC                      1710
+#define IDC_CS_CIAA_TOD1                1711
+#define IDC_CS_CIAA_TOD2                1712
+#define IDC_CS_EXT                      1712
+#define IDC_CS_CIAA_TOD3                1713
+#define IDC_CS_COMPATIBLE               1714
+#define IDC_CS_RAMSEYREV                1715
+#define IDC_CS_KSMIRROR                 1716
+#define IDC_CS_CD32CD                   1717
+#define IDC_CS_CD32C2P                  1718
+#define IDC_CS_CD32NVRAM                1719
+#define IDC_CS_CDTVCD                   1720
+#define IDC_CS_CDTVRAM                  1721
+#define IDC_CS_IDE1                     1722
+#define IDC_CS_IDE2                     1723
+#define IDC_CS_IDE3                     1724
+#define IDC_CS_A1000RAM                 1724
+#define IDC_CS_RAMSEY                   1725
+#define IDC_CS_GARY                     1726
+#define IDC_CS_FATGARY                  1726
+#define IDC_CS_DMAC                     1727
+#define IDC_CS_RTCADJUST                1728
+#define IDC_CS_RAMSEYREV3               1729
+#define IDC_CS_FATGARYREV               1729
+#define IDC_CS_CDTVRAMEXP               1730
+#define IDC_CS_RTC1                     1731
+#define IDC_CS_RTC2                     1732
+#define IDC_CS_RTC3                     1733
+#define IDC_CS_IDE4                     1734
+#define IDC_CS_DF0IDHW                  1734
+#define IDC_CS_AGNUS                    1735
+#define IDC_CS_AGNUSREV                 1736
+#define IDC_CS_DENISE                   1737
+#define IDC_CS_AGNUSREV2                1738
+#define IDC_CS_DENISEREV                1738
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        253
 #define _APS_NEXT_COMMAND_VALUE         40021
-#define _APS_NEXT_CONTROL_VALUE         1710
+#define _APS_NEXT_CONTROL_VALUE         1716
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 732d969..1af540e
@@ -2,6 +2,11 @@
 // Used by winuae.rc
 //
 #define HIDC_CREATELOGFILE              0x808d0402    // IDD_MISC1 [English (United States)]
+#define HIDC_CS_AGNUSREV                0x809b06c8    // IDD_CHIPSET2 [English (United States)]
+#define HIDC_CS_DENISEREV               0x809b06ca    // IDD_CHIPSET2 [English (United States)]
+#define HIDC_CS_FATGARYREV              0x809b06c1    // IDD_CHIPSET2 [English (United States)]
+#define HIDC_CS_RAMSEYREV               0x809b06b3    // IDD_CHIPSET2 [English (United States)]
+#define HIDC_CS_RTCADJUST               0x809b06c0    // IDD_CHIPSET2 [English (United States)]
 #define HIDC_EDITDESCRIPTION            0x8087057e    // IDD_LOADSAVE [English (United States)]
 #define HIDC_EDITNAME                   0x8087057d    // IDD_LOADSAVE [English (United States)]
 #define HIDC_EDITPATH                   0x80870582    // IDD_LOADSAVE [English (United States)]
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 43197b5..dd713ef
@@ -32,7 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 //
 
 IDD_KICKSTART DIALOGEX 0, 0, 300, 176
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 EXSTYLE WS_EX_CONTEXTHELP
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
@@ -60,7 +60,7 @@ BEGIN
 END
 
 IDD_DISPLAY DIALOGEX 0, 0, 300, 202
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Screen",IDC_SCREENRESTEXT,12,0,199,67,BS_LEFT
@@ -98,30 +98,37 @@ BEGIN
 END
 
 IDD_MEMORY DIALOGEX 0, 0, 300, 175
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 EXSTYLE WS_EX_CONTEXTHELP
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
-    GROUPBOX        "Memory Settings",-1,14,40,274,93
-    RTEXT           "Chip:",-1,24,60,20,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,55,50,20
-    RTEXT           "Fast:",IDC_FASTTEXT,24,85,20,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,80,50,20
-    RTEXT           "Slow:",-1,149,60,20,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_SLOWMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,55,50,20
-    RTEXT           "Z3 Fast:",IDC_Z3TEXT,139,85,30,10,SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,80,60,20
-    RTEXT           "RTG: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,81,110,90,10,SS_NOTIFY | SS_CENTERIMAGE
-    CONTROL         "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,105,60,20
-    EDITTEXT        IDC_CHIPRAM,105,59,30,12,ES_CENTER | ES_READONLY
-    EDITTEXT        IDC_FASTRAM,105,86,30,12,ES_CENTER | ES_READONLY
-    EDITTEXT        IDC_SLOWRAM,243,58,30,12,ES_CENTER | ES_READONLY
-    EDITTEXT        IDC_Z3FASTRAM,243,85,30,12,ES_CENTER | ES_READONLY
-    EDITTEXT        IDC_P96RAM,243,108,30,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Memory Settings",-1,14,7,274,91
+    RTEXT           "Chip:",-1,24,31,20,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,22,50,20
+    EDITTEXT        IDC_CHIPRAM,105,26,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "Slow:",-1,149,31,20,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_SLOWMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,22,60,20
+    EDITTEXT        IDC_SLOWRAM,243,25,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "Fast:",IDC_FASTTEXT,24,52,20,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,47,50,20
+    EDITTEXT        IDC_FASTRAM,105,53,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "Z3 Fast:",IDC_Z3TEXT,139,52,30,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,47,60,20
+    EDITTEXT        IDC_Z3FASTRAM,243,52,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "RTG: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,81,77,90,10,SS_NOTIFY | SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,72,60,20
+    EDITTEXT        IDC_P96RAM,243,75,30,12,ES_CENTER | ES_READONLY
+    GROUPBOX        "Advanced Memory Settings",-1,13,104,275,65
+    RTEXT           "Motherboard RAM (Low area):",-1,39,122,129,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,117,59,20
+    EDITTEXT        IDC_MBRAM1,243,121,30,12,ES_CENTER | ES_READONLY
+    RTEXT           "Motherboard RAM (High area):",-1,39,144,127,10,SS_CENTERIMAGE
+    CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,139,59,20
+    EDITTEXT        IDC_MBRAM2,243,142,30,12,ES_CENTER | ES_READONLY
 END
 
 IDD_CPU DIALOGEX 0, 0, 300, 177
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
     GROUPBOX        "CPU",IDC_STATIC,5,5,81,166,BS_LEFT
@@ -164,7 +171,7 @@ BEGIN
 END
 
 IDD_FLOPPY DIALOGEX 0, 0, 300, 240
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
     RTEXT           "DF0:",IDC_STATIC,10,7,20,10,SS_CENTERIMAGE
@@ -211,7 +218,7 @@ BEGIN
 END
 
 IDD_HARDDISK DIALOGEX 0, 0, 300, 231
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 EXSTYLE WS_EX_CONTEXTHELP
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
@@ -228,7 +235,7 @@ BEGIN
 END
 
 IDD_SOUND DIALOGEX 0, 0, 300, 231
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     RTEXT           "Sound device:",IDC_SOUNDCARD,8,9,51,13,SS_CENTERIMAGE
@@ -268,7 +275,7 @@ BEGIN
 END
 
 IDD_LOADSAVE DIALOGEX 0, 0, 302, 241
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     CONTROL         "",IDC_CONFIGTREE,"SysTreeView32",TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,6,3,289,153,WS_EX_CLIENTEDGE
@@ -292,7 +299,7 @@ BEGIN
 END
 
 IDD_PORTS DIALOGEX 0, 0, 300, 238
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Parallel Port",IDC_SERPARFRAME,5,2,291,68
@@ -327,7 +334,7 @@ BEGIN
 END
 
 IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "UAE Authors and Contributors..."
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -336,7 +343,7 @@ BEGIN
 END
 
 IDD_ABOUT DIALOGEX 0, 0, 300, 191
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
     CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,45,10,210,15
@@ -356,19 +363,19 @@ BEGIN
 END
 
 IDD_MISC1 DIALOGEX 0, 0, 300, 237
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Advanced",IDC_STATIC,8,2,285,110
     CONTROL         "Untrap mouse with middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,15,120,10
-    CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,29,120,10
-    CONTROL         "On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,43,115,10
-    CONTROL         "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,57,117,10
-    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,70,117,10
+    CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,27,120,10
+    CONTROL         "On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,40,115,10
+    CONTROL         "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,53,117,10
+    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,66,117,10
     CONTROL         "bsdsocket.library emulation",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,15,120,10
-    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,29,120,10
-    CONTROL         "Don't use RGB overlays",IDC_NOOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,43,120,10
-    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,70,115,10
+    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,27,120,10
+    CONTROL         "Don't use RGB overlays",IDC_NOOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,40,120,10
+    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,66,115,10
     GROUPBOX        "Keyboard LEDs",IDC_STATIC,7,140,85,94
     COMBOBOX        IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@@ -378,23 +385,24 @@ BEGIN
     CONTROL         "Illegal memory accesses",IDC_ILLEGAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,151,95,10
     GROUPBOX        "State Files",IDC_STATIC,98,165,195,69
     PUSHBUTTON      "Load state...",IDC_DOLOADSTATE,105,182,49,14
-    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,106,208,49,14
+    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,105,208,49,14
     CONTROL         "Enable state recording",IDC_STATE_CAPTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,181,88,10
-    RTEXT           "Recording rate (seconds):",IDC_STATE_RATE_TEXT,157,199,86,10,SS_CENTERIMAGE | WS_TABSTOP
+    RTEXT           "Recording rate (seconds):",IDC_STATIC,157,199,86,10,SS_CENTERIMAGE | WS_TABSTOP
     COMBOBOX        IDC_STATE_RATE,248,197,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
-    RTEXT           "Recording buffer (MB):",IDC_STATE_BUFFERSIZE_TEXT,157,219,83,10,SS_CENTERIMAGE | WS_TABSTOP
+    RTEXT           "Recording buffer (MB):",IDC_STATIC,157,219,83,10,SS_CENTERIMAGE | WS_TABSTOP
     COMBOBOX        IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,83,117,10
-    CONTROL         "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,83,115,10
+    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,79,117,10
+    CONTROL         "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,79,115,10
     CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10
-    COMBOBOX        IDC_SCSIMODE,159,55,104,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SCSIMODE,159,51,104,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_LANGUAGE,103,121,179,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     GROUPBOX        "Language",IDC_STATIC,7,112,285,25
-    CONTROL         "Disable powersaving features",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,96,117,10
+    CONTROL         "Disable powersaving features",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,92,117,10
+    CONTROL         "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,92,119,10
 END
 
 IDD_HARDFILE DIALOGEX 0, 0, 299, 212
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Hardfile Settings"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -432,7 +440,7 @@ BEGIN
 END
 
 IDD_FILESYS DIALOGEX 15, 25, 299, 111
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Volume Settings"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -451,7 +459,7 @@ BEGIN
 END
 
 IDD_SETINFO DIALOGEX 0, 0, 229, 85
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Additional Information Settings"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -463,46 +471,85 @@ BEGIN
 END
 
 IDD_CHIPSET DIALOGEX 0, 65490, 300, 229
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
-    GROUPBOX        "Chipset",IDC_STATIC,14,11,145,82
+    GROUPBOX        "Chipset",IDC_STATIC,14,11,145,90
     CONTROL         "OCS [] Original chipset. A1000 and most A500s.",IDC_OCS,
-                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,38,31,51,10
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,37,26,51,10
     CONTROL         "ECS Agnus [] Enhanced chipset (ECS Agnus chip only). Later A500 and A2000 hardware revisions.",IDC_ECS_AGNUS,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,38,47,55,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,37,42,55,10
     CONTROL         "Full ECS [] Full ECS chipset (ECS Agnus and ECS Denise chips). A500+, A600 and A3000.",IDC_ECS,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,38,63,52,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,37,58,52,10
     CONTROL         "AGA [] Advanced Graphics Architecture chipset. A1200, A4000 and CD32.",IDC_AGA,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,101,31,51,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,100,26,51,10
     CONTROL         "NTSC [] North American and Japanese display standard, 60Hz refresh rate. Other countries use PAL (50Hz. display refresh rate)",IDC_NTSC,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,63,50,10
-    GROUPBOX        "Options",IDC_STATIC,168,11,114,82
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,58,50,10
+    GROUPBOX        "Options",IDC_STATIC,168,11,114,89
     CONTROL         "Immediate Blitter [] Faster but less compatible blitter emulation.",IDC_BLITIMM,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,30,96,10
     CONTROL         "Cycle-exact CPU and Blitter [] The most compatible A500 emulation mode. Very fast PC recommended.",IDC_CYCLEEXACT,
                     "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,43,100,10
-    GROUPBOX        "Collision Level",IDC_STATIC,14,97,267,48
+    GROUPBOX        "Collision Level",IDC_STATIC,14,105,267,48
     CONTROL         "None [] Collision hardware emulation disabled.",IDC_COLLISION0,
-                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,40,113,50,10
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,40,121,50,10
     CONTROL         "Sprites only [] Emulate only sprite vs. sprite collisions.",IDC_COLLISION1,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,129,50,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,137,50,10
     CONTROL         "Sprites and Sprites vs. Playfield [] Recommended collision emulation level.",IDC_COLLISION2,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,113,161,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,121,161,10
     CONTROL         "Full [] 100% collision hardware emulation. Only very few games need this option. Slowest.",IDC_COLLISION3,
-                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,129,82,10
-    GROUPBOX        "Sound Emulation",IDC_STATIC,13,151,268,65
-    CONTROL         "Disabled",IDC_CS_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,39,167,102,10
-    CONTROL         "Emulated",IDC_CS_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,182,91,10
-    CONTROL         "Emulated, 100% accurate",IDC_CS_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,197,95,10
+                    "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,137,82,10
+    GROUPBOX        "Sound Emulation",IDC_STATIC,13,159,268,65
+    CONTROL         "Disabled",IDC_CS_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,39,175,102,10
+    CONTROL         "Emulated",IDC_CS_SOUND1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,190,91,10
+    CONTROL         "Emulated, 100% accurate",IDC_CS_SOUND2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,205,95,10
     CONTROL         "Genlock connected [] Allow boot sequence to detect genlock. Genlock is not emulated.",IDC_GENLOCK,
                     "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,56,100,10
     CONTROL         "Faster RTG [] Enables less accurate custom chipset emulation mode when Picasso96 is enabled.",IDC_FASTERRTG,
                     "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,174,68,100,10
+    COMBOBOX        IDC_CS_EXT,101,80,49,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Chipset Extra",IDC_STATIC,25,79,52,15,SS_CENTERIMAGE
+END
+
+IDD_CHIPSET2 DIALOGEX 0, 65490, 300, 247
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+    GROUPBOX        "Advanced Chipset Options",IDC_STATIC,7,6,287,239
+    GROUPBOX        "Battery Backed Up Real Time Clock",IDC_STATIC,14,37,275,29
+    CONTROL         "None",IDC_CS_RTC1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,22,49,55,10
+    CONTROL         "MSM6242B",IDC_CS_RTC2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,91,49,52,10
+    CONTROL         "RF5C01A",IDC_CS_RTC3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,160,49,46,10
+    EDITTEXT        IDC_CS_RTCADJUST,218,47,64,13,ES_AUTOHSCROLL,0,HIDC_CS_RTCADJUST
+    GROUPBOX        "CIA-A TOD Clock Source",IDC_STATIC,12,69,275,29
+    CONTROL         "Vertical Sync",IDC_CS_CIAA_TOD1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,25,81,63,10
+    CONTROL         "Power Supply 50Hz",IDC_CS_CIAA_TOD2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,95,81,85,10
+    CONTROL         "Power Supply 60Hz",IDC_CS_CIAA_TOD3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,192,81,91,10
+    CONTROL         "Boot ROM Mirror",IDC_CS_KSMIRROR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,128,80,10
+    CONTROL         "A1000 Boot RAM/ROM",IDC_CS_A1000RAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,128,96,10
+    CONTROL         "CD32 CD",IDC_CS_CD32CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,141,76,10
+    CONTROL         "CD32 C2P",IDC_CS_CD32C2P,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,141,85,10
+    CONTROL         "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,141,84,10
+    CONTROL         "CDTV CD Controller",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,154,79,10
+    CONTROL         "CDTV SRAM",IDC_CS_CDTVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,153,90,10
+    CONTROL         "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,153,90,10
+    CONTROL         "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,166,79,10
+    CONTROL         "A4000 IDE",IDC_CS_IDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,166,84,10
+    CONTROL         "Ramsey revision:",IDC_CS_RAMSEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,201,71,10
+    EDITTEXT        IDC_CS_RAMSEYREV,94,199,45,13,ES_AUTOHSCROLL,0,HIDC_CS_RAMSEYREV
+    CONTROL         "Fat Gary revision:",IDC_CS_FATGARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,214,71,10
+    EDITTEXT        IDC_CS_FATGARYREV,94,213,45,13,ES_AUTOHSCROLL,0,HIDC_CS_FATGARYREV
+    CONTROL         "Motherboard Super DMAC",IDC_CS_DMAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,227,118,10
+    CONTROL         "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,21,234,10
+    CONTROL         "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,128,95,10
+    CONTROL         "Agnus/Alice revision:",IDC_CS_AGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,201,81,10
+    EDITTEXT        IDC_CS_AGNUSREV,235,199,45,13,ES_AUTOHSCROLL,0,HIDC_CS_AGNUSREV
+    CONTROL         "Denise/Lisa revision:",IDC_CS_DENISE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,214,81,10
+    EDITTEXT        IDC_CS_DENISEREV,235,213,45,13,ES_AUTOHSCROLL,0,HIDC_CS_DENISEREV
 END
 
 IDD_AVIOUTPUT DIALOGEX 0, 0, 288, 203
-STYLE DS_SETFONT | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Output Properties",IDC_STATIC,5,8,274,118
@@ -532,7 +579,7 @@ BEGIN
 END
 
 IDD_INPUT DIALOGEX 0, 0, 300, 242
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     COMBOBOX        IDC_INPUTTYPE,5,5,98,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
@@ -557,7 +604,7 @@ BEGIN
 END
 
 IDD_FILTER DIALOGEX 0, 0, 296, 224
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Filter Settings",-1,0,0,294,186
@@ -594,7 +641,7 @@ BEGIN
 END
 
 IDD_HARDDRIVE DIALOGEX 0, 0, 380, 66
-STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Harddrive Settings"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -608,7 +655,7 @@ BEGIN
 END
 
 IDD_MISC2 DIALOGEX 0, 0, 300, 92
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "When Active",IDC_STATIC,8,7,88,73
@@ -627,7 +674,7 @@ BEGIN
 END
 
 IDD_DISK DIALOGEX 0, 0, 300, 242
-STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_CONTROL | DS_CENTER | DS_CENTERMOUSE | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_CONTROL | DS_CENTER | DS_CENTERMOUSE | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
     CONTROL         "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,6,292,196
@@ -637,7 +684,7 @@ BEGIN
 END
 
 IDD_PANEL DIALOGEX 0, 0, 420, 278
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT
 CAPTION "WinUAE Properties"
 FONT 8, "MS Sans Serif", 0, 0, 0x0
@@ -653,7 +700,7 @@ BEGIN
 END
 
 IDD_PATHS DIALOGEX 0, 0, 300, 237
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     LTEXT           "System ROMs:",IDC_PATHS_ROML,14,9,260,8,SS_CENTERIMAGE
@@ -682,7 +729,7 @@ BEGIN
 END
 
 IDD_QUICKSTART DIALOGEX 0, 0, 300, 242
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     GROUPBOX        "Emulated Hardware",IDC_QUICKSTART_CONFIG,3,0,294,54
@@ -716,7 +763,7 @@ BEGIN
 END
 
 IDD_FRONTEND DIALOGEX 0, 0, 420, 242
-STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
     CONTROL         "",IDC_FE_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,9,235,124
@@ -725,7 +772,7 @@ BEGIN
 END
 
 IDD_PROGRESSBAR DIALOGEX 0, 0, 229, 58
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Processing..."
 FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
@@ -759,11 +806,6 @@ BEGIN
         BOTTOMMARGIN, 212
     END
 
-    IDD_MISC1, DIALOG
-    BEGIN
-        BOTTOMMARGIN, 226
-    END
-
     IDD_INPUT, DIALOG
     BEGIN
         BOTTOMMARGIN, 240
@@ -839,8 +881,8 @@ IDI_PATHS               ICON                    "paths.ico"
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,3,4,0
- PRODUCTVERSION 1,3,4,0
+ FILEVERSION 1,4,0,0
+ PRODUCTVERSION 1,4,0,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -856,12 +898,12 @@ BEGIN
         BLOCK "040904b0"
         BEGIN
             VALUE "FileDescription", "WinUAE"
-            VALUE "FileVersion", "1.3.4"
+            VALUE "FileVersion", "1.4.0"
             VALUE "InternalName", "WinUAE"
-            VALUE "LegalCopyright", "© 1996-2006 under the GNU Public License (GPL)"
+            VALUE "LegalCopyright", "© 1996-2007 under the GNU Public License (GPL)"
             VALUE "OriginalFilename", "WinUAE.exe"
             VALUE "ProductName", "WinUAE"
-            VALUE "ProductVersion", "1.3.4"
+            VALUE "ProductVersion", "1.4.0"
         END
     END
     BLOCK "VarFileInfo"
@@ -952,6 +994,7 @@ BEGIN
     IDS_PATHS               "Paths"
     IDS_QUICKSTART          "Quickstart"
     IDS_FRONTEND            "Frontend"
+    IDS_CHIPSET2            "Adv. Chipset"
 END
 
 STRINGTABLE 
@@ -1074,8 +1117,6 @@ BEGIN
     IDS_SOUND_MIXED         "Mixed"
     IDS_SOUND_STEREO        "Stereo"
     IDS_SOUND_INTERPOL_DISABLED "Disabled"
-    IDS_SOUND_INTERPOL_RH   "RH"
-    IDS_SOUND_INTERPOL_CRUX "Crux"
     IDS_SOUND_FILTER_OFF    "Always off"
     IDS_SOUND_FILTER_EMULATED "Emulated (A500)"
 END
@@ -1190,7 +1231,7 @@ END
 
 STRINGTABLE 
 BEGIN
-    IDS_QS_MODELS           "A500/A2000\nA500+\nA600\nA1000\nA1200\nCD32\nCDTV (CD-ROM emulation not yet working)\nArcadia Multi Select system\nExpanded WinUAE example configuration"
+    IDS_QS_MODELS           "A500\nA500+\nA600\nA1000\nA1200\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration"
     IDS_QS_MODEL_A500       "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)."
     IDS_QS_MODEL_A500P      "Basic non-expanded configuration\nThe A500+ adds an ECS Agnus chip, 1 MB of Chip RAM and a 2.0 ROM to the A500. Many A500 games and demos don't work properly on an A500+.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"
     IDS_QS_MODEL_A600       "Basic non-expanded configuration\nThe A600 is smaller than the A500+ and has an updated 2.0 ROM.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n"
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 229a89b..9fe74e2
@@ -385,6 +385,8 @@ uae_u8 serial_readstatus(uae_u8 dir)
 
 uae_u8 serial_writestatus (uae_u8 newstate, uae_u8 dir)
 {
+    static int logcnt = 10;
+
 #ifdef SERIAL_PORT
     if (((oldserbits ^ newstate) & 0x80) && (dir & 0x80)) {
        if (newstate & 0x80)
@@ -418,10 +420,16 @@ uae_u8 serial_writestatus (uae_u8 newstate, uae_u8 dir)
         write_log ("SERIAL: warning, program tries to use DSR as an output!\n");
 #endif
 
-    if (((newstate ^ oldserbits) & 0x40) && !(dir & 0x40))
-        write_log ("SERIAL: warning, program tries to use RTS as an input!\n");
-    if (((newstate ^ oldserbits) & 0x80) && !(dir & 0x80))
-        write_log ("SERIAL: warning, program tries to use DTR as an input!\n");
+    if (logcnt > 0) {
+       if (((newstate ^ oldserbits) & 0x40) && !(dir & 0x40)) {
+           write_log ("SERIAL: warning, program tries to use RTS as an input! PC=%x\n", M68K_GETPC);
+           logcnt--;
+       }
+       if (((newstate ^ oldserbits) & 0x80) && !(dir & 0x80)) {
+           write_log ("SERIAL: warning, program tries to use DTR as an input! PC=%x\n", M68K_GETPC);
+           logcnt--;
+       }
+    }
 
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index fafbfab..fd4e3a7
@@ -68,18 +68,8 @@ static char *sound_devices[MAX_SOUND_DEVICES];
 GUID sound_device_guid[MAX_SOUND_DEVICES];
 static int num_sound_devices;
 
-#ifdef USE_PRIMARY_BUFFER
-static LPDIRECTSOUNDBUFFER lpDSBprimary;
-#endif
-
-#define USE_DS8
-#ifdef USE_DS8
 static LPDIRECTSOUND8 lpDS;
 static LPDIRECTSOUNDBUFFER8 lpDSBsecondary;
-#else
-static LPDIRECTSOUND lpDS;
-static LPDIRECTSOUNDBUFFER lpDSBsecondary;
-#endif
 
 static DWORD writepos;
 
@@ -230,9 +220,6 @@ static int open_audio_ds (int size)
     HRESULT hr;
     DSBUFFERDESC sound_buffer;
     DSCAPS DSCaps;
-#ifdef USE_PRIMARY_BUFFER
-    DSBCAPS DSBCaps;
-#endif
     WAVEFORMATEXTENSIBLE wavfmt;
     LPDIRECTSOUNDBUFFER pdsb;
     int freq = currprefs.sound_freq;
@@ -267,13 +254,9 @@ static int open_audio_ds (int size)
 
     recalc_offsets();
 
-#ifdef USE_DS8
     hr = DirectSoundCreate8 (&sound_device_guid[currprefs.win32_soundcard], &lpDS, NULL);
-#else
-    hr = DirectSoundCreate (&sound_device_guid[currprefs.win32_soundcard], &lpDS, NULL);
-#endif
     if (FAILED(hr))  {
-        write_log ("SOUND: DirectSoundCreate() failure: %s\n", DXError (hr));
+        write_log ("SOUND: DirectSoundCreate8() failure: %s\n", DXError (hr));
         return 0;
     }
 
@@ -308,31 +291,6 @@ static int open_audio_ds (int size)
        }
     }
 
-#if 0
-    memset (&sound_buffer, 0, sizeof (sound_buffer));
-    sound_buffer.dwSize = sizeof (sound_buffer);
-    sound_buffer.dwFlags = DSBCAPS_PRIMARYBUFFER;
-    hr = IDirectSound_CreateSoundBuffer (lpDS, &sound_buffer, &lpDSBprimary, NULL);
-    if (FAILED(hr))  {
-        write_log ("SOUND: Primary CreateSoundBuffer() failure: %s\n", DXError (hr));
-       goto error;
-    }
-
-    memset(&DSBCaps, 0, sizeof(DSBCaps));
-    DSBCaps.dwSize = sizeof(DSBCaps);
-    hr = IDirectSoundBuffer_GetCaps(lpDSBprimary, &DSBCaps);
-    if (FAILED(hr)) {
-       write_log ("SOUND: Primary GetCaps() failure: %s\n",  DXError (hr));
-       goto error;
-    }
-
-    hr = IDirectSoundBuffer_SetFormat (lpDSBprimary, &wavfmt.Format);
-    if (FAILED(hr))  {
-        write_log ("SOUND: Primary SetFormat() failure: %s\n", DXError (hr));
-        goto error;
-    }
-#endif
-
     round = 0;
     for (;;) {
        int extend = round > 0 && ch > 2;
@@ -348,7 +306,7 @@ static int open_audio_ds (int size)
            wavfmt.Format.cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX);
            wavfmt.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
            wavfmt.Samples.wValidBitsPerSample = 16;
-           wavfmt.dwChannelMask = round == 1 ? SPEAKER_ALL : KSAUDIO_SPEAKER_QUAD;
+           wavfmt.dwChannelMask = round == 1 ? KSAUDIO_SPEAKER_QUAD : SPEAKER_ALL;
        }
 
        write_log ("SOUND: %s:%d '%s'/%d/%d bits/%d Hz/buffer %d/dist %d\n",
@@ -378,17 +336,12 @@ static int open_audio_ds (int size)
        break;
     }
 
-#ifdef USE_DS8
     hr = IDirectSound_QueryInterface(pdsb, &IID_IDirectSoundBuffer8, (LPVOID*)&lpDSBsecondary);
     if (FAILED(hr))  {
         write_log ("SOUND: Secondary QueryInterface() failure: %s\n", DXError (hr));
        goto error;
     }
     IDirectSound_Release(pdsb);
-#else
-    lpDSBsecondary = pdsb;
-    pdsb = NULL;
-#endif
 
     setvolume ();
     cleardsbuffer ();
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 604839e..fd48f44
@@ -108,6 +108,7 @@ int pause_emulation;
 
 static int didmousepos;
 static int sound_closed;
+static int recapture;
 int mouseactive, focus;
 
 static int mm_timerres;
@@ -452,16 +453,26 @@ static void checkpause (void)
     }
 }
 
+static int showcursor;
+
 void setmouseactive (int active)
 {
     int oldactive = mouseactive;
-    static int mousecapture, showcursor;
     char txt[400], txt2[200];
 
+    if (showcursor) {
+       ClipCursor(NULL);
+       ReleaseCapture();
+       ShowCursor (TRUE);
+       showcursor = 0;
+    }
+    recapture = 0;
+#if 0
     if (active > 0 && mousehack_allowed () && mousehack_alive ()) {
        if (!isfullscreen ())
            return;
     }
+#endif
     inputdevice_unacquire ();
 
     mouseactive = active;
@@ -479,28 +490,15 @@ void setmouseactive (int active)
        strcat (txt, txt2);
     }
     SetWindowText (hMainWnd, txt);
-    if (mousecapture) {
-       ClipCursor (0);
-       ReleaseCapture ();
-       mousecapture = 0;
-    }
-    if (showcursor) {
-       ShowCursor (TRUE);
-       showcursor = 0;
-    }
     if (mouseactive) {
        if (focus) {
-           if (!showcursor)
+           if (!showcursor) {
                ShowCursor (FALSE);
-           showcursor = 1;
-           if (!isfullscreen()) {
-               if (!mousecapture) {
-                   SetCapture (hAmigaWnd);
-                   ClipCursor (&amigawin_rect);
-               }
-               mousecapture = 1;
-               setcursor (-1, -1);
+               SetCapture (hAmigaWnd);
+               ClipCursor (&amigawin_rect);
            }
+           showcursor = 1;
+           setcursor (-1, -1);
        }
        inputdevice_acquire ();
     }
@@ -561,16 +559,6 @@ static void winuae_active (HWND hWnd, int minimized)
        set_audio ();
        sound_closed = 0;
     }
-#if 0
-#ifdef AHI
-    ahi_close_sound ();
-#endif
-    close_sound ();
-#ifdef AHI
-    ahi_open_sound ();
-#endif
-    set_audio ();
-#endif
     if (WIN32GFX_IsPicassoScreen ())
        WIN32GFX_EnablePicasso();
     getcapslock ();
@@ -629,18 +617,6 @@ static void winuae_inactive (HWND hWnd, int minimized)
 #ifdef FILESYS
     filesys_flush_cache ();
 #endif
-#if 0
-    close_sound ();
-#ifdef AHI
-    ahi_close_sound ();
-#endif
-    if (gui_active)
-       return;
-    set_audio ();
-#ifdef AHI
-    ahi_open_sound ();
-#endif
-#endif
 }
 
 void minimizewindow (void)
@@ -651,12 +627,32 @@ void minimizewindow (void)
 void disablecapture (void)
 {
     setmouseactive (0);
-#if 0
-    close_sound ();
-#ifdef AHI
-    ahi_close_sound ();
-#endif
-#endif
+}
+
+extern void setamigamouse(int,int);
+void setmouseactivexy(int x, int y, int dir)
+{
+    int diff = 8;
+    if (isfullscreen())
+       return;
+    x += amigawin_rect.left;
+    y += amigawin_rect.top;
+    if (dir & 1)
+       x = amigawin_rect.left - diff;
+    if (dir & 2)
+       x = amigawin_rect.right + diff;
+    if (dir & 4)
+       y = amigawin_rect.top - diff;
+    if (dir & 8)
+       y = amigawin_rect.bottom + diff;
+    if (!dir) {
+       x += (amigawin_rect.right - amigawin_rect.left) / 2;
+       y += (amigawin_rect.bottom - amigawin_rect.top) / 2;
+    }
+    disablecapture();
+    SetCursorPos(x, y);
+    if (dir)
+       recapture = 1;
 }
 
 static void handleXbutton (WPARAM wParam, int updown)
@@ -900,10 +896,15 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
     case WM_MOUSEMOVE:
     {
-       if (normal_display_change_starting)
-           return 0;
        mx = (signed short) LOWORD (lParam);
        my = (signed short) HIWORD (lParam);
+       if (recapture && !isfullscreen()) {
+           setmouseactive(1);
+           setamigamouse(mx, my);
+           return 0;
+       }
+       if (normal_display_change_starting)
+           return 0;
        if (dinput_winmouse () >= 0) {
            if (dinput_winmousemode ()) {
                /* absolete + mousehack */
@@ -923,7 +924,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
            setmousestate (0, 0, mx, 1);
            setmousestate (0, 1, my, 1);
        }
-       if (mouseactive)
+       if (showcursor || mouseactive)
            setcursor (LOWORD (lParam), HIWORD (lParam));
     }
     return 0;
@@ -1589,8 +1590,6 @@ int debuggable (void)
 
 int mousehack_allowed (void)
 {
-    if (nr_units (currprefs.mountinfo) == 0)
-       return 0;
     return dinput_winmouse () > 0 && dinput_winmousemode ();
 }
 
@@ -1615,8 +1614,12 @@ void logging_open(int bootlog, int append)
 #endif
 }
 
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+
 void logging_init(void)
 {
+    LPFN_ISWOW64PROCESS fnIsWow64Process;
+    int wow64 = 0;
     static int started;
     static int first;
 
@@ -1631,17 +1634,17 @@ void logging_init(void)
     }
     logging_open(first ? 0 : 1, 0);
     first++;
+    fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"),"IsWow64Process");
+    if (fnIsWow64Process)
+       fnIsWow64Process(GetCurrentProcess(), &wow64);
     write_log ("%s (%s %d.%d %s%s%s)", VersionStr, os_winnt ? "NT" : "W9X/ME",
        osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion,
        strlen(osVersion.szCSDVersion) > 0 ? " " : "", os_winnt_admin ? "Admin" : "");
-    write_log (" %s %X.%X %d",
-       SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL ? "32-bit x86" :
-       SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 ? "IA64" :
-       SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ? "64-bit" : "Unknown",
+    write_log (" %d-bit %X.%X %d", wow64 ? 64 : 32,
        SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision,
        SystemInfo.dwNumberOfProcessors);
     write_log ("\n(c) 1995-2001 Bernd Schmidt   - Core UAE concept and implementation."
-              "\n(c) 1998-2006 Toni Wilen      - Win32 port, core code updates."
+              "\n(c) 1998-2007 Toni Wilen      - Win32 port, core code updates."
               "\n(c) 1996-2001 Brian King      - Win32 port, Picasso96 RTG, and GUI."
               "\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support."
               "\n(c) 2000-2001 Bernd Meyer     - JIT engine."
@@ -1715,6 +1718,7 @@ void target_default_options (struct uae_prefs *p, int type)
        p->win32_uaescsimode = get_aspi_path(1) ? 2 : ((os_winnt && os_winnt_admin) ? 0 : 1);
        p->win32_borderless = 0;
        p->win32_powersavedisabled = 1;
+       p->win32_outsidemouse = 1;
     }
     if (type == 1 || type == 0) {
        p->win32_midioutdev = -2;
@@ -1727,6 +1731,7 @@ static const char *scsimode[] = { "SPTI", "SPTI+SCSISCAN", "AdaptecASPI", "NeroA
 void target_save_options (struct zfile *f, struct uae_prefs *p)
 {
     cfgfile_target_write (f, "middle_mouse=%s\n", p->win32_middle_mouse ? "true" : "false");
+    cfgfile_target_write (f, "magic_mouse=%s\n", p->win32_outsidemouse ? "true" : "false");
     cfgfile_target_write (f, "logfile=%s\n", p->win32_logfile ? "true" : "false");
     cfgfile_target_write (f, "map_drives=%s\n", p->win32_automount_drives ? "true" : "false");
     cfgfile_target_write (f, "map_net_drives=%s\n", p->win32_automount_netdrives ? "true" : "false");
@@ -1801,6 +1806,7 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
            || cfgfile_yesno (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
            || cfgfile_yesno (option, value, "always_on_top", &p->win32_alwaysontop)
            || cfgfile_yesno (option, value, "powersavedisabled", &p->win32_powersavedisabled)
+           || cfgfile_yesno (option, value, "magic_mouse", &p->win32_outsidemouse)
            || cfgfile_intval (option, value, "specialkey", &p->win32_specialkey, 1)
            || cfgfile_intval (option, value, "kbledmode", &p->win32_kbledmode, 1)
            || cfgfile_intval (option, value, "cpu_idle", &p->cpu_idle, 1));
@@ -2098,7 +2104,7 @@ static void WIN32_HandleRegistryStuff(void)
                              KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS))
        {
            /* Set our (default) sub-key to BE the "WinUAE" command for editing a configuration */
-           sprintf(path, "%sWinUAE.exe -f \"%%1\" -s use_gui=yes", start_path_exe);
+           sprintf(path, "\"%sWinUAE.exe\" -f \"%%1\" -s use_gui=yes", start_path_exe);
            RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen(path) + 1);
            RegCloseKey(hWinUAEKeyLocal);
        }
@@ -2107,7 +2113,7 @@ static void WIN32_HandleRegistryStuff(void)
                              KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS))
        {
            /* Set our (default) sub-key to BE the "WinUAE" command for launching a configuration */
-           sprintf(path, "%sWinUAE.exe -f \"%%1\"", start_path_exe);
+           sprintf(path, "\"%sWinUAE.exe\" -f \"%%1\"", start_path_exe);
            RegSetValueEx(hWinUAEKeyLocal, "", 0, REG_SZ, (CONST BYTE *)path, strlen( path ) + 1);
            RegCloseKey(hWinUAEKeyLocal);
        }
@@ -2918,7 +2924,8 @@ static LONG WINAPI ExceptionFilter( struct _EXCEPTION_POINTERS * pExceptionPoint
                p = slash + 1;
            else
                p = path2;
-           sprintf (p, "winuae_%d%02d%02d_%02d%02d%02d.dmp",
+           sprintf (p, "winuae_%d%d%d%d_%d%02d%02d_%02d%02d%02d.dmp",
+               UAEMAJOR, UAEMINOR, UAESUBREV, WINUAEBETA,
                when.tm_year + 1900, when.tm_mon + 1, when.tm_mday, when.tm_hour, when.tm_min, when.tm_sec);
            if (dll == NULL)
                dll = WIN32_LoadLibrary ("DBGHELP.DLL");
@@ -3095,7 +3102,6 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
 
     thread = GetCurrentThread();
     original_affinity = SetThreadAffinityMask(thread, 1); 
-    SetThreadAffinityMask(thread, original_affinity);
 #if 0
     CHANGEWINDOWMESSAGEFILTER pChangeWindowMessageFilter;
     pChangeWindowMessageFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(
old mode 100755 (executable)
new mode 100644 (file)
index 80b8709..fa49d28
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 0
+#define WINUAEBETA 1
 #define WINUAEPUBLICBETA 0
-#define WINUAEDATE MAKEBD(2006, 12, 30)
+#define WINUAEDATE MAKEBD(2007, 1, 13)
 
 #define IHF_WINDOWHIDDEN 6
 #define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index c61cc4d..76827ba
@@ -1,15 +1,15 @@
 
 
 /* Determines if this drive-letter currently has a disk inserted */
-static int CheckRM( char *DriveName )
+static int CheckRM(char *DriveName)
 {
-    char filename[ MAX_DPATH ];
+    char filename[MAX_DPATH];
     DWORD dwHold;
     BOOL result = FALSE;
 
-    sprintf( filename, "%s.", DriveName );
-    dwHold = GetFileAttributes( filename );
-    if( dwHold != 0xFFFFFFFF )
+    sprintf(filename, "%s.", DriveName);
+    dwHold = GetFileAttributes(filename);
+    if(dwHold != 0xFFFFFFFF)
        result = TRUE;
     return result;
 }
@@ -18,24 +18,19 @@ static int CheckRM( char *DriveName )
    illegal values: */
 static char *illegal_volumenames[] = { "SYS", "DEVS", "LIBS", "FONTS", "C", "L", "S" };
 
-static int valid_volumename( struct uaedev_mount_info *mountinfo, char *volumename, int fullcheck )
+static int valid_volumename(struct uaedev_mount_info *mountinfo, char *volumename, int fullcheck)
 {
-    int i, result = 1, illegal_count = sizeof( illegal_volumenames ) / sizeof( char *);
-    for( i = 0; i < illegal_count; i++ )
-    {
-       if( strcmp( volumename, illegal_volumenames[i] ) == 0 )
-       {
+    int i, result = 1, illegal_count = sizeof(illegal_volumenames) / sizeof(char *);
+    for (i = 0; i < illegal_count; i++) {
+       if(strcmp(volumename, illegal_volumenames[i]) == 0) {
            result = 0;
            break;
        }
     }
     /* if result is still good, we've passed the illegal names check, and must check for duplicates now */
-    if( result && fullcheck)
-    {
-       for( i = 0; i < mountinfo->num_units; i++ )
-       {
-           if( mountinfo->ui[i].volname && ( strcmp( mountinfo->ui[i].volname, volumename ) == 0 ) )
-           {
+    if(result && fullcheck) {
+       for(i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
+           if(mountinfo->ui[i].open && mountinfo->ui[i].volname && strcmp(mountinfo->ui[i].volname, volumename) == 0) {
                result = 0;
                break;
            }
@@ -50,36 +45,35 @@ static int get_volume_name( struct uaedev_mount_info *mtinf, char *volumepath, c
     int result = 2;
     static int cd_number = 0;
 
-    if( inserted )
-    {
-       if( GetVolumeInformation( volumepath, volumename, size, NULL, NULL, NULL, NULL, 0 ) && volumename[0] && valid_volumename( mtinf, volumename, fullcheck ) )
-       {
+    if(inserted) {
+       if(GetVolumeInformation(volumepath, volumename, size, NULL, NULL, NULL, NULL, 0) && volumename[0] && valid_volumename(mtinf, volumename, fullcheck)) {
            // +++Bernd Roesch
-           if(!strcmp(volumename,"AmigaOS35"))strcpy(volumename,"AmigaOS3.5");
-           if(!strcmp(volumename,"AmigaOS39"))strcpy(volumename,"AmigaOS3.9");
+           if(!strcmp(volumename, "AmigaOS35"))
+               strcpy(volumename, "AmigaOS3.5");
+           if(!strcmp(volumename, "AmigaOS39"))
+               strcpy(volumename, "AmigaOS3.9");
            // ---Bernd Roesch
            result = 1;
        }
     }
 
-    if( result == 2 )
-    {
-       switch( drivetype )
+    if(result == 2) {
+       switch(drivetype)
        {
            case DRIVE_FIXED:
-               sprintf( volumename, "WinDH_%c", volumepath[0] );
+               sprintf(volumename, "WinDH_%c", volumepath[0]);
                break;
            case DRIVE_CDROM:
-               sprintf( volumename, "WinCD_%c", volumepath[0] );
+               sprintf(volumename, "WinCD_%c", volumepath[0]);
                break;
            case DRIVE_REMOVABLE:
-               sprintf( volumename, "WinRMV_%c", volumepath[0] );
+               sprintf(volumename, "WinRMV_%c", volumepath[0]);
                break;
            case DRIVE_REMOTE:
-               sprintf( volumename, "WinNET_%c", volumepath[0] );
+               sprintf(volumename, "WinNET_%c", volumepath[0]);
                break;
            case DRIVE_RAMDISK:
-               sprintf( volumename, "WinRAM_%c", volumepath[0] );
+               sprintf(volumename, "WinRAM_%c", volumepath[0]);
                break;
            case DRIVE_UNKNOWN:
            case DRIVE_NO_ROOT_DIR:
@@ -100,17 +94,16 @@ void filesys_init( void )
     char volumename[MAX_DPATH]="";
     char volumepath[6];
     DWORD dwDriveMask;
-    char *result = NULL;
 
-    if( currprefs.win32_automount_drives || currprefs.win32_automount_netdrives )
+    if(currprefs.win32_automount_drives || currprefs.win32_automount_netdrives)
     {
        dwDriveMask = GetLogicalDrives();
        dwDriveMask >>= 2; // Skip A and B drives...
 
-       for( drive = 'C'; drive <= 'Z'; ++drive ) {
-           sprintf( volumepath, "%c:\\", drive );
+       for(drive = 'C'; drive <= 'Z'; ++drive) {
+           sprintf(volumepath, "%c:\\", drive);
            /* Is this drive-letter valid (it used to check for media in drive) */
-           if( dwDriveMask & 1 ) {
+           if(dwDriveMask & 1) {
                BOOL inserted = CheckRM(volumepath); /* Is there a disk inserted? */
                drivetype = GetDriveType(volumepath);
                if (!inserted)
@@ -121,17 +114,16 @@ void filesys_init( void )
                    continue;
                if ((drivetype == DRIVE_FIXED || drivetype == DRIVE_REMOVABLE) && !currprefs.win32_automount_drives)
                    continue;
-               get_volume_name( currprefs.mountinfo, volumepath, volumename, MAX_DPATH, inserted, drivetype, 1 );
+               get_volume_name(&mountinfo, volumepath, volumename, MAX_DPATH, inserted, drivetype, 1);
                if (drivetype == DRIVE_REMOTE)
-                   strcat( volumepath, "." );
+                   strcat(volumepath, ".");
                else
-                   strcat( volumepath, ".." );
-               result = add_filesys_unit (currprefs.mountinfo, 0, volumename, volumepath, 0, 0, 0, 0, 0, 0, 0, FILESYS_FLAG_DONOTSAVE);
-               if( result )
-                   write_log ("%s\n", result);
+                   strcat(volumepath, "..");
+               add_filesys_unit (0, volumename, volumepath,
+                   0, 0, 0, 0, 0, 0, 0, 0);
            } /* if drivemask */
            dwDriveMask >>= 1;
        }
     }
-    SetErrorMode( errormode );
+    SetErrorMode(errormode);
 }
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index be87b93..a0b9491
@@ -1292,7 +1292,10 @@ int check_prefs_changed_gfx (void)
     }
 
     if (currprefs.win32_automount_drives != changed_prefs.win32_automount_drives ||
+       currprefs.win32_outsidemouse != changed_prefs.win32_outsidemouse ||
        currprefs.win32_powersavedisabled != changed_prefs.win32_powersavedisabled) {
+
+       currprefs.win32_outsidemouse = changed_prefs.win32_outsidemouse;
        currprefs.win32_automount_drives = changed_prefs.win32_automount_drives;
        currprefs.win32_powersavedisabled = changed_prefs.win32_powersavedisabled;
     }
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 6bf7467..2175b0d
@@ -9,6 +9,8 @@
 
 #define FRONTEND 0
 
+#define _WIN32_WINNT 0x600
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <windows.h>
@@ -63,6 +65,7 @@
 #include "opengl.h"
 #include "direct3d.h"
 #include "akiko.h"
+#include "cdtv.h"
 #include "gfxfilter.h"
 #include "driveclick.h"
 #ifdef PROWIZARD
@@ -121,7 +124,7 @@ void WIN32GUI_LoadUIString( DWORD id, char *string, DWORD dwStringLen )
 static int C_PAGES;
 #define MAX_C_PAGES 30
 static int LOADSAVE_ID = -1, MEMORY_ID = -1, KICKSTART_ID = -1, CPU_ID = -1,
-    DISPLAY_ID = -1, HW3D_ID = -1, CHIPSET_ID = -1, SOUND_ID = -1, FLOPPY_ID = -1, DISK_ID = -1,
+    DISPLAY_ID = -1, HW3D_ID = -1, CHIPSET_ID = -1, CHIPSET2_ID = -1, SOUND_ID = -1, FLOPPY_ID = -1, DISK_ID = -1,
     HARDDISK_ID = -1, PORTS_ID = -1, INPUT_ID = -1, MISC1_ID = -1, MISC2_ID = -1, AVIOUTPUT_ID = -1,
     PATHS_ID = -1, QUICKSTART_ID = -1, ABOUT_ID = -1, FRONTEND_ID = -1;
 static HWND pages[MAX_C_PAGES];
@@ -370,6 +373,9 @@ static HWND cachedlist = NULL;
 #define MAX_Z3_MEM ((max_z3fastmem >> 20) < 512 ? 9 : ((max_z3fastmem >> 20) < 1024 ? 10 : ((max_z3fastmem >> 20) < 2048) ? 11 : 12))
 #define MIN_P96_MEM 0
 #define MAX_P96_MEM 7
+#define MIN_MB_MEM 0
+#define MAX_MB_MEM 7
+
 #define MIN_M68K_PRIORITY 1
 #define MAX_M68K_PRIORITY 16
 #define MIN_CACHE_SIZE 0
@@ -705,7 +711,10 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde
     strcpy (fname, filename);
     if (!zfile_exists (fname)) {
        fetch_configurationpath (fname, sizeof (fname));
-       strcat (fname, filename);
+       if (memcmp(fname, filename, strlen(fname)))
+           strcat (fname, filename);
+       else
+           strcpy (fname, filename);
     }
 
     if (isdefault)
@@ -716,9 +725,6 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde
     }
     if (type == 0 || type == 1) {
        discard_prefs (p, 0);
-#ifdef FILESYS
-       free_mountinfo (currprefs.mountinfo);
-#endif
     }
     type2 = type;
     if (type == 0)
@@ -777,6 +783,9 @@ void gui_display(int shortcut)
 #endif
 #ifdef CD32
     akiko_entergui ();
+#endif
+#ifdef CDTV
+    cdtv_entergui ();
 #endif
     inputdevice_unacquire ();
     clearallkeys ();
@@ -807,7 +816,7 @@ void gui_display(int shortcut)
        int ret;
        if (flipflop)
            ShowWindow (hAmigaWnd, SW_MINIMIZE);
-       ret = GetSettings (0, flipflop ? (currprefs.win32_notaskbarbutton ? hHiddenWnd : GetDesktopWindow()) : hAmigaWnd);
+       ret = GetSettings (0, flipflop ? (currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL) : hAmigaWnd);
        if (flipflop > 0)
            ShowWindow (hAmigaWnd, SW_RESTORE);
        if (!ret) {
@@ -834,6 +843,9 @@ void gui_display(int shortcut)
     inputdevice_acquire ();
 #ifdef CD32
     akiko_exitgui ();
+#endif
+#ifdef CDTV
+    cdtv_exitgui ();
 #endif
     if (flipflop >= 0)
        setmouseactive (1);
@@ -857,6 +869,10 @@ void gui_display(int shortcut)
 static void prefs_to_gui (struct uae_prefs *p)
 {
     workprefs = *p;
+    /* filesys hack */
+    workprefs.mountitems = currprefs.mountitems;
+    memcpy(&workprefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
+
     updatewinfsmode (&workprefs);
 #if 0
 #ifdef _DEBUG
@@ -870,6 +886,10 @@ static void gui_to_prefs (void)
 {
     /* Always copy our prefs to changed_prefs, ... */
     changed_prefs = workprefs;
+    /* filesys hack */
+    currprefs.mountitems = changed_prefs.mountitems;
+    memcpy(&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
+
     updatewinfsmode (&changed_prefs);
 }
 
@@ -1758,7 +1778,7 @@ static int clicked_entry = -1;
 
 #define LOADSAVE_COLUMNS 2
 #define INPUT_COLUMNS 4
-#define HARDDISK_COLUMNS 7
+#define HARDDISK_COLUMNS 8
 #define DISK_COLUMNS 3
 #define MAX_COLUMN_HEADING_WIDTH 20
 
@@ -1777,12 +1797,12 @@ void InitializeListView (HWND hDlg)
     LV_ITEM lvstruct;
     LV_COLUMN lvcolumn;
     RECT rect;
-    char column_heading[ HARDDISK_COLUMNS ][ MAX_COLUMN_HEADING_WIDTH ];
+    char column_heading[HARDDISK_COLUMNS][MAX_COLUMN_HEADING_WIDTH];
     char blocksize_str[6] = "";
     char readwrite_str[10] = "";
     char size_str[32] = "";
-    char volname_str[ MAX_DPATH ] = "";
-    char devname_str[ MAX_DPATH ] = "";
+    char volname_str[MAX_DPATH] = "";
+    char devname_str[MAX_DPATH] = "";
     char bootpri_str[6] = "";
     int width = 0;
     int items = 0, result = 0, i, j, entry = 0, temp = 0;
@@ -1791,13 +1811,14 @@ void InitializeListView (HWND hDlg)
     if (hDlg == pages[HARDDISK_ID]) {
        listview_num_columns = HARDDISK_COLUMNS;
        lv_type = LV_HARDDISK;
-       WIN32GUI_LoadUIString(IDS_DEVICE, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_VOLUME, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_PATH, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_RW, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_BLOCKSIZE, column_heading[4], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_HFDSIZE, column_heading[5], MAX_COLUMN_HEADING_WIDTH);
-       WIN32GUI_LoadUIString(IDS_BOOTPRI, column_heading[6], MAX_COLUMN_HEADING_WIDTH);
+       strcpy (column_heading[0], "*");
+       WIN32GUI_LoadUIString(IDS_DEVICE, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_VOLUME, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_PATH, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_RW, column_heading[4], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_BLOCKSIZE, column_heading[5], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_HFDSIZE, column_heading[6], MAX_COLUMN_HEADING_WIDTH);
+       WIN32GUI_LoadUIString(IDS_BOOTPRI, column_heading[7], MAX_COLUMN_HEADING_WIDTH);
        list = GetDlgItem(hDlg, IDC_VOLUMELIST);
     } else if (hDlg == pages[INPUT_ID]) {
        listview_num_columns = INPUT_COLUMNS;
@@ -1898,117 +1919,118 @@ void InitializeListView (HWND hDlg)
     else if (lv_type == LV_HARDDISK)
     {
 #ifdef FILESYS
-       for( i = 0; i < nr_units( currprefs.mountinfo ); i++ )
+       for(i = 0; i < workprefs.mountitems; i++)
        {
-           int secspertrack, surfaces, reserved, blocksize, bootpri;
-           uae_u64 size;
-           int cylinders, readonly, type;
-           char *volname, *devname, *rootdir;
-           char *failure;
-
-           failure = get_filesys_unit (currprefs.mountinfo, i,
-                                       &devname, &volname, &rootdir, &readonly,
-                                       &secspertrack, &surfaces, &reserved,
-                                       &cylinders, &size, &blocksize, &bootpri, 0, 0);
-           type = is_hardfile (currprefs.mountinfo, i);
-           
-           if (size >= 1024 * 1024 * 1024)
-               sprintf (size_str, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0);
+           struct uaedev_config_info *uci = &workprefs.mountconfig[i];
+           int nosize = 0, type;
+           struct mountedinfo mi;
+
+           type = get_filesys_unitconfig (&workprefs, i, &mi);
+           if (type < 0) {
+               type = uci->volname[0] ? FILESYS_VIRTUAL : FILESYS_HARDFILE;
+               nosize = 1;
+           }
+
+           if (nosize)
+               strcpy (size_str, "n/a");
+           else if (mi.size >= 1024 * 1024 * 1024)
+               sprintf (size_str, "%.1fG", ((double)(uae_u32)(mi.size / (1024 * 1024))) / 1024.0);
            else
-               sprintf (size_str, "%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0);
+               sprintf (size_str, "%.1fM", ((double)(uae_u32)(mi.size / (1024))) / 1024.0);
+
            if (type == FILESYS_HARDFILE) {
-               sprintf (blocksize_str, "%d", blocksize);
-               strcpy (devname_str, devname);
+               sprintf (blocksize_str, "%d", uci->blocksize);
+               strcpy (devname_str, uci->devname);
                strcpy (volname_str, "n/a");
-               sprintf (bootpri_str, "%d", bootpri);
+               sprintf (bootpri_str, "%d", uci->bootpri);
            } else if (type == FILESYS_HARDFILE_RDB || type == FILESYS_HARDDRIVE) {
-               sprintf (blocksize_str, "%d", blocksize);
+               sprintf (blocksize_str, "%d", uci->blocksize);
                strcpy (devname_str, "n/a");
                strcpy (volname_str, "n/a");
                strcpy (bootpri_str, "n/a");
            } else {
                strcpy (blocksize_str, "n/a");
-               strcpy (devname_str, devname);
-               strcpy (volname_str, volname);
+               strcpy (devname_str, uci->devname);
+               strcpy (volname_str, uci->volname);
                strcpy (size_str, "n/a");
-               sprintf (bootpri_str, "%d", bootpri);
+               sprintf (bootpri_str, "%d", uci->bootpri);
            }
-           if (readonly)
+           if (uci->readonly)
                WIN32GUI_LoadUIString (IDS_NO, readwrite_str, sizeof (readwrite_str));
            else
                WIN32GUI_LoadUIString (IDS_YES, readwrite_str, sizeof (readwrite_str));
 
            lvstruct.mask     = LVIF_TEXT | LVIF_PARAM;
-           lvstruct.pszText  = devname_str;
+           lvstruct.pszText  = mi.ismounted ? "*" : " ";
            lvstruct.lParam   = 0;
            lvstruct.iItem    = i;
            lvstruct.iSubItem = 0;
            result = ListView_InsertItem (list, &lvstruct);
            if (result != -1) {
-               width = ListView_GetStringWidth( list, devname_str) + 15;
-               if( width > listview_column_width[0] )
-                   listview_column_width[0] = width;
-
-               ListView_SetItemText( list, result, 1, volname_str );
-               width = ListView_GetStringWidth( list, volname_str ) + 15;
-               if( width > listview_column_width[ 1 ] )
-                   listview_column_width[ 1 ] = width;
-
-               listview_column_width [ 2 ] = 150;
-               ListView_SetItemText( list, result, 2, rootdir );
-               width = ListView_GetStringWidth( list, rootdir ) + 15;
-               if( width > listview_column_width[ 2 ] )
-                   listview_column_width[ 2 ] = width;
-
-               ListView_SetItemText( list, result, 3, readwrite_str );
-               width = ListView_GetStringWidth( list, readwrite_str ) + 15;
-               if( width > listview_column_width[ 3 ] )
-                   listview_column_width[ 3 ] = width;
-
-               ListView_SetItemText( list, result, 4, blocksize_str );
-               width = ListView_GetStringWidth( list, blocksize_str ) + 15;
-               if( width > listview_column_width[ 4 ] )
-                   listview_column_width[ 4 ] = width;
-
-               ListView_SetItemText( list, result, 5, size_str );
-               width = ListView_GetStringWidth( list, size_str ) + 15;
-               if( width > listview_column_width[ 5 ] )
-                   listview_column_width[ 5 ] = width;
-
-               ListView_SetItemText( list, result, 6, bootpri_str );
-               width = ListView_GetStringWidth( list, bootpri_str ) + 15;
-               if( width > listview_column_width[ 6 ] )
-                   listview_column_width[ 6 ] = width;
+
+               listview_column_width[0] = 15;
+
+               width = ListView_GetStringWidth(list, devname_str) + 10;
+               ListView_SetItemText(list, result, 1, devname_str);
+               if(width > listview_column_width[1])
+                   listview_column_width[1] = width;
+
+               ListView_SetItemText(list, result, 1, volname_str);
+               width = ListView_GetStringWidth(list, volname_str) + 10;
+               if(width > listview_column_width[2])
+                   listview_column_width[2] = width;
+
+               listview_column_width [3] = 150;
+               ListView_SetItemText(list, result, 3, uci->rootdir);
+               width = ListView_GetStringWidth(list, uci->rootdir) + 10;
+               if(width > listview_column_width[3])
+                   listview_column_width[3] = width;
+
+               ListView_SetItemText(list, result, 4, readwrite_str);
+               width = ListView_GetStringWidth(list, readwrite_str) + 10;
+               if(width > listview_column_width[4])
+                   listview_column_width[4] = width;
+
+               ListView_SetItemText(list, result, 5, blocksize_str);
+               width = ListView_GetStringWidth(list, blocksize_str) + 10;
+               if(width > listview_column_width[5])
+                   listview_column_width[5] = width;
+
+               ListView_SetItemText(list, result, 6, size_str);
+               width = ListView_GetStringWidth(list, size_str) + 10;
+               if(width > listview_column_width[6])
+                   listview_column_width[6] = width;
+
+               ListView_SetItemText(list, result, 7, bootpri_str);
+               width = ListView_GetStringWidth(list, bootpri_str) + 10;
+               if(width > listview_column_width[7] )
+                   listview_column_width[7] = width;
            }
        }
 #endif
     }
 
-    if( result != -1 )
-    {
-       if( GetWindowRect( list, &rect ) )
-       {
-           ScreenToClient( hDlg, (LPPOINT)&rect );
-           ScreenToClient( hDlg, (LPPOINT)&rect.right );
-           if( listview_num_columns == 2 )
-           {
-               if( ( temp = rect.right - rect.left - listview_column_width[ 0 ] - 4 ) > listview_column_width[1] )
+    if(result != -1) {
+       if(GetWindowRect(list, &rect)) {
+           ScreenToClient(hDlg, (LPPOINT)&rect);
+           ScreenToClient(hDlg, (LPPOINT)&rect.right);
+           if(listview_num_columns == 2) {
+               if((temp = rect.right - rect.left - listview_column_width[0] - 4) > listview_column_width[1])
                    listview_column_width[1] = temp;
            }
        }
 
        // Adjust our column widths so that we can see the contents...
-       for( i = 0; i < listview_num_columns; i++ )
-       {
-           ListView_SetColumnWidth( list, i, listview_column_width[i] );
+       for(i = 0; i < listview_num_columns; i++) {
+           ListView_SetColumnWidth(list, i, listview_column_width[i]);
        }
 
        // Turn on full-row-select option
-       ListView_SetExtendedListViewStyle( list, LVS_EX_FULLROWSELECT );
+       ListView_SetExtendedListViewStyle(list, LVS_EX_FULLROWSELECT);
 
        // Redraw the items in the list...
-       items = ListView_GetItemCount( list );
-       ListView_RedrawItems( list, 0, items );
+       items = ListView_GetItemCount(list);
+       ListView_RedrawItems(list, 0, items);
     }
 }
 
@@ -3388,51 +3410,15 @@ static void enable_for_chipsetdlg (HWND hDlg)
        CheckDlgButton (hDlg, IDC_FASTCOPPER, FALSE);
        CheckDlgButton (hDlg, IDC_BLITIMM, FALSE);
     }
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_EXT), workprefs.cs_compatible ? TRUE : FALSE);
 }
 
+static DWORD idnth[] = { IDS_SECOND, IDS_THIRD, IDS_FOURTH, IDS_FIFTH, IDS_SIXTH, IDS_SEVENTH, IDS_EIGHTH, IDS_NINTH, IDS_TENTH, -1 };
 static void LoadNthString( DWORD value, char *nth, DWORD dwNthMax )
 {
-    switch( value )
-    {
-       case 1:
-           WIN32GUI_LoadUIString(IDS_SECOND, nth, dwNthMax);
-       break;
-
-       case 2:
-           WIN32GUI_LoadUIString(IDS_THIRD, nth, dwNthMax);    
-       break;
-       
-       case 3:
-           WIN32GUI_LoadUIString(IDS_FOURTH, nth, dwNthMax);   
-       break;
-       
-       case 4:
-           WIN32GUI_LoadUIString(IDS_FIFTH, nth, dwNthMax);    
-       break;
-       
-       case 5:
-           WIN32GUI_LoadUIString(IDS_SIXTH, nth, dwNthMax);    
-       break;
-       
-       case 6:
-           WIN32GUI_LoadUIString(IDS_SEVENTH, nth, dwNthMax);  
-       break;
-       
-       case 7:
-           WIN32GUI_LoadUIString(IDS_EIGHTH, nth, dwNthMax);   
-       break;
-       
-       case 8:
-           WIN32GUI_LoadUIString(IDS_NINTH, nth, dwNthMax);    
-       break;
-       
-       case 9:
-           WIN32GUI_LoadUIString(IDS_TENTH, nth, dwNthMax);    
-       break;
-       
-       default:
-           strcpy(nth, "");
-    }
+    nth[0] = 0;
+    if (value >= 1 && value <= 9)
+       WIN32GUI_LoadUIString(idnth[value - 1], nth, dwNthMax);
 }
 
 static int fakerefreshrates[] = { 50, 60, 100, 120, 0 };
@@ -3611,11 +3597,9 @@ static void init_display_mode (HWND hDlg)
        break;
     }
 
-    if (workprefs.gfx_afullscreen)
-    {
+    if (workprefs.gfx_afullscreen) {
        d2 = d;
-       if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0)
-       {
+       if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0) {
            switch (d2)
            {
            case 15:
@@ -3636,9 +3620,7 @@ static void init_display_mode (HWND hDlg)
                break;
            }
        }
-    }
-    else
-    {
+    } else {
        d = d / 8;
     }
 
@@ -3687,20 +3669,18 @@ static void values_to_displaydlg (HWND hDlg)
     SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPOS, TRUE, v);
     WIN32GUI_LoadUIString( IDS_FRAMERATE, buffer, MAX_FRAMERATE_LENGTH );
     LoadNthString (v - 1, Nth, MAX_NTH_LENGTH);
-    if( FormatMessage( FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
-                      buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0 )
+    if(FormatMessage( FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+                      buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0)
     {
        DWORD dwLastError = GetLastError();
        sprintf (buffer, "Every %s Frame", nth[v - 1]);
-       SetDlgItemText( hDlg, IDC_RATETEXT, buffer );
-    }
-    else
-    {
-       SetDlgItemText( hDlg, IDC_RATETEXT, string );
-       LocalFree( string );
+       SetDlgItemText(hDlg, IDC_RATETEXT, buffer);
+    } else {
+       SetDlgItemText( hDlg, IDC_RATETEXT, string);
+       LocalFree(string);
     }
 
-    CheckRadioButton( hDlg, IDC_LM_NORMAL, IDC_LM_SCANLINES, IDC_LM_NORMAL + workprefs.gfx_linedbl );
+    CheckRadioButton (hDlg, IDC_LM_NORMAL, IDC_LM_SCANLINES, IDC_LM_NORMAL + workprefs.gfx_linedbl);
     CheckDlgButton (hDlg, IDC_AFULLSCREEN, workprefs.gfx_afullscreen);
     CheckDlgButton (hDlg, IDC_PFULLSCREEN, workprefs.gfx_pfullscreen);
     CheckDlgButton (hDlg, IDC_ASPECT, workprefs.gfx_correct_aspect);
@@ -3786,10 +3766,10 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        }
        sprintf (buffer, "%d", workprefs.chipset_refreshrate);
        SetDlgItemText (hDlg, IDC_RATE2TEXT, buffer);
-       workprefs.gfx_size_win.width  = GetDlgItemInt( hDlg, IDC_XSIZE, &success, FALSE );
+       workprefs.gfx_size_win.width  = GetDlgItemInt(hDlg, IDC_XSIZE, &success, FALSE);
        if(!success)
            workprefs.gfx_size_win.width = 800;
-       workprefs.gfx_size_win.height = GetDlgItemInt( hDlg, IDC_YSIZE, &success, FALSE );
+       workprefs.gfx_size_win.height = GetDlgItemInt(hDlg, IDC_YSIZE, &success, FALSE);
        if(!success)
            workprefs.gfx_size_win.height = 600;
     }
@@ -3916,32 +3896,26 @@ static INT_PTR CALLBACK DisplayDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
        if (recursive > 0)
            break;
        recursive++;
-       if( ( wParam == IDC_TEST16BIT ) && DirectDraw_Start(NULL) )
-       {
-           if( RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, KEY_WRITE | KEY_READ, &hPixelFormatKey ) == ERROR_SUCCESS )
-           {
-               char szMessage[ 4096 ];
+       if((wParam == IDC_TEST16BIT) && DirectDraw_Start(NULL)) {
+           if(RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, KEY_WRITE | KEY_READ, &hPixelFormatKey) == ERROR_SUCCESS) {
+               char szMessage[4096];
                char szTitle[ MAX_DPATH ];
-               WIN32GUI_LoadUIString( IDS_GFXCARDCHECK, szMessage, 4096 );
-               WIN32GUI_LoadUIString( IDS_GFXCARDTITLE, szTitle, MAX_DPATH );
+               WIN32GUI_LoadUIString(IDS_GFXCARDCHECK, szMessage, 4096);
+               WIN32GUI_LoadUIString(IDS_GFXCARDTITLE, szTitle, MAX_DPATH);
                    
-               if( MessageBox( NULL, szMessage, szTitle, 
-                               MB_YESNO | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND ) == IDYES )
-               {
+               if(MessageBox(NULL, szMessage, szTitle, MB_YESNO | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND) == IDYES) {
                    colortype = WIN32GFX_FigurePixelFormats(0);
-                   RegSetValueEx( hPixelFormatKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof( colortype ) );
+                   RegSetValueEx(hPixelFormatKey, "DisplayInfo", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
                }
-               RegCloseKey( hPixelFormatKey );
+               RegCloseKey(hPixelFormatKey);
            }
            DirectDraw_Release();
-       }
-       else
-       {
+       } else {
 #if 0
            handle_da (hDlg);
 #endif
            values_from_displaydlg (hDlg, msg, wParam, lParam);
-           enable_for_displaydlg( hDlg );
+           enable_for_displaydlg (hDlg);
        }
        recursive--;
        break;
@@ -3967,22 +3941,22 @@ static void values_to_chipsetdlg (HWND hDlg)
     switch(workprefs.chipset_mask)
     {
     case 0:
-       CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+0 );
+       CheckRadioButton(hDlg, IDC_OCS, IDC_AGA, IDC_OCS + 0);
        break;
     case CSMASK_ECS_AGNUS:
-       CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+1 );
+       CheckRadioButton(hDlg, IDC_OCS, IDC_AGA, IDC_OCS + 1);
        break;
 #if 0
     case CSMASK_ECS_DENISE:
-       CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+2 );
+       CheckRadioButton(hDlg, IDC_OCS, IDC_AGA, IDC_OCS + 2);
        break;
 #endif
     case CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE:
-       CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+3 );
+       CheckRadioButton(hDlg, IDC_OCS, IDC_AGA, IDC_OCS + 3);
        break;
     case CSMASK_AGA:
     case CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA:
-       CheckRadioButton( hDlg, IDC_OCS, IDC_AGA, IDC_OCS+4 );
+       CheckRadioButton(hDlg, IDC_OCS, IDC_AGA, IDC_OCS + 4);
        break;
     }
     CheckDlgButton (hDlg, IDC_NTSC, workprefs.ntscmode);
@@ -3996,7 +3970,23 @@ static void values_to_chipsetdlg (HWND hDlg)
      case 1: case 2: which_button = IDC_CS_SOUND1; break;
      default: which_button = IDC_CS_SOUND2; break;
     }
-    CheckRadioButton( hDlg, IDC_CS_SOUND0, IDC_CS_SOUND2, which_button );
+    CheckRadioButton (hDlg, IDC_CS_SOUND0, IDC_CS_SOUND2, which_button);
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"Generic");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"CDTV");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"CD32");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A500");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A500+");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A600");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A1000");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A1200");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A2000");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A3000");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A3000T");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A4000");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)"A4000T");
+    SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_SETCURSEL, workprefs.cs_compatible, 0);
 }
 
 static void values_from_chipsetdlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -4046,6 +4036,11 @@ static void values_from_chipsetdlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        else if (workprefs.produce_sound >= 2)
            workprefs.produce_sound = 2;
     }
+    n = SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_GETCURSEL, 0, 0); 
+    if (n != CB_ERR) {
+       workprefs.cs_compatible = n;
+       build_in_chipset_prefs (&workprefs);
+    }
 }
 
 static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -4080,6 +4075,206 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
     return FALSE;
 }
 
+static void values_to_chipsetdlg2 (HWND hDlg)
+{
+    char txt[32];
+    uae_u32 rev;
+
+    switch(workprefs.cs_ciaatod)
+    {
+       case 0:
+       CheckRadioButton(hDlg, IDC_CS_CIAA_TOD1, IDC_CS_CIAA_TOD3, IDC_CS_CIAA_TOD1);
+       break;
+       case 1:
+       CheckRadioButton(hDlg, IDC_CS_CIAA_TOD1, IDC_CS_CIAA_TOD3, IDC_CS_CIAA_TOD2);
+       break;
+       case 2:
+       CheckRadioButton(hDlg, IDC_CS_CIAA_TOD1, IDC_CS_CIAA_TOD3, IDC_CS_CIAA_TOD3);
+       break;
+    }
+    switch(workprefs.cs_rtc)
+    {
+       case 0:
+       CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC1);
+       break;
+       case 1:
+       CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC2);
+       break;
+       case 2:
+       CheckRadioButton(hDlg, IDC_CS_RTC1, IDC_CS_RTC3, IDC_CS_RTC3);
+       break;
+    }
+    CheckDlgButton (hDlg, IDC_CS_COMPATIBLE, workprefs.cs_compatible);
+    CheckDlgButton (hDlg, IDC_CS_KSMIRROR, workprefs.cs_ksmirror);
+    CheckDlgButton (hDlg, IDC_CS_DF0IDHW, workprefs.cs_df0idhw);
+    CheckDlgButton (hDlg, IDC_CS_CD32CD, workprefs.cs_cd32cd);
+    CheckDlgButton (hDlg, IDC_CS_CD32C2P, workprefs.cs_cd32c2p);
+    CheckDlgButton (hDlg, IDC_CS_CD32NVRAM, workprefs.cs_cd32nvram);
+    CheckDlgButton (hDlg, IDC_CS_CDTVCD, workprefs.cs_cdtvcd);
+    CheckDlgButton (hDlg, IDC_CS_CDTVRAM, workprefs.cs_cdtvram);
+    CheckDlgButton (hDlg, IDC_CS_CDTVRAMEXP, workprefs.cs_cdtvcard);
+    CheckDlgButton (hDlg, IDC_CS_A1000RAM, workprefs.cs_a1000ram);
+    CheckDlgButton (hDlg, IDC_CS_RAMSEY, workprefs.cs_ramseyrev >= 0);
+    CheckDlgButton (hDlg, IDC_CS_FATGARY, workprefs.cs_fatgaryrev >= 0);
+    CheckDlgButton (hDlg, IDC_CS_AGNUS, workprefs.cs_agnusrev >= 0);
+    CheckDlgButton (hDlg, IDC_CS_DENISE, workprefs.cs_deniserev >= 0);
+    CheckDlgButton (hDlg, IDC_CS_DMAC, workprefs.cs_mbdmac >= 0);
+    CheckDlgButton (hDlg, IDC_CS_IDE1, workprefs.cs_ide > 0 && (workprefs.cs_ide & 1));
+    CheckDlgButton (hDlg, IDC_CS_IDE2, workprefs.cs_ide > 0 && (workprefs.cs_ide & 2));
+    txt[0] = 0;
+    sprintf (txt, "%d", workprefs.cs_rtc_adjust);
+    SetDlgItemText(hDlg, IDC_CS_RTCADJUST, txt);
+    txt[0] = 0;
+    if (workprefs.cs_fatgaryrev >= 0)
+       sprintf (txt, "%02.2X", workprefs.cs_fatgaryrev);
+    SetDlgItemText(hDlg, IDC_CS_FATGARYREV, txt);
+    txt[0] = 0;
+    if (workprefs.cs_ramseyrev >= 0)
+       sprintf (txt, "%02.2X", workprefs.cs_ramseyrev);
+    SetDlgItemText(hDlg, IDC_CS_RAMSEYREV, txt);
+    txt[0] = 0;
+    if (workprefs.cs_agnusrev >= 0) {
+       rev = workprefs.cs_agnusrev;
+        sprintf (txt, "%02.2X", rev);
+    } else if (workprefs.cs_compatible) {
+       rev = 0;
+       if (workprefs.ntscmode)
+           rev |= 0x10;
+       rev |= (workprefs.chipset_mask & CSMASK_AGA) ? 0x23 : 0;
+       rev |= (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 0x20 : 0;
+       if (workprefs.chipmem_size > 1024 * 1024 && (workprefs.chipset_mask & CSMASK_ECS_AGNUS))
+           rev |= 0x21;
+       sprintf (txt, "%02.2X", rev);
+    }
+    SetDlgItemText(hDlg, IDC_CS_AGNUSREV, txt);
+    txt[0] = 0;
+    if (workprefs.cs_deniserev >= 0) {
+       rev = workprefs.cs_deniserev;
+        sprintf (txt, "%01.1X", rev);
+    } else if (workprefs.cs_compatible) {
+       rev = 0xf;
+       if (workprefs.chipset_mask & CSMASK_ECS_DENISE)
+           rev = 0xc;
+       if (workprefs.chipset_mask & CSMASK_AGA)
+           rev = 0x8;
+        sprintf (txt, "%01.1X", rev);
+    }
+    SetDlgItemText(hDlg, IDC_CS_DENISEREV, txt);
+}
+
+static void values_from_chipsetdlg2 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    char txt[32], *p;
+    int v;
+
+    workprefs.cs_compatible = IsDlgButtonChecked (hDlg, IDC_CS_COMPATIBLE);
+    workprefs.cs_ksmirror = IsDlgButtonChecked (hDlg, IDC_CS_KSMIRROR);
+    workprefs.cs_df0idhw = IsDlgButtonChecked (hDlg, IDC_CS_DF0IDHW);
+    workprefs.cs_cd32cd = IsDlgButtonChecked (hDlg, IDC_CS_CD32CD);
+    workprefs.cs_cd32c2p = IsDlgButtonChecked (hDlg, IDC_CS_CD32C2P);
+    workprefs.cs_cd32nvram = IsDlgButtonChecked (hDlg, IDC_CS_CD32NVRAM);
+    workprefs.cs_cdtvcd = IsDlgButtonChecked (hDlg, IDC_CS_CDTVCD);
+    workprefs.cs_cdtvram = IsDlgButtonChecked (hDlg, IDC_CS_CDTVRAM);
+    workprefs.cs_cdtvcard = IsDlgButtonChecked (hDlg, IDC_CS_CDTVRAMEXP) ? 512 : 0;
+    workprefs.cs_a1000ram = IsDlgButtonChecked (hDlg, IDC_CS_A1000RAM);
+    workprefs.cs_ramseyrev = IsDlgButtonChecked (hDlg, IDC_CS_RAMSEY) ? 0x0f : -1;
+    workprefs.cs_fatgaryrev = IsDlgButtonChecked (hDlg, IDC_CS_FATGARY) ? 0x00 : -1;
+    workprefs.cs_mbdmac = IsDlgButtonChecked (hDlg, IDC_CS_DMAC) ? 0x00 : -1;
+    workprefs.cs_ide = (IsDlgButtonChecked (hDlg, IDC_CS_IDE1) ? 1 : 0) | (IsDlgButtonChecked (hDlg, IDC_CS_IDE2) ? 2 : 0);
+    workprefs.cs_ciaatod = IsDlgButtonChecked (hDlg, IDC_CS_CIAA_TOD1) ? 0
+       : (IsDlgButtonChecked (hDlg, IDC_CS_CIAA_TOD2) ? 1 : 2);
+    workprefs.cs_rtc = IsDlgButtonChecked (hDlg, IDC_CS_RTC1) ? 0
+       : (IsDlgButtonChecked (hDlg, IDC_CS_RTC2) ? 1 : 2);
+
+    if (workprefs.cs_rtc) {
+       txt[0] = 0;
+       SendDlgItemMessage (hDlg, IDC_CS_RTCADJUST, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
+       workprefs.cs_rtc_adjust = atol(txt);
+    }
+    if (workprefs.cs_fatgaryrev >= 0) {
+       txt[0] = 0;
+       SendDlgItemMessage (hDlg, IDC_CS_FATGARYREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
+       v = strtol (txt, &p, 16);
+       if (v >= 0 && v <= 255)
+           workprefs.cs_fatgaryrev = v;
+    }
+    if (workprefs.cs_ramseyrev >= 0) {
+       txt[0] = 0;
+       SendDlgItemMessage (hDlg, IDC_CS_RAMSEYREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
+       v = strtol (txt, &p, 16);
+       if (v >= 0 && v <= 255)
+           workprefs.cs_ramseyrev = v;
+    }
+    if (workprefs.cs_agnusrev >= 0) {
+       txt[0] = 0;
+       SendDlgItemMessage (hDlg, IDC_CS_AGNUSREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
+       v = strtol (txt, &p, 16);
+       if (v >= 0 && v <= 255)
+           workprefs.cs_agnusrev = v;
+    }
+    if (workprefs.cs_deniserev >= 0) {
+       txt[0] = 0;
+       SendDlgItemMessage (hDlg, IDC_CS_DENISEREV, WM_GETTEXT, (WPARAM)sizeof(txt), (LPARAM)txt);
+       v = strtol (txt, &p, 16);
+       if (v >= 0 && v <= 15)
+           workprefs.cs_deniserev = v;
+    }
+
+}
+
+static void enable_for_chipsetdlg2 (HWND hDlg)
+{
+    int e = workprefs.cs_compatible ? FALSE : TRUE;
+
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_FATGARY), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_RAMSEY), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_AGNUS), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_DENISE), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_FATGARYREV), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_RAMSEYREV), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_AGNUSREV), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_DENISEREV), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_IDE1), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_IDE2), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_DMAC), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CD32CD), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CD32NVRAM), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CD32C2P), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CDTVCD), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CDTVRAM), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_CDTVRAMEXP), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_KSMIRROR), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_A1000RAM), e);
+    EnableWindow (GetDlgItem (hDlg, IDC_CS_DF0IDHW), e);
+}
+
+static INT_PTR CALLBACK ChipsetDlgProc2 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    static int recursive = 0;
+
+    switch (msg) {
+    case WM_INITDIALOG:
+       pages[CHIPSET2_ID] = hDlg;
+       currentpage = CHIPSET2_ID;
+    case WM_USER:
+       recursive++;
+       values_to_chipsetdlg2 (hDlg);
+       enable_for_chipsetdlg2 (hDlg);
+       recursive--;
+       break;
+    case WM_HSCROLL:
+    case WM_COMMAND:
+       if (recursive > 0)
+           break;
+       recursive++;
+       values_from_chipsetdlg2 (hDlg, msg, wParam, lParam);
+       enable_for_chipsetdlg2 (hDlg);
+       recursive--;
+       break;
+    }
+    return FALSE;
+}
+
 static void enable_for_memorydlg (HWND hDlg)
 {
     int z3 = ! workprefs.address_space_24;
@@ -4098,6 +4293,10 @@ static void enable_for_memorydlg (HWND hDlg)
     EnableWindow (GetDlgItem (hDlg, IDC_GFXCARDTEXT), z3);
     EnableWindow (GetDlgItem (hDlg, IDC_P96RAM), z3);
     EnableWindow (GetDlgItem (hDlg, IDC_P96MEM), z3);
+    EnableWindow (GetDlgItem (hDlg, IDC_MBRAM1), z3);
+    EnableWindow (GetDlgItem (hDlg, IDC_MBMEM1), z3);
+    EnableWindow (GetDlgItem (hDlg, IDC_MBRAM2), z3);
+    EnableWindow (GetDlgItem (hDlg, IDC_MBMEM2), z3);
 }
 
 static void values_to_memorydlg (HWND hDlg)
@@ -4172,14 +4371,40 @@ static void values_to_memorydlg (HWND hDlg)
     }
     SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETPOS, TRUE, mem_size);
     SetDlgItemText (hDlg, IDC_P96RAM, memsize_names[msi_gfx[mem_size]]);
+
+    mem_size = 0;
+    switch (workprefs.mbresmem_low_size) {
+     case 0x00000000: mem_size = 0; break;
+     case 0x00100000: mem_size = 1; break;
+     case 0x00200000: mem_size = 2; break;
+     case 0x00400000: mem_size = 3; break;
+     case 0x00800000: mem_size = 4; break;
+     case 0x01000000: mem_size = 5; break;
+     case 0x02000000: mem_size = 6; break;
+     case 0x04000000: mem_size = 7; break;
+    }
+    SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETPOS, TRUE, mem_size);
+    SetDlgItemText (hDlg, IDC_MBRAM1, memsize_names[msi_gfx[mem_size]]);
+
+    mem_size = 0;
+    switch (workprefs.mbresmem_high_size) {
+     case 0x00000000: mem_size = 0; break;
+     case 0x00100000: mem_size = 1; break;
+     case 0x00200000: mem_size = 2; break;
+     case 0x00400000: mem_size = 3; break;
+     case 0x00800000: mem_size = 4; break;
+     case 0x01000000: mem_size = 5; break;
+     case 0x02000000: mem_size = 6; break;
+     case 0x04000000: mem_size = 7; break;
+    }
+    SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETPOS, TRUE, mem_size);
+    SetDlgItemText (hDlg, IDC_MBRAM2, memsize_names[msi_gfx[mem_size]]);
 }
 
 static void fix_values_memorydlg (void)
 {
     if (workprefs.chipmem_size > 0x200000)
        workprefs.fastmem_size = 0;
-    if (workprefs.chipmem_size > 0x80000)
-       workprefs.chipset_mask |= CSMASK_ECS_AGNUS;
 }
 
 static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -4197,6 +4422,8 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
        SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM));
        SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_MEM));
        SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM));
+       SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
+       SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
 
     case WM_USER:
        recursive++;
@@ -4212,6 +4439,8 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
        workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]];
        workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]];
        workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]];
+       workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]];
+       workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]];
        fix_values_memorydlg ();
        values_to_memorydlg (hDlg);
        enable_for_memorydlg (hDlg);
@@ -4432,8 +4661,7 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
 
 static void enable_for_miscdlg (HWND hDlg)
 {
-    if(!full_property_sheet)
-    {
+    if (!full_property_sheet) {
        EnableWindow (GetDlgItem (hDlg, IDC_JULIAN), TRUE);
        EnableWindow (GetDlgItem (hDlg, IDC_CTRLF11), TRUE);
        EnableWindow (GetDlgItem (hDlg, IDC_SOCKETS), FALSE);
@@ -4606,6 +4834,7 @@ static void values_to_miscdlg (HWND hDlg)
            workprefs.catweasel = 0;
        CheckDlgButton (hDlg, IDC_CATWEASEL, workprefs.catweasel);
        CheckDlgButton (hDlg, IDC_STATE_CAPTURE, workprefs.statecapture);
+       CheckDlgButton (hDlg, IDC_MOUSETRICK, workprefs.win32_outsidemouse);
 
        misc_kbled (hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]);
        misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]);
@@ -4777,6 +5006,9 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
        case IDC_CATWEASEL:
            workprefs.catweasel = IsDlgButtonChecked (hDlg, IDC_CATWEASEL) ? -1 : 0;
            break;
+       case IDC_MOUSETRICK:
+           workprefs.win32_outsidemouse = IsDlgButtonChecked (hDlg, IDC_MOUSETRICK) ? -1 : 0;
+           break;
        case IDC_NOTASKBARBUTTON:
            workprefs.win32_notaskbarbutton = IsDlgButtonChecked (hDlg, IDC_NOTASKBARBUTTON);
            break;
@@ -4901,25 +5133,24 @@ static void values_to_cpudlg (HWND hDlg)
     CheckRadioButton (hDlg, IDC_CPU0, IDC_CPU6, cpu_ids[workprefs.cpu_level * 2 + !workprefs.address_space_24]);
 
     if (workprefs.m68k_speed == -1)
-       CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_HOST );
+       CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_HOST);
     else if (workprefs.m68k_speed == 0)
-       CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_68000 );
+       CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_68000);
     else
-       CheckRadioButton( hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_ADJUSTABLE );
+       CheckRadioButton(hDlg, IDC_CS_HOST, IDC_CS_ADJUSTABLE, IDC_CS_ADJUSTABLE);
 
-    cpu_based_enable = ( workprefs.cpu_level >= 2 ) &&
-                      ( workprefs.address_space_24 == 0 );
+    cpu_based_enable = (workprefs.cpu_level >= 2) && (workprefs.address_space_24 == 0);
 
-    enable = cpu_based_enable && ( workprefs.cachesize );
+    enable = cpu_based_enable && workprefs.cachesize;
 
 #ifdef JIT
-    if( enable ) {
-       if( !canbang ) {
+    if(enable) {
+       if(!canbang) {
            workprefs.compforcesettings = TRUE;
            workprefs.comptrustbyte = 1;
            workprefs.comptrustword = 1;
            workprefs.comptrustlong = 1;
-           workprefs.comptrustnaddr= 1;
+           workprefs.comptrustnaddr = 1;
        }
     } else {
 #endif
@@ -4928,25 +5159,25 @@ static void values_to_cpudlg (HWND hDlg)
     }
 #endif
 
-    if( !workprefs.compforcesettings ) {
+    if(!workprefs.compforcesettings) {
        workprefs.comptrustbyte = 0;
        workprefs.comptrustword = 0;
        workprefs.comptrustlong = 0;
        workprefs.comptrustnaddr= 0;
     }
 
-    CheckRadioButton( hDlg, IDC_TRUST0, IDC_TRUST2, trust_ids[ workprefs.comptrustbyte ] );
+    CheckRadioButton(hDlg, IDC_TRUST0, IDC_TRUST2, trust_ids[ workprefs.comptrustbyte]);
 
-    SendDlgItemMessage( hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024 );
-    sprintf( cache, "%d MB", workprefs.cachesize / 1024 );
+    SendDlgItemMessage(hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024);
+    sprintf(cache, "%d MB", workprefs.cachesize / 1024 );
     SetDlgItemText( hDlg, IDC_CACHETEXT, cache );
 
-    CheckDlgButton( hDlg, IDC_FORCE, workprefs.compforcesettings );
-    CheckDlgButton( hDlg, IDC_NOFLAGS, workprefs.compnf );
-    CheckDlgButton( hDlg, IDC_JITFPU, workprefs.compfpu );
-    CheckDlgButton( hDlg, IDC_HARDFLUSH, workprefs.comp_hardflush );
-    CheckDlgButton( hDlg, IDC_CONSTJUMP, workprefs.comp_constjump );
-    CheckDlgButton( hDlg, IDC_JITENABLE, workprefs.cachesize > 0);
+    CheckDlgButton(hDlg, IDC_FORCE, workprefs.compforcesettings);
+    CheckDlgButton(hDlg, IDC_NOFLAGS, workprefs.compnf);
+    CheckDlgButton(hDlg, IDC_JITFPU, workprefs.compfpu);
+    CheckDlgButton(hDlg, IDC_HARDFLUSH, workprefs.comp_hardflush);
+    CheckDlgButton(hDlg, IDC_CONSTJUMP, workprefs.comp_constjump);
+    CheckDlgButton(hDlg, IDC_JITENABLE, workprefs.cachesize > 0);
 }
 
 static void values_from_cpudlg (HWND hDlg)
@@ -5264,10 +5495,8 @@ static void values_to_sounddlg (HWND hDlg)
     SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)txt);
     SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Anti");
     SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Sinc");
-    WIN32GUI_LoadUIString (IDS_SOUND_INTERPOL_RH, txt, sizeof (txt));
-    SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)txt);
-    WIN32GUI_LoadUIString (IDS_SOUND_INTERPOL_CRUX, txt, sizeof (txt));
-    SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)txt);
+    SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"RH");
+    SendDlgItemMessage(hDlg, IDC_SOUNDINTERPOLATION, CB_ADDSTRING, 0, (LPARAM)"Crux");
     SendDlgItemMessage (hDlg, IDC_SOUNDINTERPOLATION, CB_SETCURSEL, workprefs.sound_interpol, 0);
 
     SendDlgItemMessage(hDlg, IDC_SOUNDFREQ, CB_RESETCONTENT, 0, 0);
@@ -5576,25 +5805,25 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam,
                }
                break;
             case IDOK:
-                   if( strlen( current_fsvdlg.rootdir ) == 0 
+                   if(strlen(current_fsvdlg.rootdir) == 0
                    {
-                       char szMessage[ MAX_DPATH ];
-                       char szTitle[ MAX_DPATH ];
-                       WIN32GUI_LoadUIString( IDS_MUSTSELECTPATH, szMessage, MAX_DPATH );
-                       WIN32GUI_LoadUIString( IDS_SETTINGSERROR, szTitle, MAX_DPATH );
+                       char szMessage[MAX_DPATH];
+                       char szTitle[MAX_DPATH];
+                       WIN32GUI_LoadUIString(IDS_MUSTSELECTPATH, szMessage, MAX_DPATH);
+                       WIN32GUI_LoadUIString(IDS_SETTINGSERROR, szTitle, MAX_DPATH);
 
-                       MessageBox( hDlg, szMessage, szTitle,
+                       MessageBox(hDlg, szMessage, szTitle,
                                MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
                        break;
                    }
-                   if( strlen( current_fsvdlg.volume ) == 0 )
+                   if(strlen(current_fsvdlg.volume) == 0)
                    {
-                       char szMessage[ MAX_DPATH ];
-                       char szTitle[ MAX_DPATH ];
-                       WIN32GUI_LoadUIString( IDS_MUSTSELECTNAME, szMessage, MAX_DPATH );
-                       WIN32GUI_LoadUIString( IDS_SETTINGSERROR, szTitle, MAX_DPATH );
+                       char szMessage[MAX_DPATH];
+                       char szTitle[MAX_DPATH];
+                       WIN32GUI_LoadUIString(IDS_MUSTSELECTNAME, szMessage, MAX_DPATH);
+                       WIN32GUI_LoadUIString(IDS_SETTINGSERROR, szTitle, MAX_DPATH);
 
-                       MessageBox( hDlg, szMessage, szTitle,
+                       MessageBox(hDlg, szMessage, szTitle,
                                MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
                        break;
                    }
@@ -5622,11 +5851,11 @@ static void sethardfile (HWND hDlg)
     SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename);
     SetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename);
     SetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename);
-    SetDlgItemInthDlg, IDC_SECTORS, current_hfdlg.sectors, FALSE);
-    SetDlgItemInthDlg, IDC_HEADS, current_hfdlg.surfaces, FALSE);
-    SetDlgItemInthDlg, IDC_RESERVED, current_hfdlg.reserved, FALSE);
-    SetDlgItemInthDlg, IDC_BLOCKSIZE, current_hfdlg.blocksize, FALSE);
-    SetDlgItemInthDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.bootpri, TRUE);
+    SetDlgItemInt (hDlg, IDC_SECTORS, current_hfdlg.sectors, FALSE);
+    SetDlgItemInt (hDlg, IDC_HEADS, current_hfdlg.surfaces, FALSE);
+    SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.reserved, FALSE);
+    SetDlgItemInt (hDlg, IDC_BLOCKSIZE, current_hfdlg.blocksize, FALSE);
+    SetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, current_hfdlg.bootpri, TRUE);
     CheckDlgButton (hDlg, IDC_RW, current_hfdlg.rw);
     EnableWindow (GetDlgItem (hDlg, IDC_HDF_RDB),
        !(current_hfdlg.sectors == 0 && current_hfdlg.surfaces == 0 && current_hfdlg.reserved == 0));
@@ -5839,39 +6068,31 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
 
 static void new_filesys (HWND hDlg)
 {
-    const char *result;
+    int result;
 
-    result = add_filesys_unit (currprefs.mountinfo, current_fsvdlg.device, current_fsvdlg.volume,
+    result = add_filesys_config (&workprefs, -1, current_fsvdlg.device, current_fsvdlg.volume,
                    current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0);
-    if (result)
-       MessageBox (hDlg, result, result,
-                   MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+
 }
 
 static void new_hardfile (HWND hDlg)
 {
-    const char *result;
+    int result;
 
-    result = add_filesys_unit (currprefs.mountinfo, current_hfdlg.devicename, 0,
+    result = add_filesys_config (&workprefs, -1, current_hfdlg.devicename, 0,
                                current_hfdlg.filename, ! current_hfdlg.rw,
                                current_hfdlg.sectors, current_hfdlg.surfaces,
                                current_hfdlg.reserved, current_hfdlg.blocksize,
                                current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
-    if (result)
-       MessageBox (hDlg, result, result,
-                   MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
 }
 
 static void new_harddrive (HWND hDlg)
 {
-    const char *result;
+    int result;
 
-    result = add_filesys_unit (currprefs.mountinfo, 0, 0,
+    result = add_filesys_config (&workprefs, -1, 0, 0,
                                current_hfdlg.filename, ! current_hfdlg.rw, 0, 0,
                                0, current_hfdlg.blocksize, 0, 0, 0);
-    if (result)
-       MessageBox (hDlg, result, result,
-                   MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
 }
 
 static void harddisk_remove (HWND hDlg)
@@ -5879,7 +6100,7 @@ static void harddisk_remove (HWND hDlg)
     int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
     if (entry < 0)
        return;
-    kill_filesys_unit (currprefs.mountinfo, entry);
+    kill_filesys_unitconfig (&workprefs, entry);
 }
 
 static void harddisk_move (HWND hDlg, int up)
@@ -5887,94 +6108,79 @@ static void harddisk_move (HWND hDlg, int up)
     int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
     if (entry < 0)
        return;
-    move_filesys_unit (currprefs.mountinfo, entry, up ? entry - 1 : entry + 1);
+    move_filesys_unitconfig (&workprefs, entry, up ? entry - 1 : entry + 1);
 }
 
 static void harddisk_edit (HWND hDlg)
 {
     int entry = listview_find_selected (GetDlgItem (hDlg, IDC_VOLUMELIST));
-    char *volname, *devname, *rootdir, *filesys;
-    int secspertrack, surfaces, cylinders, reserved, blocksize, readonly, type, bootpri;
-    uae_u64 size;
-    const char *failure;
+    int type;
+    struct uaedev_config_info *uci;
+    struct mountedinfo mi;
 
-    if (entry < 0)
+    if (entry < 0 || entry >= workprefs.mountitems)
        return;
-    
-    failure = get_filesys_unit (currprefs.mountinfo, entry, &devname, &volname, &rootdir, &readonly,
-                           &secspertrack, &surfaces, &reserved, &cylinders, &size,
-                           &blocksize, &bootpri, &filesys, 0);
+    uci = &workprefs.mountconfig[entry];
+
+    type = get_filesys_unitconfig (&workprefs, entry, &mi);
 
-    type = is_hardfile( currprefs.mountinfo, entry );
-    if( type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB )
+    if(type == FILESYS_HARDFILE || type == FILESYS_HARDFILE_RDB)
     {
-       current_hfdlg.sectors = secspertrack;
-       current_hfdlg.surfaces = surfaces;
-       current_hfdlg.reserved = reserved;
-       current_hfdlg.cylinders = cylinders;
-       current_hfdlg.blocksize = blocksize;
+       current_hfdlg.sectors = uci->sectors;
+       current_hfdlg.surfaces = uci->surfaces;
+       current_hfdlg.reserved = uci->reserved;
+       current_hfdlg.cylinders = mi.nrcyls;
+       current_hfdlg.blocksize = uci->blocksize;
 
-       strncpy (current_hfdlg.filename, rootdir, (sizeof current_hfdlg.filename) - 1);
+       strncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) - 1);
        current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
        current_hfdlg.fsfilename[0] = 0;
-       if (filesys) {
-           strncpy (current_hfdlg.fsfilename, filesys, (sizeof current_hfdlg.fsfilename) - 1);
+       if (uci->filesys) {
+           strncpy (current_hfdlg.fsfilename, uci->filesys, (sizeof current_hfdlg.fsfilename) - 1);
            current_hfdlg.fsfilename[(sizeof current_hfdlg.fsfilename) - 1] = '\0';
        }
        current_fsvdlg.device[0] = 0;
-       if (devname) {
-           strncpy (current_hfdlg.devicename, devname, (sizeof current_hfdlg.devicename) - 1);
+       if (uci->devname) {
+           strncpy (current_hfdlg.devicename, uci->devname, (sizeof current_hfdlg.devicename) - 1);
            current_hfdlg.devicename[(sizeof current_hfdlg.devicename) - 1] = '\0';
        }
-       current_hfdlg.rw = !readonly;
-       current_hfdlg.bootpri = bootpri;
+       current_hfdlg.rw = !uci->readonly;
+       current_hfdlg.bootpri = uci->bootpri;
        if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDFILE), hDlg, HardfileSettingsProc)) 
        {
-           const char *result;
-           result = set_filesys_unit (currprefs.mountinfo, entry, current_hfdlg.devicename, 0, current_hfdlg.filename,
+           int result = add_filesys_config (&workprefs, entry, current_hfdlg.devicename, 0, current_hfdlg.filename,
                                        ! current_hfdlg.rw, current_hfdlg.sectors, current_hfdlg.surfaces,
                                        current_hfdlg.reserved, current_hfdlg.blocksize, current_hfdlg.bootpri, current_hfdlg.fsfilename, 0);
-           if (result)
-               MessageBox (hDlg, result, result,
-               MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
        }
     }
     else if (type == FILESYS_HARDDRIVE) /* harddisk */
     {
-       current_hfdlg.rw = !readonly;
-       strncpy (current_hfdlg.filename, rootdir, (sizeof current_hfdlg.filename) - 1);
+       current_hfdlg.rw = !uci->readonly;
+       strncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) - 1);
        current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
-       if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDDRIVE), hDlg, HarddriveSettingsProc)) 
+       if (DialogBox(hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_HARDDRIVE), hDlg, HarddriveSettingsProc)) 
        {
-           const char *result;
-           result = set_filesys_unit (currprefs.mountinfo, entry, 0, 0, current_hfdlg.filename,
+           int result = add_filesys_config (&workprefs, entry, 0, 0, current_hfdlg.filename,
                                        ! current_hfdlg.rw, 0, 0,
                                        0, current_hfdlg.blocksize, current_hfdlg.bootpri, 0, 0);
-           if (result)
-               MessageBox (hDlg, result, result,
-               MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
        }
     }
     else /* Filesystem */
     {
-       strncpy (current_fsvdlg.rootdir, rootdir, (sizeof current_fsvdlg.rootdir) - 1);
+       strncpy (current_fsvdlg.rootdir, uci->rootdir, (sizeof current_fsvdlg.rootdir) - 1);
        current_fsvdlg.rootdir[(sizeof current_fsvdlg.rootdir) - 1] = '\0';
-       strncpy (current_fsvdlg.volume, volname, (sizeof current_fsvdlg.volume) - 1);
+       strncpy (current_fsvdlg.volume, uci->volname, (sizeof current_fsvdlg.volume) - 1);
        current_fsvdlg.volume[(sizeof current_fsvdlg.volume) - 1] = '\0';
        current_fsvdlg.device[0] = 0;
-       if (devname) {
-           strncpy (current_fsvdlg.device, devname, (sizeof current_fsvdlg.device) - 1);
+       if (uci->devname) {
+           strncpy (current_fsvdlg.device, uci->devname, (sizeof current_fsvdlg.device) - 1);
            current_fsvdlg.device[(sizeof current_fsvdlg.device) - 1] = '\0';
        }
-       current_fsvdlg.rw = !readonly;
-       current_fsvdlg.bootpri = bootpri;
+       current_fsvdlg.rw = !uci->readonly;
+       current_fsvdlg.bootpri = uci->bootpri;
        if (DialogBox( hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_FILESYS), hDlg, VolumeSettingsProc)) {
-           const char *result;
-           result = set_filesys_unit (currprefs.mountinfo, entry, current_fsvdlg.device, current_fsvdlg.volume,
+           int result = add_filesys_config (&workprefs, entry, current_fsvdlg.device, current_fsvdlg.volume,
                                        current_fsvdlg.rootdir, ! current_fsvdlg.rw, 0, 0, 0, 0, current_fsvdlg.bootpri, 0, 0);
-           if (result)
-               MessageBox (hDlg, result, result,
-               MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
        }
     }
 }
@@ -6117,7 +6323,7 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA
     {
        int *draggeditems, item;
        if ((item = drag_end (hDlg, cachedlist, lParam, &draggeditems)) >= 0) {
-           move_filesys_unit (currprefs.mountinfo, draggeditems[0], item);
+           move_filesys_unitconfig (&workprefs, draggeditems[0], item);
            InitializeListView (hDlg);
            clicked_entry = item;
            hilitehd ();
@@ -8753,6 +8959,7 @@ static void createTreeView (HWND hDlg, int currentpage)
     p = CreateFolderNode (TVhDlg, IDS_TREEVIEW_HARDWARE, root, LOADSAVE_ID, CONFIG_TYPE_HARDWARE);
     CN(CPU_ID);
     CN(CHIPSET_ID);
+    CN(CHIPSET2_ID);
     CN(KICKSTART_ID);
     CN(MEMORY_ID);
     CN(FLOPPY_ID);
@@ -8916,13 +9123,12 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
                break;
                case ZFILE_HDF:
                {
-                   char *result;
                    if (currentpage == HARDDISK_ID) {
                        if (flags & FILE_ATTRIBUTE_DIRECTORY) {
-                           result = add_filesys_unit (currprefs.mountinfo, NULL, "XXX", file, 0,
+                           add_filesys_config (&workprefs, -1, NULL, "XXX", file, 0,
                                0, 0, 0, 0, 0, NULL, 0);
                        } else {
-                           result = add_filesys_unit (currprefs.mountinfo, NULL, NULL, file, 0,
+                           add_filesys_config (&workprefs, -1, NULL, NULL, file, 0,
                                32, 1, 2, 512, 0, NULL, 0);
                        }
                    }
@@ -8999,10 +9205,14 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
                return FALSE;
                case TVN_SELCHANGED:
                {
+                   int cp;
                    LPNMTREEVIEW tv = (LPNMTREEVIEW)lParam;
-                   currentpage = (int)(tv->itemNew.lParam & 0xffff);
-                   configtypepanel = configtype = (int)(tv->itemNew.lParam >> 16);
-                   updatePanel (hDlg, currentpage);
+                   cp = (int)(tv->itemNew.lParam & 0xffff);
+                   if (cp != currentpage) {
+                       currentpage = cp;
+                       configtypepanel = configtype = (int)(tv->itemNew.lParam >> 16);
+                       updatePanel (hDlg, currentpage);
+                   }
                    return TRUE;
                }
                break;
@@ -9104,6 +9314,7 @@ static int GetSettings (int all_options, HWND hwnd)
        HW3D_ID = init_page (IDD_FILTER, IDI_DISPLAY, IDS_FILTER, hw3dDlgProc, NULL, "gui/filter.htm");
 #endif
        CHIPSET_ID = init_page (IDD_CHIPSET, IDI_CPU, IDS_CHIPSET, ChipsetDlgProc, NULL, "gui/chipset.htm");
+       CHIPSET2_ID = init_page (IDD_CHIPSET2, IDI_CPU, IDS_CHIPSET2, ChipsetDlgProc2, NULL, "gui/chipset.htm");
        SOUND_ID = init_page (IDD_SOUND, IDI_SOUND, IDS_SOUND, SoundDlgProc, NULL, "gui/sound.htm");
        FLOPPY_ID = init_page (IDD_FLOPPY, IDI_FLOPPY, IDS_FLOPPY, FloppyDlgProc, NULL, "gui/floppies.htm");
        DISK_ID = init_page (IDD_DISK, IDI_FLOPPY, IDS_DISK, SwapperDlgProc, SwapperAccel, "gui/disk.htm");
@@ -9153,6 +9364,8 @@ static int GetSettings (int all_options, HWND hwnd)
            if (IPChandle != INVALID_HANDLE_VALUE) {
                MsgWaitForMultipleObjects (1, &IPChandle, FALSE, INFINITE, QS_ALLINPUT);
                while (checkIPC(&workprefs));
+           } else {
+               WaitMessage();
            }
            while ((v = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))) {
                if (dialogreturn >= 0)
@@ -9193,7 +9406,7 @@ int gui_init (void)
     
     read_rom_list();
     for (;;) {
-       ret = GetSettings(1, currprefs.win32_notaskbarbutton ? hHiddenWnd : GetDesktopWindow());
+       ret = GetSettings(1, currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL);
        if (!restart_requested)
            break;
        restart_requested = 0;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 5949147..ba349d2
@@ -83,7 +83,7 @@
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalOptions="/MACHINE:I386"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
                                ShowProgress="0"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib winio.lib setupapi.lib wininet.lib dxerr8.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                        RelativePath="..\resources\resource.h"
                        >
                </File>
+               <File
+                       RelativePath="..\resources\resource.hm"
+                       >
+               </File>
        </Files>
        <Globals>
        </Globals>
old mode 100755 (executable)
new mode 100644 (file)
index a922cdd..6bfa4c9
@@ -1,4 +1,119 @@
 
+Beta 1: Lots of scary options. Do not touch!
+
+- added new misc configuration options "(handled in previous versions)"
+  - RTC type (none, MSM6242B or RF5C01A) + adjustment in seconds
+    (always enabled, MSM6242B but no 26x4bit memory implemented
+    and was initialized as RF5C01A... Looks like previous developer(s)
+    didn't know there was two different clock chips, neither did I
+    until few days ago.. Basically 68020+ Amigas have RF5C01A)
+  - CIA-A TOD clock source, vblank/50hz/60hz (always vblank except
+    50Hz/60Hz in programmed modes, another hack was here)
+  - built-in IDE A600+A1200 or A4000. Not really doing much yet.
+    (something that prevented IDE detection delay)
+  - A1000 Boot "ROM" on/off (enabled when 8k/64k ROM was used)
+  - DF0: ID hardware on/off (no ID if DF0: was 35DD)
+  - A3000/A4000 "motherboard resources", RAMSEY and/or Fat GARY
+    (0xDE000x, 0 = TOENB, 1 = TIMEOUT and 2 = COLDREBOOT registers)
+  - KS ROM mirror at 0xe00000-0xe7ffff (Cloanto ROM selected)
+  - CD32 CDROM on/off (when 512k extended ROM was selected)
+  - CD32 C2P on/off (when 512k extended ROM was selected)
+  - CD32 NVRAM on/off (when 512k extended ROM was selected)
+  - CDTV CDROM on/off (did not exist)
+  - CDTV NVRAM on/off (when 256k extended ROM was selected)
+  - CDTV SRAM (64k only, not saved) Card on/off (not implemented)
+
+  Why? Because there are small differences between different Amiga
+  models and even revisions and every possible model must be
+  configurable for emulation.. (like more real A4000 configuration)
+  Also can remove some ugly hacks (like the IDE hack) with proper
+  emulation.
+  
+  I REPEAT: Do not touch Adv.Chipset panel if you aren't sure about
+  what you are doing! :)
+
+  NOTE: A4000 KS ROMs (Cloanto 3.x ROMs = A4000 ROM) _REQUIRE_ RAMSEY
+  or they will freeze at boot. WinUAE will automatically enable RAMSEY
+  and GARY if recognised A4000 ROM is selected, also default "Generic"
+  Amiga setting is most compatible with old configurations.
+
+  NOTE2: CD32 and CDTV configurations require now CD32 or CDTV setting
+  in chipset-panel (Quickstart mode does this automatically). Previously
+  CD32/CDTV mode was enabled depending on size of extended ROM but that
+  is not a good idea anymore.
+
+- Amiga model specific chipset extra settings added, available only if
+  "compatible settings" is enabled in "Adv. Chipset" panel
+- Akiko moved to separate memory bank (was in CIA bank previously, no
+  functional changes)
+- Configurable motherboard resources memory bank added (includes Fat
+  Gary DE0000, DE0001, DE0002 and RAMSEY DE0003 and DE0043)
+- RAMSEY revision configurable
+- Fat Gary revision configurable (AFAIK this does not exist in existing
+  chips but was planned in future. But Scout detects this so...)
+- 2 x RAMSEY (A3000/A4000 memory controller chip) controlled 32-bit MB
+  Fast RAM configuration added. ROM support for detection needed.
+  - First max 64MB "bank" ends at 0x08000000 (A3000/A4000 ROM needed)
+  - Second max 64MB "bank" from 0x08000000 (as above plus any 3.1+ ROM)
+  In theory there is space for max 96MB but UAE memory system does not
+  like non-power of 2 memory areas. Can be used with RTG and Z3 RAM.
+- Configurable DDxxxx (A3000/A4000 SCSI) DMAC memory bank added (not
+  yet doing anything)
+- CDTV emulation support! (thanks to Mark Knibbs for debugging CDTV
+  ROMs two years ago)
+  - data and audio tracks supported
+  - CDXL animations work better than in CD32 emulation
+  - CD audio volume control not supported
+  - multithreaded, no emulation pauses because of possible slow CD
+    access or CD spin up/down. May not be fully stable yet.
+  - 1x drive speed emulation
+  - 2MB chip enabled in CDTV Quickstart because DF0: is always
+    detected (even without drive) and apparently some games need all
+    available memory. KS 1.x always uses DF0: and I am not sure how
+    CDTV ROM should disable it (or does it do it? CDTV don't have
+    built-in floppy drive)
+  - starting data CD read without aborting previous CD audio
+    freezes (for example DOTC), cdtv device driver keeps waiting
+    for some signal that does not appear. (returning error status
+    will fix this but it also breaks Xenon II, hopefully proper
+    fix is found soon..)
+- do not draw onscreen leds ofscreen (left border in narrow modes)
+- "Magic" mouse option added (wip) System friendly screens + windowed
+  mode only. There is still offset in position when using native
+  screen.
+- disk read DMA without any selected drives will finish normally
+  (would have frozen emulated program in previous versions)
+- "Faster RTG" "instant copper" does not freeze even if copper list
+  has infinite loop.
+- removed A2000 from A500/A2000 quickstart setting, they aren't
+  100% same hardware (A2000 has DF0: ID hardware and CIA-A TOD clock
+  is powersupply tick by default)
+- IOCTL (used by CD32/CDTV emulation) CD access digital CD audio
+  work in Vista (previously total silence when using Daemon Tools
+  or no sound cable between CD drive and sound card)
+  Ugly detail: it closes CreateFile() handle and opens MCI handle
+  when CD audio calls are needed (and back to CreateFile() when
+  accessing data)
+- Current open GUI config panel was initialized, destroyed and
+  initialized again when entering GUI and emulation was running.
+- selecing keyboard layout C and then selecting any other keyboard
+  layout didn't disable layout C.
+- Quickstart disk swap delayed insert fixed again
+- D3D does not depend on D3DX library anymore (no more need for
+  dec 2004 DX SDK to prevent d3dx9_xx.dll dependancy)
+- harddisk configuration handling completely rewritten. Configuration
+  data and mount data are now separate, configuration data is copied
+  to mount data only when starting or reseting the emulation.
+  Also failed mounting won't delete the configuration data.
+  No more disappearing configuration entries if paths have changed
+  or USB device is not inserted or error messages when adjusting
+  configuration settings when emulation is already running.
+  First column shows if the device is currently mounted
+- sound filter/interpolation etc was not initialized until GUI panel
+  was visited
+
+1.3.4 (30.12.2006)
+
 Beta 9:
 
 - interrupt timing tweak (Gravity Force in ce-mode)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 194140f..cce095d
@@ -13,6 +13,8 @@
 static int consoleopen = 0;
 static HANDLE stdinput,stdoutput;
 static int bootlogmode;
+static CRITICAL_SECTION cs;
+static int cs_init;
 
 FILE *debugfile = NULL;
 int console_logging;
@@ -107,8 +109,12 @@ void write_dlog (const char *format, ...)
     DWORD numwritten;
     char buffer[WRITE_LOG_BUF_SIZE];
     char *ts;
-
     va_list parms;
+
+    if (!SHOW_CONSOLE && !console_logging && !debugfile)
+       return;
+
+    EnterCriticalSection(&cs);
     va_start (parms, format);
     count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
     ts = writets();
@@ -128,14 +134,20 @@ void write_dlog (const char *format, ...)
     if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
        lfdetected = 1;
     va_end (parms);
+    LeaveCriticalSection(&cs);
 }
+
 void write_log (const char *format, ...)
 {
     int count, tmp;
     DWORD numwritten;
     char buffer[WRITE_LOG_BUF_SIZE], *ts;
-
     va_list parms;
+
+    if (!SHOW_CONSOLE && !console_logging && !debugfile)
+       return;
+
+    EnterCriticalSection(&cs);
     va_start(parms, format);
     count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
     ts = writets();
@@ -157,6 +169,7 @@ void write_log (const char *format, ...)
     if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
        lfdetected = 1;
     va_end (parms);
+    LeaveCriticalSection(&cs);
 }
 
 void f_out (void *f, const char *format, ...)
@@ -181,6 +194,9 @@ void *log_open(const char *name, int append, int bootlog)
     
     f = fopen(name, append ? "a" : "wt");
     bootlogmode = bootlog;
+    if (!cs_init)
+       InitializeCriticalSection(&cs);
+    cs_init = 1;
     return f;
 }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/rpc.c b/rpc.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 8794bb3..47b4c7e
@@ -353,6 +353,8 @@ void restore_state (char *filename)
     changed_prefs.bogomem_size = 0;
     changed_prefs.chipmem_size = 0;
     changed_prefs.fastmem_size = 0;
+    changed_prefs.mbresmem_low_size = 0;
+    changed_prefs.mbresmem_high_size = 0;
     savestate_state = STATE_RESTORE;
     for (;;) {
        name[0] = 0;
@@ -366,6 +368,12 @@ void restore_state (char *filename)
        } else if (!strcmp (name, "BRAM")) {
            restore_bram (totallen, filepos);
            continue;
+       } else if (!strcmp (name, "A3K1")) {
+           restore_a3000lram (totallen, filepos);
+           continue;
+       } else if (!strcmp (name, "A3K2")) {
+           restore_a3000hram (totallen, filepos);
+           continue;
 #ifdef AUTOCONFIG
        } else if (!strcmp (name, "FRAM")) {
            restore_fram (totallen, filepos);
@@ -497,6 +505,10 @@ static void save_rams (struct zfile *f, int comp)
     save_chunk (f, dst, len, "CRAM", comp);
     dst = save_bram (&len);
     save_chunk (f, dst, len, "BRAM", comp);
+    dst = save_a3000lram (&len);
+    save_chunk (f, dst, len, "A3K1", comp);
+    dst = save_a3000hram (&len);
+    save_chunk (f, dst, len, "A3K2", comp);
 #ifdef AUTOCONFIG
     dst = save_fram (&len);
     save_chunk (f, dst, len, "FRAM", comp);
@@ -525,7 +537,7 @@ void save_state (char *filename, char *description)
     static int warned;
 
 #ifdef FILESYS
-    if (nr_units (currprefs.mountinfo) && !warned) {
+    if (nr_units () && !warned) {
        warned = 1;
        notify_user (NUMSG_STATEHD);
     }
@@ -651,7 +663,7 @@ void save_state (char *filename, char *description)
     save_chunk (f, dst, len, "HRTM", 0);
 #endif
 #ifdef FILESYS
-    for (i = 0; i < nr_units (currprefs.mountinfo); i++) {
+    for (i = 0; i < nr_units (); i++) {
        dst = save_filesys (i, &len);
        if (dst) {
            save_chunk (f, dst, len, "FSYS", 0);
@@ -830,7 +842,7 @@ void savestate_capture (int force)
     struct staterecord *st, *stn;
 
 #ifdef FILESYS
-    if (nr_units (currprefs.mountinfo))
+    if (nr_units ())
        return;
 #endif
     if (!replaybuffer)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 38e59d1..fe4b378
@@ -13,7 +13,6 @@
 #include "sysconfig.h"
 #include "sysdeps.h"
 
-#include "uae.h"
 #include "threaddep/thread.h"
 #include "options.h"
 #include "memory.h"
@@ -127,7 +126,8 @@ static void io_log (char *msg, uaecptr request)
 {
     if (log_scsi)
        write_log ("%s: %08X %d %08.8X %d %d io_actual=%d io_error=%d\n",
-           msg, request,get_word(request + 28),get_long(request + 40),get_long(request + 36),get_long(request + 44),
+           msg, request, get_word(request + 28), get_long(request + 40),
+           get_long(request + 36), get_long(request + 44),
            get_long (request + 32), get_byte (request + 31));
 }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/svga.c b/svga.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/traps.c b/traps.c
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/tui.c b/tui.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/unzip.c b/unzip.c
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/zfile.c b/zfile.c
old mode 100755 (executable)
new mode 100644 (file)