├── CVS ├── Repository ├── Root ├── Entries.Log └── Entries ├── doc ├── CVS │ ├── Repository │ ├── Root │ └── Entries └── Makefile.am ├── m4 ├── CVS │ ├── Repository │ ├── Root │ └── Entries ├── sdl.m4 ├── Makefile.am ├── libpcap.m4 └── x11.m4 ├── src ├── CVS │ ├── Repository │ ├── Root │ └── Entries.Log ├── OS_X │ ├── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries │ └── SDLMain.h ├── base │ ├── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries │ ├── Runnable.cpp │ ├── Poco.h │ ├── Event.cpp │ ├── RWLock_POSIX.cpp │ ├── Semaphore.cpp │ ├── RefCountedObject.cpp │ ├── RWLock.cpp │ ├── Runnable.h │ ├── Platform_POSIX.h │ ├── RWLock_WIN32.h │ ├── Mutex.cpp │ ├── Semaphore_WIN32.h │ ├── ScopedLock.h │ ├── Event_WIN32.cpp │ ├── Mutex_WIN32.cpp │ ├── Event_WIN32.h │ ├── Semaphore_WIN32.cpp │ ├── Mutex_WIN32.h │ ├── ThreadLocal.cpp │ ├── SingletonHolder.h │ └── Bugcheck.cpp ├── gui │ ├── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries │ ├── scancodes.h │ ├── plugin.h │ └── keymap.h ├── stamp-h1 ├── build_os_x_ppc │ └── CVS │ │ ├── Repository │ │ ├── Entries │ │ └── Root ├── System.h ├── build_win32_visual_studio_2005 │ └── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries ├── build_win32_visual_studio_2008 │ └── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries ├── build_win64_visual_studio_2008 │ └── CVS │ │ ├── Repository │ │ ├── Root │ │ └── Entries ├── make_vms.com ├── StdAfx.cpp ├── ShrinkingChoiceQuestion.h ├── cpu_vax.h ├── lockstep.h ├── VGA.h ├── DiskDevice.h ├── DiskController.h ├── VGA.cpp ├── DiskFile.h ├── Question.h ├── SCSIDevice.h ├── DiskRam.h ├── FreeTextQuestion.h ├── AliM1543C_usb.h ├── SystemComponent.cpp ├── SCSIBus.h ├── Port80.h ├── cpu_control.h ├── Ethernet.h ├── cpu_logical.h ├── NumberQuestion.h ├── Makefile.am ├── Flash.h ├── DPR.h ├── config_debug.h ├── DMA.h └── DiskController.cpp ├── config └── CVS │ ├── Repository │ ├── Root │ └── Entries ├── extras └── CVS │ ├── Repository │ ├── Entries │ └── Root ├── THANKS ├── ChangeLog ├── configure ├── AUTHORS ├── README ├── .gitignore ├── README.md ├── NEWS ├── Makefile.am ├── reconf ├── make_vms.com └── configure.ac /CVS/Repository: -------------------------------------------------------------------------------- 1 | es40 2 | -------------------------------------------------------------------------------- /doc/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/doc 2 | -------------------------------------------------------------------------------- /m4/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/m4 2 | -------------------------------------------------------------------------------- /src/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src 2 | -------------------------------------------------------------------------------- /config/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/config 2 | -------------------------------------------------------------------------------- /extras/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/extras 2 | -------------------------------------------------------------------------------- /src/OS_X/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/OS_X 2 | -------------------------------------------------------------------------------- /src/base/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/base 2 | -------------------------------------------------------------------------------- /src/gui/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/gui 2 | -------------------------------------------------------------------------------- /src/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for src/config.h 2 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvorl/es40/HEAD/THANKS -------------------------------------------------------------------------------- /src/build_os_x_ppc/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/build_os_x_ppc 2 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvorl/es40/HEAD/ChangeLog -------------------------------------------------------------------------------- /m4/sdl.m4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvorl/es40/HEAD/m4/sdl.m4 -------------------------------------------------------------------------------- /CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ./configure_1.sh 3 | ./configure_2.sh $@ 4 | -------------------------------------------------------------------------------- /extras/CVS/Entries: -------------------------------------------------------------------------------- 1 | /Doxyfile/1.1/Sat Mar 15 20:58:12 2008// 2 | D 3 | -------------------------------------------------------------------------------- /m4/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/System.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvorl/es40/HEAD/src/System.h -------------------------------------------------------------------------------- /config/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /doc/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /extras/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/gui/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/OS_X/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/base/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/build_os_x_ppc/CVS/Entries: -------------------------------------------------------------------------------- 1 | /Makefile.osx/1.2/Thu Apr 10 12:32:25 2008// 2 | D 3 | -------------------------------------------------------------------------------- /src/build_os_x_ppc/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2005/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/build_win32_visual_studio_2005 2 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2008/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/build_win32_visual_studio_2008 2 | -------------------------------------------------------------------------------- /src/build_win64_visual_studio_2008/CVS/Repository: -------------------------------------------------------------------------------- 1 | es40/src/build_win64_visual_studio_2008 2 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2005/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2008/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /src/build_win64_visual_studio_2008/CVS/Root: -------------------------------------------------------------------------------- 1 | :pserver:anonymous@es40.cvs.sourceforge.net:/cvsroot/es40 2 | -------------------------------------------------------------------------------- /doc/CVS/Entries: -------------------------------------------------------------------------------- 1 | /Makefile.am/1.1/Thu Mar 20 07:49:54 2008// 2 | /Makefile.in/1.3/Thu Mar 11 22:44:07 2010// 3 | D 4 | -------------------------------------------------------------------------------- /src/OS_X/CVS/Entries: -------------------------------------------------------------------------------- 1 | /SDLMain.h/1.2/Thu Apr 10 12:32:25 2008// 2 | /SDLMain.m/1.2/Thu Apr 10 12:32:25 2008// 3 | D 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors of es40. 2 | See also the files THANKS and ChangeLog. 3 | 4 | Camiel Vanderhoeven designed and implemented es40. 5 | -------------------------------------------------------------------------------- /CVS/Entries.Log: -------------------------------------------------------------------------------- 1 | A D/config//// 2 | A D/doc//// 3 | A D/extras//// 4 | A D/m4//// 5 | A D/src//// 6 | A D/windows//// 7 | R D/windows//// 8 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2005/CVS/Entries: -------------------------------------------------------------------------------- 1 | /es40-cfg.vcproj/1.2/Sat Mar 29 18:38:04 2008// 2 | /es40.vcproj/1.19/Thu Jun 12 07:29:44 2008// 3 | D 4 | -------------------------------------------------------------------------------- /src/build_win32_visual_studio_2008/CVS/Entries: -------------------------------------------------------------------------------- 1 | /es40-cfg.vcproj/1.1/Sat May 3 08:24:35 2008// 2 | /es40.vcproj/1.6/Thu Mar 11 10:44:58 2010// 3 | D 4 | -------------------------------------------------------------------------------- /src/build_win64_visual_studio_2008/CVS/Entries: -------------------------------------------------------------------------------- 1 | /es40-cfg.vcproj/1.1/Sat May 3 08:12:46 2008// 2 | /es40.vcproj/1.9/Thu Mar 11 10:45:03 2010// 3 | D 4 | -------------------------------------------------------------------------------- /config/CVS/Entries: -------------------------------------------------------------------------------- 1 | /config.guess/1.1/Thu Mar 20 07:49:54 2008// 2 | /config.sub/1.1/Thu Mar 20 07:49:54 2008// 3 | /install-sh/1.1/Thu Mar 20 07:49:54 2008// 4 | /missing/1.1/Thu Mar 20 07:49:54 2008// 5 | D 6 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Welcome to es40. 2 | 3 | es40 is free software. Please see the file COPYING for details. 4 | For documentation, please see the files in the doc subdirectory. 5 | For building and installation instructions please see the INSTALL file. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #configure 2 | #aclocal.m4 3 | autom4te.cache 4 | compile 5 | config.guess 6 | config.sub 7 | config.log 8 | depcomp 9 | install-sh 10 | missing 11 | src/config.h.in 12 | **/*~ 13 | **/.deps 14 | #**/Makefile 15 | **/Makefile.in 16 | -------------------------------------------------------------------------------- /m4/CVS/Entries: -------------------------------------------------------------------------------- 1 | /Makefile.am/1.1/Thu Mar 20 07:49:55 2008// 2 | /Makefile.in/1.4/Thu Mar 11 22:44:08 2010// 3 | /doxygen.m4/1.1/Wed Mar 26 19:01:39 2008// 4 | /libpcap.m4/1.1/Thu Mar 20 07:49:55 2008// 5 | /pthreads.m4/1.1/Sat May 31 15:47:18 2008// 6 | /sdl.m4/1.3/Fri May 9 07:10:22 2008// 7 | /x11.m4/1.1/Thu Mar 20 07:49:55 2008// 8 | D 9 | -------------------------------------------------------------------------------- /src/CVS/Entries.Log: -------------------------------------------------------------------------------- 1 | A D/OS_X//// 2 | A D/base//// 3 | A D/build_os_x_ppc//// 4 | A D/build_win32_visual_studio_2005//// 5 | A D/build_win32_visual_studio_2008//// 6 | A D/build_win32_visual_studio_6.0//// 7 | A D/build_win64_visual_studio_2008//// 8 | A D/gui//// 9 | A D/vms//// 10 | A D/windows//// 11 | R D/windows//// 12 | R D/vms//// 13 | R D/build_win32_visual_studio_6.0//// 14 | -------------------------------------------------------------------------------- /src/gui/CVS/Entries: -------------------------------------------------------------------------------- 1 | /gui.cpp/1.10/Wed Mar 26 19:19:53 2008// 2 | /gui.h/1.9/Fri Mar 14 15:31:29 2008// 3 | /gui_win32.cpp/1.8/Fri Mar 14 15:31:29 2008// 4 | /gui_win32_font.h/1.2/Fri Mar 14 15:31:29 2008// 5 | /gui_x11.cpp/1.5/Wed Mar 26 19:19:53 2008// 6 | /keymap.cpp/1.9/Wed Mar 26 19:19:53 2008// 7 | /keymap.h/1.7/Wed Mar 26 19:19:53 2008// 8 | /plugin.h/1.7/Fri Mar 14 15:31:29 2008// 9 | /scancodes.cpp/1.6/Mon Mar 24 11:58:21 2008// 10 | /scancodes.h/1.4/Fri Mar 14 15:31:29 2008// 11 | /sdl.cpp/1.18/Thu Apr 10 12:32:25 2008// 12 | /sdl_fonts.h/1.3/Fri Mar 14 15:31:29 2008// 13 | /sdlkeys.h/1.4/Fri Mar 14 15:31:29 2008// 14 | /vga.h/1.5/Fri Mar 14 15:31:29 2008// 15 | D 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | __ES40 Alpha System Emulator__ 2 | 3 | Original project at http://www.es40.org (now dead) 4 | 5 | Original code at https://sourceforge.net/projects/es40/ 6 | This code based on the latest snapshot build 20080503_1030 7 | 8 | With code from a discussion on 9 | [openvmshobbyist.com](https://www.openvmshobbyist.com/forum/viewthread.php?forum_id=161&thread_id=2801) 10 | 11 | With inspirations from Github projects by 12 | [SMR11](https://github.com/SMR11/es40) and 13 | [promovicz](https://github.com/promovicz/es40) 14 | 15 | 16 | Original README below 17 | 18 | 19 | Welcome to es40. 20 | 21 | es40 is free software. Please see the file COPYING for details. 22 | For documentation, please see the files in the doc subdirectory. 23 | For building and installation instructions please see the INSTALL file. 24 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | es40 -- History of visible changes. 2 | 3 | Copyright (C) 2007-2008, the ES40 Emulator Project 4 | See the end for copying conditions. 5 | 6 | Please send es40 bug reports to iamcamiel@gmail.com. 7 | 8 | Please refer to ChangeLog for version history. 9 | 10 | ------------------------------------------------------- 11 | Copying information: 12 | 13 | Copyright (C) 2007-2008, the ES40 Emulator Project 14 | 15 | Permission is granted to anyone to make or distribute verbatim copies 16 | of this document as received, in any medium, provided that the 17 | copyright notice and this permission notice are preserved, 18 | thus giving the recipient permission to redistribute in turn. 19 | 20 | Permission is granted to distribute modified versions 21 | of this document, or of portions of it, 22 | under the above conditions, provided also that they 23 | carry prominent notices stating who last changed them. 24 | 25 | -------------------------------------------------------------------------------- /CVS/Entries: -------------------------------------------------------------------------------- 1 | /AUTHORS/1.1/Thu Mar 20 07:49:51 2008// 2 | /COPYING/1.1/Thu Mar 20 07:49:52 2008// 3 | /ChangeLog/1.15/Thu Jun 12 07:29:44 2008// 4 | /INSTALL/1.1/Thu Mar 20 07:49:52 2008// 5 | /Makefile.am/1.2/Sat May 31 15:47:05 2008// 6 | /Makefile.in/1.5/Thu Mar 11 22:44:04 2010// 7 | /NEWS/1.1/Thu Mar 20 07:49:52 2008// 8 | /README/1.1/Thu Mar 20 07:49:52 2008// 9 | /THANKS/1.4/Thu Jun 12 06:55:10 2008// 10 | /aclocal.m4/1.2/Thu Mar 11 22:44:06 2010// 11 | /aminclude.am/1.1/Wed Mar 26 19:01:38 2008// 12 | /config.sub/1.1/Thu Mar 11 22:44:06 2010// 13 | /configure/1.3/Fri Mar 21 15:09:24 2008// 14 | /configure.ac/1.5/Sat May 31 15:47:07 2008// 15 | /configure_1.m4/1.7/Sat May 31 15:47:07 2008// 16 | /configure_1.sh/1.7/Thu Mar 11 22:44:06 2010// 17 | /configure_2.sh/1.6/Thu Mar 11 22:44:06 2010// 18 | /depcomp/1.1/Thu Mar 20 07:49:53 2008// 19 | /doxygen.cfg/1.1/Wed Mar 26 19:01:38 2008// 20 | /install-sh/1.1/Thu Mar 20 07:49:53 2008// 21 | /make_vms.com/1.4/Wed Apr 2 14:00:01 2008/-kb/ 22 | /missing/1.1/Thu Mar 20 07:49:53 2008// 23 | /reconf/1.4/Sun Mar 30 15:53:19 2008// 24 | D 25 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://sourceforge.net/projects/es40 6 | # E-mail : camiel@camicom.com 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: Makefile.am,v 1.1 2008/03/20 07:49:54 iamcamiel Exp $ 30 | # 31 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 32 | # File Created. 33 | # 34 | ################################################################################ 35 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://www.es40.org 6 | # E-mail : camiel@es40.org 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: Makefile.am,v 1.2 2008/05/31 15:47:05 iamcamiel Exp $ 30 | # 31 | # X-1.2 Camiel Vanderhoeven 31-MAY-2008 32 | # Add parts of Poco. 33 | # 34 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 35 | # File Created. 36 | # 37 | ################################################################################ 38 | 39 | EXTRA_DIST = reconf configure 40 | SUBDIRS = m4 src doc 41 | -------------------------------------------------------------------------------- /src/make_vms.com: -------------------------------------------------------------------------------- 1 | $ SET NOVERIFY 2 | $! 3 | $! ES40 Emulator 4 | $! Copyright (C) 2007-2008 by the ES40 Emulator Project 5 | $! 6 | $! This file was created by make_vms.sh. Please refer to that file 7 | $! for more information. 8 | $! 9 | $ SAY = "WRITE SYS$OUTPUT" 10 | $! 11 | $! DETERMINE ES40 SRC ROOT PATH IN UNIX-STYLE SYNTAX 12 | $! 13 | $ DFLT = F$STRING("/" + F$ENVIRONMENT("DEFAULT")) 14 | $ DLEN = F$LENGTH("''DFLT'") 15 | $! 16 | $ loop_dot: 17 | $ DD = F$LOCATE(".",DFLT) 18 | $ IF DD .EQ. DLEN 19 | $ THEN 20 | $ GOTO loop_dot_end 21 | $ ENDIF 22 | $ DFLT[DD,1]:="/" 23 | $ GOTO loop_dot 24 | $ loop_dot_end: 25 | $! 26 | $ DD = F$LOCATE(":[",DFLT) 27 | $ IF DD .NE. DLEN 28 | $ THEN 29 | $ DFLT[DD,2]:="/" 30 | $ ENDIF 31 | $! 32 | $ DD = F$LOCATE("]",DFLT) 33 | $ IF DD .NE. DLEN 34 | $ THEN 35 | $ DFLT[DD,1]:="" 36 | $ ENDIF 37 | $! 38 | $ DD = F$LOCATE("$",DFLT) 39 | $ IF DD .NE. DLEN 40 | $ THEN 41 | $ DFLT=F$STRING(F$EXTRACT(0,DD,DFLT) + "\$" + F$EXTRACT(DD+1,DLEN-DD,DFLT)) 42 | $ ENDIF 43 | $! 44 | $ ES40_ROOT = F$EDIT(DFLT,"COLLAPSE") 45 | $! 46 | $! Determine if X11 support is available... 47 | $! 48 | $ CREATE X11TEST.CPP 49 | $ DECK 50 | #include 51 | 52 | void x() { XOpenDisplay(NULL); } 53 | $ EOD 54 | $ SET NOON 55 | $ CXX X11TEST.CPP /OBJECT=X11TEST.OBJ 56 | $ IF $STATUS 57 | $ THEN 58 | $ SAY "Have found X11 support" 59 | $ X11_DEF=",HAVE_X11" 60 | $ X11_LIB=",SYS$LIBRARY:DECWINDOWS/LIB" 61 | $ ELSE 62 | $ SAY "Have not found X11 support" 63 | $ X11_DEF="" 64 | $ X11_LIB="" 65 | $ ENDIF 66 | $ DELETE X11TEST.CPP; 67 | $ DELETE X11TEST.OBJ; 68 | $ SET ON 69 | $! 70 | $! 71 | $! Compile sources for es40 72 | $! 73 | $! Compile with the following defines: ES40,__USE_STD_IOSTREAM 74 | $! 75 | $ SAY "Compiling es40..." 76 | -------------------------------------------------------------------------------- /src/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007 by Camiel Vanderhoeven 3 | * 4 | * Website: www.camicom.com 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * stdafx.cpp : source file that includes just the standard includes 26 | * AlphaSim.pch will be the pre-compiled header 27 | * stdafx.obj will contain the pre-compiled type information 28 | */ 29 | 30 | /** 31 | * \file 32 | * Source file that includes just the standard includes. 33 | * AlphaSim.pch will be the pre-compiled header. 34 | * stdafx.obj will contain the pre-compiled type information. 35 | * 36 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 37 | **/ 38 | #include "StdAfx.h" 39 | 40 | // TODO: reference any additional headers you need in STDAFX.H 41 | // and not in this file 42 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://sourceforge.net/projects/es40 6 | # E-mail : camiel@camicom.com 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: Makefile.am,v 1.1 2008/03/20 07:49:55 iamcamiel Exp $ 30 | # 31 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 32 | # File Created. 33 | # 34 | ################################################################################ 35 | 36 | # Install m4 macros in this directory 37 | m4datadir = $(datadir)/aclocal 38 | 39 | # List your m4 macros here 40 | m4macros = 41 | 42 | # The following is boilerplate 43 | m4data_DATA = $(m4macros) 44 | EXTRA_DIST = $(m4data_DATA) 45 | 46 | -------------------------------------------------------------------------------- /src/ShrinkingChoiceQuestion.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Configuration file creator. 29 | * 30 | * $Id: ShrinkingChoiceQuestion.h,v 1.1 2008/03/28 21:57:00 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 28-MAR-2008 33 | * File created. 34 | **/ 35 | 36 | /** 37 | * Question class implementing a "Shrinking Choice" question. 38 | * 39 | * A shrinking choice question is a multiple choice question 40 | * where each answer given is removed from the list of valid 41 | * answers. 42 | **/ 43 | class ShrinkingChoiceQuestion: public MultipleChoiceQuestion 44 | { 45 | /** 46 | * Overridden to remove the answer that was given from the 47 | * allowed answer set. 48 | **/ 49 | virtual void haveChosen(string choice) 50 | { 51 | dropChoice(choice); 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /src/cpu_vax.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007 by Camiel Vanderhoeven 3 | * 4 | * Website: www.camicom.com 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains code macros for the processor VAX compatibility instructions. 29 | * 30 | * X-1.3 Camiel Vanderhoeven 11-APR-2007 31 | * Moved all data that should be saved to a state file to a structure 32 | * "state". 33 | * 34 | * X-1.2 Camiel Vanderhoeven 30-MAR-2007 35 | * Added old changelog comments. 36 | * 37 | * X-1.1 Camiel Vanderhoeven 18-FEB-2007 38 | * File created. Contains code previously found in AlphaCPU.h 39 | * 40 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 41 | **/ 42 | #define DO_RC state.r[REG_1] = state.bIntrFlag ? 1 : 0; \ 43 | state.bIntrFlag = false; 44 | 45 | #define DO_RS state.r[REG_1] = state.bIntrFlag ? 1 : 0; \ 46 | state.bIntrFlag = true; 47 | -------------------------------------------------------------------------------- /src/OS_X/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://es40.org 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Defines the Apple entry point for the application. 29 | * 30 | * $Id: SDLMain.h,v 1.2 2008/04/10 12:32:25 iamcamiel Exp $ 31 | * 32 | * X-1.1 Martin Borgman 10-APR-2008 33 | * Adapted for use with ES40 Emulator. 34 | **/ 35 | 36 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 37 | Initial Version: Darrell Walisser 38 | Non-NIB-Code & other changes: Max Horn 39 | 40 | Feel free to customize this file to suit your needs 41 | */ 42 | 43 | #import 44 | 45 | @interface SDLMain : NSObject 46 | - (IBAction)prefsMenu:(id)sender; 47 | - (IBAction)newGame:(id)sender; 48 | - (IBAction)openGame:(id)sender; 49 | - (IBAction)saveGame:(id)sender; 50 | - (IBAction)saveGameAs:(id)sender; 51 | - (IBAction)help:(id)sender; 52 | @end 53 | -------------------------------------------------------------------------------- /src/gui/scancodes.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This file is based upon Bochs. 8 | * 9 | * Copyright (C) 2002 MandrakeSoft S.A. 10 | * 11 | * MandrakeSoft S.A. 12 | * 43, rue d'Aboukir 13 | * 75002 Paris - France 14 | * http://www.linux-mandrake.com/ 15 | * http://www.mandrakesoft.com/ 16 | * 17 | * This library is free software; you can redistribute it and/or 18 | * modify it under the terms of the GNU Lesser General Public 19 | * License as published by the Free Software Foundation; either 20 | * version 2 of the License, or (at your option) any later version. 21 | * 22 | * This library is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not, write to the Free Software 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | */ 31 | 32 | /** 33 | * \file 34 | * Contains definitions for scancode table. 35 | * 36 | * $Id: scancodes.h,v 1.4 2008/03/14 15:31:29 iamcamiel Exp $ 37 | * X-1.3 Camiel Vanderhoeven 02-JAN-2008 38 | * Comments. 39 | * 40 | * X-1.1 Camiel Vanderhoeven 6-DEC-2007 41 | * Initial version for ES40 emulator. 42 | * 43 | **/ 44 | #include "gui.h" 45 | #ifndef BX_SCANCODES_H 46 | #define BX_SCANCODES_H 47 | 48 | // Translation table of the 8042 49 | extern unsigned char translation8042[256]; 50 | 51 | typedef struct 52 | { 53 | const char* make; 54 | const char* brek; 55 | } scancode; 56 | 57 | // Scancodes table 58 | extern scancode scancodes[BX_KEY_NBKEYS][3]; 59 | #endif 60 | -------------------------------------------------------------------------------- /reconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ################################################################################ 3 | # ES40 emulator. 4 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 5 | # 6 | # Website: http://sourceforge.net/projects/es40 7 | # E-mail : camiel@camicom.com 8 | # 9 | # This program is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License 11 | # as published by the Free Software Foundation; either version 2 12 | # of the License, or (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | # 02110-1301, USA. 23 | # 24 | # Although this is not required, the author would appreciate being notified of, 25 | # and receiving any modifications you may make to the source code that might serve 26 | # the general public. 27 | # 28 | ################################################################################ 29 | # 30 | # $Id: reconf,v 1.4 2008/03/30 15:53:19 iamcamiel Exp $ 31 | # 32 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 33 | # File Created. 34 | # 35 | ################################################################################ 36 | 37 | 38 | rm -f config.cache configure configure_2.sh configure_1.sh 39 | echo "- aclocal." 40 | aclocal -I m4 41 | echo "- autoconf." 42 | autoconf 43 | echo "- autoheader." 44 | autoheader 45 | echo "- automake." 46 | automake -a 47 | echo "- VMS scripts." 48 | cd src 49 | ./make_vms.sh 50 | cd .. 51 | echo "- housekeeping." 52 | mv configure configure_2.sh 53 | m4 configure_1.sh 54 | cat >configure <, set the 88 | * answer to the default answer. 89 | */ 90 | if (mAnswer =="") 91 | mAnswer = mDefault; 92 | 93 | /* Return the answer. 94 | */ 95 | return mAnswer; 96 | } 97 | } 98 | 99 | protected: 100 | /** List of options to show after the question. */ 101 | string mOptions; 102 | }; 103 | -------------------------------------------------------------------------------- /src/gui/plugin.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * Copyright (C) 2002 MandrakeSoft S.A. 8 | * 9 | * MandrakeSoft S.A. 10 | * 43, rue d'Aboukir 11 | * 75002 Paris - France 12 | * http://www.linux-mandrake.com/ 13 | * http://www.mandrakesoft.com/ 14 | * 15 | * This library is free software; you can redistribute it and/or 16 | * modify it under the terms of the GNU Lesser General Public 17 | * License as published by the Free Software Foundation; either 18 | * version 2 of the License, or (at your option) any later version. 19 | * 20 | * This library is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not, write to the Free Software 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 | */ 29 | 30 | /** 31 | * \file 32 | * Contains the definitions for use with bx_..._gui_c classes used for 33 | * interfacing with SDL and other device interfaces. 34 | * 35 | * $Id: plugin.h,v 1.7 2008/03/14 15:31:29 iamcamiel Exp $ 36 | * 37 | * X-1.5 Camiel Vanderhoeven 20-JAN-2008 38 | * Added X11 GUI. 39 | * 40 | * X-1.4 Camiel Vanderhoeven 19-JAN-2008 41 | * Added win32 GUI. 42 | * 43 | * X-1.3 Camiel Vanderhoeven 02-JAN-2008 44 | * Comments. 45 | * 46 | * X-1.2 Camiel Vanderhoeven 10-DEC-2007 47 | * Simplified this for use with ES40. 48 | * 49 | * X-1.1 Camiel Vanderhoeven 6-DEC-2007 50 | * Initial version for ES40 emulator. 51 | * 52 | **/ 53 | 54 | ///////////////////////////////////////////////////////////////////////// 55 | // 56 | // This file provides macros and types needed for plugins. It is based on 57 | // the plugin.h file from plex86, but with significant changes to make 58 | // it work in Bochs. 59 | // Plex86 is Copyright (C) 1999-2000 The plex86 developers team 60 | // 61 | ///////////////////////////////////////////////////////////////////////// 62 | #ifndef __PLUGIN_H 63 | #define __PLUGIN_H 64 | 65 | #define PLUG_load_plugin(cfg, name) \ 66 | { \ 67 | lib##name##_LTX_plugin_init(cfg); \ 68 | } 69 | #define PLUG_unload_plugin(name) \ 70 | { \ 71 | lib##name##_LTX_plugin_fini(); \ 72 | } 73 | 74 | #define DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(mod) \ 75 | int lib##mod##_LTX_plugin_init(CConfigurator* cfg); \ 76 | void lib##mod##_LTX_plugin_fini(void); 77 | 78 | #if defined(HAVE_SDL) 79 | DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(sdl) 80 | #endif 81 | #if defined(_WIN32) 82 | DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(win32) 83 | #endif 84 | #if defined(HAVE_X11) 85 | DECLARE_PLUGIN_INIT_FINI_FOR_MODULE(x11) 86 | #endif 87 | #endif /* __PLUGIN_H */ 88 | -------------------------------------------------------------------------------- /src/AliM1543C_usb.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains the definitions for the emulated Ali M1543C USB chipset part. 29 | * 30 | * $Id: AliM1543C_usb.h,v 1.6 2008/03/14 15:30:50 iamcamiel Exp $ 31 | * 32 | * X-1.5 Brian wheeler 18-FEB-2008 33 | * Implemented HCI register space. 34 | * 35 | * X-1.4 Camiel Vanderhoeven 08-JAN-2008 36 | * Comments. 37 | * 38 | * X-1.3 Camiel Vanderhoeven 02-JAN-2008 39 | * Comments. 40 | * 41 | * X-1.2 Camiel Vanderhoeven 17-DEC-2007 42 | * SaveState file format 2.1 43 | * 44 | * X-1.1 Camiel Vanderhoeven 10-DEC-2007 45 | * Initial version in CVS; this part was split off from the CAliM1543C 46 | * class. 47 | **/ 48 | #if !defined(INCLUDED_ALIM1543C_USB_H) 49 | #define INCLUDED_ALIM1543C_USB_H 50 | 51 | #include "PCIDevice.h" 52 | 53 | /** 54 | * \brief Emulated USB part of ALi M1543C multi-function device. 55 | * 56 | * \todo This device is just a stub. Not functional yet. 57 | * 58 | * Documentation consulted: 59 | * - Ali M1543C B1 South Bridge Version 1.20 60 | * (http://mds.gotdns.com/sensors/docs/ali/1543dScb1-120.pdf) 61 | * . 62 | **/ 63 | class CAliM1543C_usb : public CPCIDevice 64 | { 65 | public: 66 | virtual int SaveState(FILE* f); 67 | virtual int RestoreState(FILE* f); 68 | 69 | CAliM1543C_usb(CConfigurator* cfg, class CSystem* c, int pcibus, int pcidev); 70 | virtual ~CAliM1543C_usb(); 71 | virtual void WriteMem_Bar(int func, int bar, u32 address, int dsize, 72 | u32 data); 73 | virtual u32 ReadMem_Bar(int func, int bar, u32 address, int dsize); 74 | private: 75 | u64 usb_hci_read(u64 address, int dsize); 76 | void usb_hci_write(u64 address, int dsize, u64 data); 77 | 78 | /// The state structure contains all elements that need to be saved to the statefile. 79 | struct SUSB_state 80 | { 81 | u32 usb_data[0x110 / 4]; 82 | } state; 83 | }; 84 | #endif // !defined(INCLUDED_ALIM1543C_USB_H) 85 | -------------------------------------------------------------------------------- /src/base/Runnable.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Runnable.cpp,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Runnable.cpp 38 | // 39 | // $Id: Runnable.cpp,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Thread 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Runnable.h" 73 | 74 | CRunnable::CRunnable() 75 | { 76 | } 77 | 78 | 79 | CRunnable::~CRunnable() 80 | { 81 | } 82 | -------------------------------------------------------------------------------- /src/gui/keymap.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This file is based upon Bochs. 8 | * 9 | * Copyright (C) 2002 MandrakeSoft S.A. 10 | * 11 | * MandrakeSoft S.A. 12 | * 43, rue d'Aboukir 13 | * 75002 Paris - France 14 | * http://www.linux-mandrake.com/ 15 | * http://www.mandrakesoft.com/ 16 | * 17 | * This library is free software; you can redistribute it and/or 18 | * modify it under the terms of the GNU Lesser General Public 19 | * License as published by the Free Software Foundation; either 20 | * version 2 of the License, or (at your option) any later version. 21 | * 22 | * This library is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not, write to the Free Software 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | */ 31 | 32 | /** 33 | * \file 34 | * Contains the definitions for the bx_keymap_c class used for keyboard 35 | * interfacing with SDL and other device interfaces. 36 | * 37 | * $Id: keymap.h,v 1.7 2008/03/26 19:19:53 iamcamiel Exp $ 38 | * 39 | * X-1.7 Camiel Vanderhoeven 26-MAR-2008 40 | * Fix compiler warnings. 41 | * 42 | * X-1.6 Camiel Vanderhoeven 14-MAR-2008 43 | * Formatting. 44 | * 45 | * X-1.4 Camiel Vanderhoeven 02-JAN-2008 46 | * Comments. 47 | * 48 | * X-1.3 Camiel Vanderhoeven 10-DEC-2007 49 | * Use Configurator. 50 | * 51 | * X-1.2 Camiel Vanderhoeven 7-DEC-2007 52 | * Code cleanup. 53 | * 54 | * X-1.1 Camiel Vanderhoeven 6-DEC-2007 55 | * Initial version for ES40 emulator. 56 | * 57 | **/ 58 | #include "../Configurator.h" 59 | 60 | // In case of unknown symbol 61 | #define BX_KEYMAP_UNKNOWN 0xFFFFFFFF 62 | 63 | /// Structure of an element of the keymap table 64 | typedef struct 65 | { 66 | u32 baseKey; // base key 67 | u32 modKey; // modifier key that must be held down 68 | s32 ascii; // ascii equivalent, if any 69 | u32 hostKey; // value that the host's OS or library recognizes 70 | } BXKeyEntry; 71 | 72 | /** 73 | * \brief Keymap, used to map host keys to scancodes. 74 | **/ 75 | class bx_keymap_c 76 | { 77 | public: 78 | bx_keymap_c(CConfigurator* cfg); 79 | ~bx_keymap_c(void); 80 | 81 | void loadKeymap(u32 stringToSymbol (const char*)); 82 | void loadKeymap(u32 stringToSymbol (const char*), 83 | const char *filename); 84 | bool isKeymapLoaded(); 85 | 86 | BXKeyEntry* findHostKey(u32 hostkeynum); 87 | BXKeyEntry* findAsciiChar(u8 ascii); 88 | const char* getBXKeyName(u32 key); 89 | private: 90 | u32 convertStringToBXKey(const char* ); 91 | CConfigurator* myCfg; 92 | 93 | BXKeyEntry* keymapTable; 94 | u16 keymapCount; 95 | }; 96 | 97 | extern bx_keymap_c* bx_keymap; 98 | -------------------------------------------------------------------------------- /src/base/Poco.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Poco.h,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Poco.h 38 | // 39 | // $Id: Poco.h,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Core 43 | // Module: Foundation 44 | // 45 | // Basic definitions for the POCO libraries. 46 | // 47 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_Poco_INCLUDED 75 | #define Foundation_Poco_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | 80 | 81 | #endif // Foundation_Poco_INCLUDED 82 | -------------------------------------------------------------------------------- /src/SystemComponent.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains code for the base class for devices that connect to the chipset. 29 | * 30 | * X-1.12 Camiel Vanderhoeven 13-MAR-2008 31 | * Create init(), start_threads() and stop_threads() functions. 32 | * 33 | * X-1.11 Camiel Vanderhoeven 29-DEC-2007 34 | * Fix memory-leak. 35 | * 36 | * X-1.10 Camiel Vanderhoeven 28-DEC-2007 37 | * Keep the compiler happy. 38 | * 39 | * X-1.9 Camiel Vanderhoeven 17-DEC-2007 40 | * SaveState file format 2.1 41 | * 42 | * X-1.8 Camiel Vanderhoeven 10-DEC-2007 43 | * Use configurator. 44 | * 45 | * X-1.7 Camiel Vanderhoeven 30-MAR-2007 46 | * Added old changelog comments. 47 | * 48 | * X-1.6 Brian Wheeler 13-FEB-2007 49 | * Formatting. 50 | * 51 | * X-1.5 Camiel Vanderhoeven 12-FEB-2007 52 | * Added comments. 53 | * 54 | * X-1.4 Camiel Vanderhoeven 9-FEB-2007 55 | * Added comments. 56 | * 57 | * X-1.3 Brian Wheeler 3-FEB-2007 58 | * Formatting. 59 | * 60 | * X-1.2 Brian Wheeler 3-FEB-2007 61 | * Includes are now case-correct (necessary on Linux) 62 | * 63 | * X-1.1 Camiel Vanderhoeven 19-JAN-2007 64 | * Initial version in CVS. 65 | * 66 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 67 | **/ 68 | #include "StdAfx.h" 69 | #include "SystemComponent.h" 70 | #include "System.h" 71 | 72 | /** 73 | * Constructor. 74 | **/ 75 | CSystemComponent::CSystemComponent(CConfigurator* cfg, CSystem* system) 76 | { 77 | char* a; 78 | char* b; 79 | 80 | system->RegisterComponent(this); 81 | cSystem = system; 82 | myCfg = cfg; 83 | 84 | a = myCfg->get_myName(); 85 | b = myCfg->get_myValue(); 86 | 87 | CHECK_ALLOCATION(devid_string = (char*) malloc(strlen(a) + strlen(b) + 3)); 88 | sprintf(devid_string, "%s(%s)", a, b); 89 | } 90 | 91 | /** 92 | * destructor. 93 | **/ 94 | CSystemComponent::~CSystemComponent() 95 | { 96 | free(devid_string); 97 | devid_string = NULL; 98 | } 99 | -------------------------------------------------------------------------------- /src/SCSIBus.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains definitions for the SCSI bus class. 29 | * 30 | * $Id: SCSIBus.h,v 1.3 2008/03/14 15:30:52 iamcamiel Exp $ 31 | * 32 | * X-1.2 Camiel Vanderhoeven 20-JAN-2008 33 | * Avoid compiler warnings. 34 | * 35 | * X-1.1 Camiel Vanderhoeven 12-JAN-2008 36 | * Initial version in CVS. 37 | **/ 38 | #if !defined(__SCSIBUS__H__) 39 | #define __SCSIBUS__H__ 40 | 41 | #include "SystemComponent.h" 42 | #include "SCSIDevice.h" 43 | 44 | /** 45 | * \brief Emulated SCSI bus. 46 | * 47 | * connects SCSI Devices (class CSCSIDevice) together; SCSI devices are 48 | * disks and controllers. 49 | **/ 50 | class CSCSIBus : public CSystemComponent 51 | { 52 | public: 53 | CSCSIBus(CConfigurator* cfg, CSystem* c); 54 | ~CSCSIBus(void); 55 | virtual int SaveState(FILE* f); 56 | virtual int RestoreState(FILE* f); 57 | 58 | void scsi_register(CSCSIDevice* dev, int bus, int target); 59 | void scsi_unregister(CSCSIDevice* dev, int target); 60 | 61 | bool arbitrate(int initiator); 62 | bool select(int initiator, int target); 63 | void set_phase(int target, int phase); 64 | int get_phase() { return state.phase; }; 65 | 66 | /**< Get current SCSI bus phase **/ 67 | void free_bus(int initiator); 68 | 69 | CSCSIDevice* targets[16]; /**< pointers to the SCSI devices that respond to the 15 possible target id's. **/ 70 | int target_bus_no[16]; /**< indicates what bus this is for each connected SCSI device. always 0 for disks, 71 | but controllers could have multiple SCSI busses. **/ 72 | 73 | /// The state structure contains all elements that need to be saved to the statefile 74 | struct SSCSI_state 75 | { 76 | int initiator; /**< SCSI id of the initiator. **/ 77 | int target; /**< SCSI id of the target. **/ 78 | int phase; /**< SCSI bus phase. **/ 79 | } state; 80 | }; 81 | 82 | #define SCSI_PHASE_FREE - 2 83 | #define SCSI_PHASE_ARBITRATION - 1 84 | #define SCSI_PHASE_DATA_OUT 0 85 | #define SCSI_PHASE_DATA_IN 1 86 | #define SCSI_PHASE_COMMAND 2 87 | #define SCSI_PHASE_STATUS 3 88 | #define SCSI_PHASE_MSG_OUT 6 89 | #define SCSI_PHASE_MSG_IN 7 90 | #endif 91 | -------------------------------------------------------------------------------- /src/base/Event.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Event.cpp,v 1.1 2008/05/31 15:47:21 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Event.cpp 38 | // 39 | // $Id: Event.cpp,v 1.1 2008/05/31 15:47:21 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Event 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Event.h" 73 | 74 | 75 | #if defined(POCO_OS_FAMILY_WINDOWS) 76 | #include "Event_WIN32.cpp" 77 | #else 78 | #include "Event_POSIX.cpp" 79 | #endif 80 | 81 | CEvent::CEvent(bool autoReset): CEventImpl(autoReset) 82 | { 83 | } 84 | 85 | 86 | CEvent::~CEvent() 87 | { 88 | } 89 | -------------------------------------------------------------------------------- /src/Port80.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains the definitions for the emulated Port 80 device. 29 | * 30 | * $Id: Port80.h,v 1.10 2008/03/14 15:30:51 iamcamiel Exp $ 31 | * 32 | * X-1.9 Camiel Vanderhoeven 02-JAN-2008 33 | * Comments. 34 | * 35 | * X-1.8 Camiel Vanderhoeven 17-DEC-2007 36 | * SaveState file format 2.1 37 | * 38 | * X-1.7 Camiel Vanderhoeven 10-DEC-2007 39 | * Use configurator. 40 | * 41 | * X-1.6 Camiel Vanderhoeven 30-MAR-2007 42 | * Added old changelog comments. 43 | * 44 | * X-1.5 Camiel Vanderhoeven 16-FEB-2007 45 | * Changed header guards 46 | * 47 | * X-1.4 Camiel Vanderhoeven 12-FEB-2007 48 | * Added comments. 49 | * 50 | * X-1.3 Camiel Vanderhoeven 9-FEB-2007 51 | * Added comments. 52 | * 53 | * X-1.2 Brian Wheeler 3-FEB-2007 54 | * Formatting. 55 | * 56 | * X-1.1 Camiel Vanderhoeven 19-JAN-2007 57 | * Initial version in CVS. 58 | * 59 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 60 | **/ 61 | #if !defined(INCLUDED_PORT80_H) 62 | #define INCLUDED_PORT80_H 63 | 64 | #include "SystemComponent.h" 65 | 66 | /** 67 | * \brief Emulated port 80. 68 | * 69 | * Port 80 is a port without a real function, that is used to slow things down. 70 | * Since our emulator is slow enough already ;-) this port has no function at 71 | * all, but it needs to be there to avoid error messages about non-existing 72 | * hardware. 73 | **/ 74 | class CPort80 : public CSystemComponent 75 | { 76 | public: 77 | CPort80(CConfigurator* cfg, class CSystem* c); 78 | virtual ~CPort80(); 79 | virtual u64 ReadMem(int index, u64 address, int dsize); 80 | virtual void WriteMem(int index, u64 address, int dsize, u64 data); 81 | virtual int SaveState(FILE* f); 82 | virtual int RestoreState(FILE* f); 83 | protected: 84 | 85 | /// The state structure contains all elements that need to be saved to the statefile. 86 | struct SPort80_state 87 | { 88 | u8 p80; /**< Last value written.*/ 89 | } state; 90 | }; 91 | #endif // !defined(INCLUDED_PORT80_H) 92 | -------------------------------------------------------------------------------- /src/base/RWLock_POSIX.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: RWLock_POSIX.cpp,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // RWLock_POSIX.cpp 38 | // 39 | // $Id: RWLock_POSIX.cpp,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: RWLock 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "RWLock_POSIX.h" 73 | 74 | 75 | CRWLockImpl::CRWLockImpl() 76 | { 77 | if (pthread_rwlock_init(&_rwl, NULL)) 78 | throw CSystemException("cannot create reader/writer lock"); 79 | } 80 | 81 | 82 | CRWLockImpl::~CRWLockImpl() 83 | { 84 | pthread_rwlock_destroy(&_rwl); 85 | } 86 | -------------------------------------------------------------------------------- /src/base/Semaphore.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Semaphore.cpp,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Semaphore.cpp 38 | // 39 | // $Id: Semaphore.cpp,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Semaphore 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Semaphore.h" 73 | 74 | 75 | #if defined(POCO_OS_FAMILY_WINDOWS) 76 | #include "Semaphore_WIN32.cpp" 77 | #else 78 | #include "Semaphore_POSIX.cpp" 79 | #endif 80 | 81 | 82 | CSemaphore::CSemaphore(int n): CSemaphoreImpl(n, n) 83 | { 84 | } 85 | 86 | 87 | CSemaphore::CSemaphore(int n, int max): CSemaphoreImpl(n, max) 88 | { 89 | } 90 | 91 | 92 | CSemaphore::~CSemaphore() 93 | { 94 | } 95 | -------------------------------------------------------------------------------- /src/cpu_control.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains code macros for the processor control instructions. 29 | * Based on ARM chapter 4.3 30 | * 31 | * $Id: cpu_control.h,v 1.7 2008/03/14 15:30:52 iamcamiel Exp $ 32 | * 33 | * X-1.6 Camiel Vanderhoeven 14-MAR-2008 34 | * 1. More meaningful exceptions replace throwing (int) 1. 35 | * 2. U64 macro replaces X64 macro. 36 | * 37 | * X-1.5 Camiel Vanderhoeven 30-JAN-2008 38 | * Always use set_pc or add_pc to change the program counter. 39 | * 40 | * X-1.4 Camiel Vanderhoeven 30-JAN-2008 41 | * Remember number of instructions left in current memory page, so 42 | * that the translation-buffer doens't need to be consulted on every 43 | * instruction fetch when the Icache is disabled. 44 | * 45 | * X-1.3 Camiel Vanderhoeven 11-APR-2007 46 | * Moved all data that should be saved to a state file to a structure 47 | * "state". 48 | * 49 | * X-1.2 Camiel Vanderhoeven 30-MAR-2007 50 | * Added old changelog comments. 51 | * 52 | * X-1.1 Camiel Vanderhoeven 18-FEB-2007 53 | * File created. Contains code previously found in AlphaCPU.h 54 | **/ 55 | #define DO_BEQ if(!state.r[REG_1]) \ 56 | add_pc(DISP_21 * 4); 57 | 58 | #define DO_BGE if((s64) state.r[REG_1] >= 0) \ 59 | add_pc(DISP_21 * 4); 60 | 61 | #define DO_BGT if((s64) state.r[REG_1] > 0) \ 62 | add_pc(DISP_21 * 4); 63 | 64 | #define DO_BLBC if(!(state.r[REG_1] & 1)) \ 65 | add_pc(DISP_21 * 4); 66 | 67 | #define DO_BLBS if(state.r[REG_1] & 1) \ 68 | add_pc(DISP_21 * 4); 69 | 70 | #define DO_BLE if((s64) state.r[REG_1] <= 0) \ 71 | add_pc(DISP_21 * 4); 72 | 73 | #define DO_BLT if((s64) state.r[REG_1] < 0) \ 74 | add_pc(DISP_21 * 4); 75 | 76 | #define DO_BNE if(state.r[REG_1]) \ 77 | add_pc(DISP_21 * 4); 78 | 79 | #define DO_BR \ 80 | { \ 81 | state.r[REG_1] = state.pc &~U64(0x3); \ 82 | add_pc(DISP_21 * 4); \ 83 | } 84 | 85 | #define DO_BSR DO_BR 86 | 87 | #define DO_JMP \ 88 | { \ 89 | temp_64 = state.r[REG_2] &~U64(0x3); \ 90 | state.r[REG_1] = state.pc &~U64(0x3); \ 91 | set_pc(temp_64 | (state.pc & 3)); \ 92 | } 93 | 94 | // JSR, RET and JSR_COROUTINE is really JMP, just with different prediction bits. 95 | -------------------------------------------------------------------------------- /src/Ethernet.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon GXemul, which is Copyright (C) 2004-2007 26 | * Anders Gavare. All rights reserved. 27 | */ 28 | 29 | /** 30 | * \file 31 | * Contains the definitions for the packet queue and other NIC support routines. 32 | * 33 | * $Id: Ethernet.h,v 1.3 2008/03/26 19:13:35 iamcamiel Exp $ 34 | * 35 | * X-1.3 Camiel Vanderhoeven 26-MAR-2008 36 | * Fix compiler warnings. 37 | * 38 | * X-1.2 Camiel Vanderhoeven 14-MAR-2008 39 | * Formatting. 40 | * 41 | * X-1.1 David Hittner 26-FEB-2008 42 | * File creation. 43 | **/ 44 | #if !defined(INCLUDED_ETHERNET_H) 45 | #define INCLUDED_ETHERNET_H 46 | 47 | #define ETH_MAX_PACKET_RAW 1514 48 | #define ETH_MAX_PACKET_CRC 1518 49 | 50 | struct eth_frame 51 | { // ethernet (wire) frame 52 | u8 src[6]; // source address 53 | u8 dst[6]; // destination address 54 | u8 protocol[2]; // protocol 55 | u8 data[1500]; // data: variable 46-1500 bytes 56 | u8 crc_fill[4]; // space for max packet crc 57 | }; 58 | 59 | struct eth_packet 60 | { // ethernet packet 61 | int len; // size of packet 62 | int used; // bytes used (consumed) 63 | u8 frame[ETH_MAX_PACKET_CRC]; // ethernet frame 64 | }; 65 | 66 | /** 67 | * \brief Packet Queue for Ethernet packets. 68 | **/ 69 | class CPacketQueue 70 | { // Ethernet Packet Queue 71 | 72 | //private: 73 | public: 74 | const char* name; // queue name 75 | int max; // maximum items allowed in queue 76 | int head; // first item in queue 77 | int tail; // last item in queue 78 | int cnt; // current item count 79 | int highwater; // highwater mark (statistics) 80 | int dropped; // packets dropped because queue was full 81 | eth_packet* packets; // packet array; dynamically allocated 82 | public: 83 | inline int count() { return cnt; } 84 | 85 | // get current count 86 | inline int lost() { return dropped; } 87 | 88 | // get number of lost packets 89 | void flush(); // empties packet queue 90 | bool add_tail(const u8* packet_data, int packet_len, bool calc_crc, 91 | bool need_crc); // adds pcap packet to queue 92 | bool get_head(eth_packet& packet); // get packet at head 93 | CPacketQueue(const char* name, int max); // constructor 94 | ~CPacketQueue(); // destructor 95 | }; 96 | #endif // !defined(INCLUDED_ETHERNET_H) 97 | -------------------------------------------------------------------------------- /src/base/RefCountedObject.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: RefCountedObject.cpp,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // RefCountedObject.cpp 38 | // 39 | // $Id: RefCountedObject.cpp,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Core 43 | // Module: RefCountedObject 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | #include "Mutex.h" 72 | #include "RefCountedObject.h" 73 | 74 | CRefCountedObject::CRefCountedObject(): _rc(1), _rcMutex("rc") 75 | { 76 | } 77 | 78 | 79 | CRefCountedObject::~CRefCountedObject() 80 | { 81 | } 82 | 83 | 84 | void CRefCountedObject::duplicate() const 85 | { 86 | _rcMutex.lock(); 87 | ++_rc; 88 | _rcMutex.unlock(); 89 | } 90 | 91 | 92 | void CRefCountedObject::release() const 93 | { 94 | _rcMutex.lock(); 95 | int rc = --_rc; 96 | _rcMutex.unlock(); 97 | if (rc == 0) delete this; 98 | } 99 | -------------------------------------------------------------------------------- /src/cpu_logical.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * Website: http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains code macros for the processor logical instructions. 29 | * Based on ARM chapter 4.5. 30 | * 31 | * $Id: cpu_logical.h,v 1.6 2008/03/14 15:30:52 iamcamiel Exp $ 32 | * 33 | * X-1.5 Camiel Vanderhoeven 14-MAR-2008 34 | * 1. More meaningful exceptions replace throwing (int) 1. 35 | * 2. U64 macro replaces X64 macro. 36 | * 37 | * X-1.4 Camiel Vanderhoeven 11-APR-2007 38 | * Moved all data that should be saved to a state file to a structure 39 | * "state". 40 | * 41 | * X-1.3 Camiel Vanderhoeven 30-MAR-2007 42 | * Added old changelog comments. 43 | * 44 | * X-1.2 Camiel Vanderhoeven 19-FEB-2007 45 | * Fixed a compiler-dependent bug (possible >> or <= 0) \ 63 | state.r[REG_3] = V_2; 64 | #define DO_CMOVGT if((s64) state.r[REG_1] > 0) \ 65 | state.r[REG_3] = V_2; 66 | #define DO_CMOVLBC if(!(state.r[REG_1] & U64(0x1))) \ 67 | state.r[REG_3] = V_2; 68 | #define DO_CMOVLBS if(state.r[REG_1] & U64(0x1)) \ 69 | state.r[REG_3] = V_2; 70 | #define DO_CMOVLE if((s64) state.r[REG_1] <= 0) \ 71 | state.r[REG_3] = V_2; 72 | #define DO_CMOVLT if((s64) state.r[REG_1] < 0) \ 73 | state.r[REG_3] = V_2; 74 | #define DO_CMOVNE if(state.r[REG_1]) \ 75 | state.r[REG_3] = V_2; 76 | 77 | #define DO_SLL state.r[REG_3] = state.r[REG_1] << (V_2 & 63); 78 | #define DO_SRA state.r[REG_3] = (V_2 & 63) ? \ 79 | ( \ 80 | (state.r[REG_1] >> (V_2 & 63)) | \ 81 | ((state.r[REG_1] >> 63) ? (X64_QUAD << (64 - (V_2 & 63))) : 0) \ 82 | ) : state.r[REG_1]; 83 | #define DO_SRL state.r[REG_3] = state.r[REG_1] >> (V_2 & 63); 84 | -------------------------------------------------------------------------------- /src/base/RWLock.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: RWLock.cpp,v 1.3 2008/06/12 06:58:24 iamcamiel Exp $ 31 | * 32 | * X-1.2 Caolan McNamara 12-JUN-2008 33 | * Fixes to build on Fedora 9 / gcc 4.3.0. 34 | * 35 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 36 | * Initial version for ES40 emulator. 37 | **/ 38 | 39 | // 40 | // RWLock.cpp 41 | // 42 | // $Id: RWLock.cpp,v 1.3 2008/06/12 06:58:24 iamcamiel Exp $ 43 | // 44 | // Library: Foundation 45 | // Package: Threading 46 | // Module: RWLock 47 | // 48 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 49 | // and Contributors. 50 | // 51 | // Permission is hereby granted, free of charge, to any person or organization 52 | // obtaining a copy of the software and accompanying documentation covered by 53 | // this license (the "Software") to use, reproduce, display, distribute, 54 | // execute, and transmit the Software, and to prepare derivative works of the 55 | // Software, and to permit third-parties to whom the Software is furnished to 56 | // do so, all subject to the following: 57 | // 58 | // The copyright notices in the Software and this entire statement, including 59 | // the above license grant, this restriction and the following disclaimer, 60 | // must be included in all copies of the Software, in whole or in part, and 61 | // all derivative works of the Software, unless such copies or derivative 62 | // works are solely in the form of machine-executable object code generated by 63 | // a source language processor. 64 | // 65 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 67 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 68 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 69 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 70 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 71 | // DEALINGS IN THE SOFTWARE. 72 | // 73 | 74 | 75 | #include "RWLock.h" 76 | #include 77 | 78 | #if defined(POCO_OS_FAMILY_WINDOWS) 79 | #include "RWLock_WIN32.cpp" 80 | #else 81 | #include "RWLock_POSIX.cpp" 82 | #endif 83 | 84 | CRWLock::CRWLock() 85 | { 86 | lockName = strdup("anon"); 87 | } 88 | 89 | CRWLock::CRWLock(const char* lName) 90 | { 91 | lockName = strdup(lName); 92 | } 93 | 94 | 95 | CRWLock::~CRWLock() 96 | { 97 | free(lockName); 98 | } 99 | -------------------------------------------------------------------------------- /src/base/Runnable.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Runnable.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Runnable.h 38 | // 39 | // $Id: Runnable.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Thread 44 | // 45 | // Definition of the Runnable class. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_Runnable_INCLUDED 75 | #define Foundation_Runnable_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | 80 | class CRunnable 81 | /// The Runnable interface with the run() method 82 | /// must be implemented by classes that provide 83 | /// an entry point for a thread. 84 | { 85 | public: 86 | CRunnable(); 87 | virtual ~CRunnable(); 88 | 89 | virtual void run() = 0; 90 | /// Do whatever the thread needs to do. Must 91 | /// be overridden by subclasses. 92 | }; 93 | 94 | #endif // Foundation_Runnable_INCLUDED 95 | -------------------------------------------------------------------------------- /src/base/Platform_POSIX.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Platform_POSIX.h,v 1.1 2008/05/31 15:47:25 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Platform_POSIX.h 38 | // 39 | // $Id: Platform_POSIX.h,v 1.1 2008/05/31 15:47:25 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Core 43 | // Module: Platform 44 | // 45 | // Platform and architecture identification macros 46 | // and platform-specific definitions for various POSIX platforms 47 | // 48 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 49 | // and Contributors. 50 | // 51 | // Permission is hereby granted, free of charge, to any person or organization 52 | // obtaining a copy of the software and accompanying documentation covered by 53 | // this license (the "Software") to use, reproduce, display, distribute, 54 | // execute, and transmit the Software, and to prepare derivative works of the 55 | // Software, and to permit third-parties to whom the Software is furnished to 56 | // do so, all subject to the following: 57 | // 58 | // The copyright notices in the Software and this entire statement, including 59 | // the above license grant, this restriction and the following disclaimer, 60 | // must be included in all copies of the Software, in whole or in part, and 61 | // all derivative works of the Software, unless such copies or derivative 62 | // works are solely in the form of machine-executable object code generated by 63 | // a source language processor. 64 | // 65 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 67 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 68 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 69 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 70 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 71 | // DEALINGS IN THE SOFTWARE. 72 | // 73 | 74 | 75 | #ifndef Foundation_Platform_POSIX_INCLUDED 76 | #define Foundation_Platform_POSIX_INCLUDED 77 | 78 | 79 | // 80 | // PA-RISC based HP-UX platforms have some issues... 81 | // 82 | #if defined(hpux) || defined(_hpux) 83 | #if defined(__hppa) || defined(__hppa__) 84 | #define POCO_NO_SYS_SELECT_H 1 85 | #if defined(__HP_aCC) 86 | #define POCO_NO_TEMPLATE_ICOMPARE 1 87 | #endif 88 | #endif 89 | #endif 90 | 91 | 92 | #endif // Foundation_Platform_POSIX_INCLUDED 93 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | ################################################################################ 3 | # ES40 emulator. 4 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 5 | # 6 | # Website: http://www.es40.org 7 | # E-mail : camiel@es40.org 8 | # 9 | # This program is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License 11 | # as published by the Free Software Foundation; either version 2 12 | # of the License, or (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 | # 02110-1301, USA. 23 | # 24 | # Although this is not required, the author would appreciate being notified of, 25 | # and receiving any modifications you may make to the source code that might serve 26 | # the general public. 27 | # 28 | ################################################################################ 29 | # 30 | # $Id: configure.ac,v 1.5 2008/05/31 15:47:07 iamcamiel Exp $ 31 | # 32 | # X-1.3 Camiel Vanderhoeven 31-MAY-2008 33 | # Add parts of Poco. 34 | # 35 | # X-1.2 Camiel Vanderhoeven 04-APR-2008 36 | # Version number set to "0.18+" 37 | # 38 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 39 | # File Created. 40 | # 41 | ################################################################################ 42 | # 43 | # Process this file with autoconf to produce a configure script. 44 | 45 | AC_PREREQ(2.61) 46 | AC_INIT([es40], [0.18+], [iamcamiel@gmail.com]) 47 | AC_CONFIG_SRCDIR([src/Flash.cpp]) 48 | AC_CONFIG_HEADERS([src/config.h]) 49 | AM_INIT_AUTOMAKE([subdir-objects]) 50 | 51 | # Checks for programs. 52 | AC_PROG_CXX 53 | AC_PROG_CC 54 | 55 | # Checks for libraries. 56 | 57 | SDL_VERSION=1.2.0 58 | AM_PATH_SDL($SDL_VERSION, 59 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS -DHAVE_SDL" 60 | LIBS="$LIBS $SDL_LIBS" 61 | ,:) 62 | 63 | AM_PATH_PCAP( 64 | CXXFLAGS="$CXXFLAGS $PCAP_CFLAGS -DHAVE_PCAP" 65 | LIBS="$LIBS $PCAP_LIBS" 66 | ,:) 67 | 68 | AM_PATH_X11( 69 | CXXFLAGS="$CXXFLAGS $X11_CFLAGS -DHAVE_X11" 70 | LIBS="$LIBS $X11_LIBS" 71 | ,:) 72 | 73 | ACX_PTHREAD 74 | CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" 75 | LIBS="$LIBS $PTHREAD_LIBS" 76 | 77 | # Checks for header files. 78 | AC_HEADER_STDC 79 | AC_HEADER_SYS_WAIT 80 | AC_CHECK_HEADERS([arpa/inet.h arpa/telnet.h ctype.h errno.h fcntl.h in.h inet.h inttypes.h malloc.h netinet/in.h process.h pthread.h signal.h socket.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h windows.h winsock2.h ws2tcpip.h]) 81 | 82 | # Checks for typedefs, structures, and compiler characteristics. 83 | AC_HEADER_STDBOOL 84 | AC_C_CONST 85 | AC_C_INLINE 86 | AC_TYPE_INT16_T 87 | AC_TYPE_INT32_T 88 | AC_TYPE_INT64_T 89 | AC_TYPE_INT8_T 90 | AC_TYPE_PID_T 91 | AC_TYPE_SIZE_T 92 | AC_TYPE_SSIZE_T 93 | AC_HEADER_TIME 94 | AC_STRUCT_TM 95 | AC_TYPE_UINT16_T 96 | AC_TYPE_UINT32_T 97 | AC_TYPE_UINT64_T 98 | AC_TYPE_UINT8_T 99 | 100 | # Checks for library functions. 101 | AC_FUNC_ERROR_AT_LINE 102 | AC_FUNC_FORK 103 | AC_FUNC_MALLOC 104 | AC_FUNC_REALLOC 105 | AC_FUNC_SELECT_ARGTYPES 106 | AC_TYPE_SIGNAL 107 | AC_CHECK_FUNCS([alarm atexit fopen fopen64 fseek fseeko fseeko64 _fseeki64 ftell ftello ftello64 _ftelli64 gmtime_s inet_aton isblank memset pow select socket sqrt strcasecmp _stricmp strchr strdup _strdup strncasecmp _stricasecmp strspn]) 108 | 109 | AC_OUTPUT(Makefile doc/Makefile m4/Makefile src/Makefile) 110 | -------------------------------------------------------------------------------- /src/NumberQuestion.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * NumberQuestion class for Configuration file creator. 29 | * 30 | * $Id: NumberQuestion.h,v 1.1 2008/03/28 21:56:58 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 28-MAR-2008 33 | * File created. 34 | **/ 35 | 36 | /** 37 | * Convert an integer to a string. 38 | **/ 39 | inline string i2s(int x) 40 | { 41 | ostringstream o; 42 | o << x; 43 | return o.str(); 44 | } 45 | 46 | /** 47 | * Convert a string to an integer. 48 | * 49 | * Throws a CLogicException when the input is not numeric. 50 | **/ 51 | inline int s2i(const string x) 52 | { 53 | istringstream i(x); 54 | int x1; 55 | char c; 56 | if (!(i >> x1) || i.get(c)) 57 | FAILURE(Logic,"invalid conversion");; 58 | return x1; 59 | } 60 | 61 | /** 62 | * Question class that accepts a numeric answer within 63 | * a defined range. 64 | **/ 65 | class NumberQuestion: public FreeTextQuestion 66 | { 67 | public: 68 | /** 69 | * Define the allowable range for the answer. 70 | **/ 71 | void setRange(int low, int high) 72 | { 73 | mLow = low; mHigh = high; 74 | } 75 | 76 | /** 77 | * Convert the answer to a number. 78 | **/ 79 | int getNum() 80 | { 81 | return s2i(mAnswer); 82 | } 83 | 84 | /** 85 | * Ask the question and return the answer. 86 | **/ 87 | virtual string ask() 88 | { 89 | /* Set the options list to (low-high). 90 | */ 91 | setOptions(i2s(mLow) + "-" + i2s(mHigh)); 92 | 93 | /* Keep repeating the question until a valid 94 | * answer is received. 95 | */ 96 | for (;;) 97 | { 98 | int value; 99 | 100 | /* Ask the question as a FreeTextQuestion. This 101 | * takes care of the explanation and default 102 | * value handling. 103 | */ 104 | FreeTextQuestion::ask(); 105 | 106 | try 107 | { 108 | /* Convert the answer to an integer. 109 | */ 110 | value = s2i(mAnswer); 111 | 112 | /* If the answer is within the allowed range, 113 | * return it. 114 | */ 115 | if ( value >= mLow && value <= mHigh) 116 | return mAnswer; 117 | 118 | /* The answer is out of range. 119 | */ 120 | cout << "\nPlease enter a value that is within the indicated range, or '?' for help.\n\n"; 121 | } 122 | catch(CLogicException) 123 | { 124 | /* The answer is not a number. 125 | */ 126 | cout << "\nPlease enter an integer value.\n\n"; 127 | } 128 | } 129 | } 130 | 131 | protected: 132 | /** Low limit of the allowed range. */ 133 | int mLow; 134 | /** High limit of the allowed range. */ 135 | int mHigh; 136 | }; 137 | -------------------------------------------------------------------------------- /m4/libpcap.m4: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://sourceforge.net/projects/es40 6 | # E-mail : camiel@camicom.com 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: libpcap.m4,v 1.1 2008/03/20 07:49:55 iamcamiel Exp $ 30 | # 31 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 32 | # File Created. 33 | # 34 | ################################################################################ 35 | # 36 | # Check if libpcap is installed, and configure paths 37 | 38 | dnl AM_PATH_PCAP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 39 | dnl Test for PCAP, and define PCAP_CFLAGS and PCAP_LIBS 40 | dnl 41 | 42 | AC_DEFUN([ES_PCAP_INC_WHERE1], [ 43 | ac_cv_found_pcap_inc=no 44 | if test -f "$1/pcap.h" ; then 45 | ac_cv_found_pcap_inc=yes 46 | fi 47 | ]) 48 | 49 | AC_DEFUN([ES_PCAP_INC_WHERE], [ 50 | for i in $1; do 51 | AC_MSG_CHECKING(for pcap header in $i) 52 | ES_PCAP_INC_WHERE1($i) 53 | if test "$ac_cv_found_pcap_inc" = "yes"; then 54 | ac_cv_pcap_where_inc=$i 55 | AC_MSG_RESULT(found) 56 | break 57 | else 58 | AC_MSG_RESULT(not here) 59 | fi 60 | done 61 | ]) 62 | 63 | AC_DEFUN([ES_PCAP_LIB_WHERE1], [ 64 | saved_LIBS=$LIBS 65 | LIBS="$saved_LIBS -L$1 -lpcap" 66 | AC_TRY_LINK(, 67 | [pcap_lookupdev("");], 68 | [ac_cv_found_pcap_lib=yes], 69 | ac_cv_found_pcap_lib=no) 70 | LIBS=$saved_LIBS 71 | ]) 72 | 73 | AC_DEFUN([ES_PCAP_LIB_WHERE], [ 74 | for i in $1; do 75 | AC_MSG_CHECKING(for pcap library in $i) 76 | ES_PCAP_LIB_WHERE1($i) 77 | if test "$ac_cv_found_pcap_lib" = "yes"; then 78 | ac_cv_pcap_where_lib=$i 79 | AC_MSG_RESULT(found) 80 | break 81 | else 82 | AC_MSG_RESULT(not here) 83 | fi 84 | done 85 | ]) 86 | 87 | 88 | AC_DEFUN([AM_PATH_PCAP], 89 | [dnl 90 | dnl Get the cflags and libraries for libpcap 91 | dnl 92 | 93 | ES_PCAP_LIB_WHERE(/usr/ng/lib /usr/lib /usr/local/lib /opt/local/lib) 94 | ES_PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include /opt/local/include) 95 | 96 | AC_MSG_CHECKING(whether pcap is available) 97 | 98 | if test "X$ac_cv_pcap_where_lib" = "X" -o "X$ac_cv_pcap_where_inc" = "X"; then 99 | ac_cv_found_pcap=no 100 | AC_MSG_RESULT(no) 101 | PCAP_CFLAGS="" 102 | PCAP_LIBS="" 103 | ifelse([$2], , :, [$2]) 104 | else 105 | ac_cv_found_pcap=yes 106 | AC_MSG_RESULT(yes) 107 | PCAP_INC_DIR=$ac_cv_pcap_where_inc 108 | PCAP_LIB_DIR=$ac_cv_pcap_where_lib 109 | PCAP_CFLAGS="-I${PCAP_INC_DIR}" 110 | if test "X$PCAP_LIB_DIR" = "X"; then 111 | PCAP_LIBS="-lpcap" 112 | else 113 | PCAP_LIBS="-L${PCAP_LIB_DIR} -lpcap" 114 | fi 115 | ifelse([$1], , :, [$1]) 116 | fi 117 | AC_SUBST(PCAP_CFLAGS) 118 | AC_SUBST(PCAP_LIBS) 119 | ]) 120 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://www.es40.org 6 | # E-mail : camiel@es40.org 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: Makefile.am,v 1.6 2008/06/12 06:54:21 iamcamiel Exp $ 30 | # 31 | # X-1.6 Caolan McNamara 12-JUN-2008 32 | # Fixes to build on Fedora 9 / gcc 4.3.0. 33 | # 34 | # X-1.5 Camiel Vanderhoeven 31-MAY-2008 35 | # Add parts of Poco. 36 | # 37 | # X-1.4 Camiel Vanderhoeven 04-APR-2008 38 | # Added comments. 39 | # 40 | # X-1.3 Camiel Vanderhoeven 29-MAR-2008 41 | # Added es40_cfg. 42 | # 43 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 44 | # File Created. 45 | # 46 | ################################################################################ 47 | 48 | bin_PROGRAMS = es40 es40_idb es40_lss es40_lsm es40_cfg 49 | 50 | es40_SOURCES = AliM1543C.cpp \ 51 | AliM1543C_ide.cpp \ 52 | AliM1543C_usb.cpp \ 53 | AlphaCPU.cpp \ 54 | AlphaCPU_ieeefloat.cpp \ 55 | AlphaCPU_vaxfloat.cpp \ 56 | AlphaCPU_vmspal.cpp \ 57 | AlphaSim.cpp \ 58 | Cirrus.cpp \ 59 | Configurator.cpp \ 60 | DEC21143.cpp \ 61 | Disk.cpp \ 62 | DiskController.cpp \ 63 | DiskDevice.cpp \ 64 | DiskFile.cpp \ 65 | DiskRam.cpp \ 66 | DMA.cpp \ 67 | DPR.cpp \ 68 | es40_debug.cpp \ 69 | Ethernet.cpp \ 70 | Flash.cpp \ 71 | FloppyController.cpp \ 72 | Keyboard.cpp \ 73 | lockstep.cpp \ 74 | PCIDevice.cpp \ 75 | Port80.cpp \ 76 | S3Trio64.cpp \ 77 | SCSIBus.cpp \ 78 | SCSIDevice.cpp \ 79 | Serial.cpp \ 80 | StdAfx.cpp \ 81 | Sym53C810.cpp \ 82 | Sym53C895.cpp \ 83 | SystemComponent.cpp \ 84 | System.cpp \ 85 | TraceEngine.cpp \ 86 | VGA.cpp \ 87 | gui/gui.cpp \ 88 | gui/gui_x11.cpp \ 89 | gui/keymap.cpp \ 90 | gui/scancodes.cpp \ 91 | gui/sdl.cpp \ 92 | base/Bugcheck.cpp \ 93 | base/ErrorHandler.cpp \ 94 | base/Event.cpp \ 95 | base/Exception.cpp \ 96 | base/Mutex.cpp \ 97 | base/NumberFormatter.cpp \ 98 | base/RefCountedObject.cpp \ 99 | base/Runnable.cpp \ 100 | base/RWLock.cpp \ 101 | base/Semaphore.cpp \ 102 | base/SignalHandler.cpp \ 103 | base/ThreadLocal.cpp \ 104 | base/Thread.cpp \ 105 | base/Timestamp.cpp 106 | 107 | es40_idb_SOURCES = $(es40_SOURCES) 108 | es40_lss_SOURCES = $(es40_SOURCES) 109 | es40_lsm_SOURCES = $(es40_SOURCES) 110 | 111 | es40_idb_CXXFLAGS = -DIDB 112 | es40_lss_CXXFLAGS = -DIDB -DLSS 113 | es40_lsm_CXXFLAGS = -DIDB -DLSM 114 | 115 | es40_cfg_SOURCES = es40-cfg.cpp \ 116 | base/Exception.cpp 117 | 118 | -------------------------------------------------------------------------------- /src/Flash.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * Website: http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains the definitions for the emulated Flash ROM devices. 29 | * 30 | * $Id: Flash.h,v 1.12 2008/03/14 15:30:51 iamcamiel Exp $ 31 | * 32 | * X-1.11 Camiel Vanderhoeven 02-JAN-2008 33 | * Comments. 34 | * 35 | * X-1.10 Camiel Vanderhoeven 17-DEC-2007 36 | * SaveState file format 2.1 37 | * 38 | * X-1.9 Camiel Vanderhoeven 10-DEC-2007 39 | * Changes to make the TraceEngine work again after recent changes. 40 | * 41 | * X-1.8 Camiel Vanderhoeven 10-DEC-2007 42 | * Use configurator. 43 | * 44 | * X-1.7 Camiel Vanderhoeven 30-MAR-2007 45 | * Added old changelog comments. 46 | * 47 | * X-1.6 Camiel Vanderhoeven 16-FEB-2007 48 | * Added SaveStateF and RestoreStateF functions. 49 | * 50 | * X-1.5 Camiel Vanderhoeven 12-FEB-2007 51 | * Formatting. 52 | * 53 | * X-1.4 Camiel Vanderhoeven 12-FEB-2007 54 | * Added comments. 55 | * 56 | * X-1.3 Camiel Vanderhoeven 7-FEB-2007 57 | * Added comments. 58 | * 59 | * X-1.2 Brian Wheeler 3-FEB-2007 60 | * Formatting. 61 | * 62 | * X-1.1 Camiel Vanderhoeven 19-JAN-2007 63 | * Initial version in CVS. 64 | * 65 | * 66 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 67 | **/ 68 | #if !defined(INCLUDED_FLASH_H) 69 | #define INCLUDED_FLASH_H 70 | 71 | #include "SystemComponent.h" 72 | 73 | /** 74 | * \brief Emulated flash memory. 75 | * 76 | * Flash memory is only used for storing configuration data (such as SRM console variables), 77 | * it is not used for firmware. 78 | **/ 79 | class CFlash : public CSystemComponent 80 | { 81 | public: 82 | virtual void WriteMem(int index, u64 address, int dsize, u64 data); 83 | virtual u64 ReadMem(int index, u64 address, int dsize); 84 | CFlash(CConfigurator* cfg, class CSystem* c); 85 | virtual ~CFlash(); 86 | virtual int SaveState(FILE* f); 87 | virtual int RestoreState(FILE* f); 88 | void SaveStateF(); 89 | void RestoreStateF(); 90 | void SaveStateF(char* fn); 91 | void RestoreStateF(char* fn); 92 | protected: 93 | 94 | /// The state structure contains all elements that need to be saved to the statefile. 95 | struct SFlash_state 96 | { 97 | u8 Flash[2 * 1024 * 1024]; 98 | int mode; 99 | } state; 100 | }; 101 | 102 | extern CFlash* theSROM; 103 | #endif // !defined(INCLUDED_FLASH_H) 104 | -------------------------------------------------------------------------------- /src/DPR.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * Website: http://sourceforge.net/projects/es40 5 | * E-mail : camiel@camicom.com 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains the definitions for the emulated Dual Port Ram and RMC devices. 29 | * 30 | * $Id: DPR.h,v 1.13 2008/03/14 15:30:51 iamcamiel Exp $ 31 | * 32 | * X-1.12 Camiel Vanderhoeven 13-MAR-2008 33 | * Create init(), start_threads() and stop_threads() functions. 34 | * 35 | * X-1.11 Camiel Vanderhoeven 05-MAR-2008 36 | * Multi-threading version. 37 | * 38 | * X-1.10 Camiel Vanderhoeven 02-JAN-2008 39 | * Comments. 40 | * 41 | * X-1.9 Camiel Vanderhoeven 17-DEC-2007 42 | * SaveState file format 2.1 43 | * 44 | * X-1.8 Camiel Vanderhoeven 10-DEC-2007 45 | * Changes to make the TraceEngine work again after recent changes. 46 | * 47 | * X-1.7 Camiel Vanderhoeven 10-DEC-2007 48 | * Use configurator. 49 | * 50 | * X-1.6 Camiel Vanderhoeven 30-MAR-2007 51 | * Added old changelog comments. 52 | * 53 | * X-1.5 Camiel Vanderhoeven 16-FEB-2007 54 | * Added functions SaveStateF and RestoreStateF. 55 | * 56 | * X-1.4 Camiel Vanderhoeven 7-FEB-2007 57 | * Added comments. 58 | * 59 | * X-1.3 Camiel Vanderhoeven 7-FEB-2007 60 | * Added comments. 61 | * 62 | * X-1.2 Brian Wheeler 3-FEB-2007 63 | * Formatting. 64 | * 65 | * X-1.1 Camiel Vanderhoeven 19-JAN-2007 66 | * Initial version in CVS. 67 | * 68 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 69 | **/ 70 | #if !defined(INCLUDED_DPR_H) 71 | #define INCLUDED_DPR_H 72 | 73 | #include "SystemComponent.h" 74 | 75 | /** 76 | * \brief Emulated dual-port RAM and management controller. 77 | **/ 78 | class CDPR : public CSystemComponent 79 | { 80 | public: 81 | CDPR(CConfigurator* cfg, class CSystem* c); 82 | virtual ~CDPR(); 83 | virtual void init(); 84 | virtual void WriteMem(int index, u64 address, int dsize, u64 data); 85 | virtual u64 ReadMem(int index, u64 address, int dsize); 86 | virtual int SaveState(FILE* f); 87 | virtual int RestoreState(FILE* f); 88 | void SaveStateF(); 89 | void RestoreStateF(); 90 | void SaveStateF(char* fn); 91 | void RestoreStateF(char* fn); 92 | protected: 93 | 94 | /// The state structure contains all elements that need to be saved to the statefile. 95 | struct SDPR_state 96 | { 97 | u8 ram[16 * 1024]; 98 | } state; 99 | }; 100 | 101 | extern CDPR* theDPR; 102 | #endif // !defined(INCLUDED_DPR_H_) 103 | -------------------------------------------------------------------------------- /src/base/RWLock_WIN32.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: RWLock_WIN32.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // RWLock_WIN32.h 38 | // 39 | // $Id: RWLock_WIN32.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: RWLock 44 | // 45 | // Definition of the RWLockImpl class for WIN32. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_RWLock_WIN32_INCLUDED 75 | #define Foundation_RWLock_WIN32_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | #include "Exception.h" 80 | #include "UnWindows.h" 81 | 82 | 83 | class CRWLockImpl 84 | { 85 | protected: 86 | CRWLockImpl(); 87 | ~CRWLockImpl(); 88 | void readLockImpl(); 89 | bool tryReadLockImpl(); 90 | void writeLockImpl(); 91 | bool tryWriteLockImpl(); 92 | void unlockImpl(); 93 | 94 | private: 95 | void addWriter(); 96 | void removeWriter(); 97 | 98 | HANDLE _mutex; 99 | HANDLE _readEvent; 100 | HANDLE _writeEvent; 101 | unsigned _readers; 102 | unsigned _writers; 103 | }; 104 | 105 | #endif // Foundation_RWLock_WIN32_INCLUDED 106 | -------------------------------------------------------------------------------- /src/config_debug.h: -------------------------------------------------------------------------------- 1 | // This is config_debug.h 2 | // 3 | // This file contains the debug configuration options. 4 | // This file was generated by configure_1.sh 5 | // 6 | // $Id$ 7 | 8 | // Define to 1 if you want to show the cycle counter 9 | #define HIDE_COUNTER 1 10 | 11 | // Define to 1 if you want to show estimate speed 12 | #undef MIPS_ESTIMATE 13 | 14 | // Define to 1 if you want to show memory map 15 | #undef DUMP_MEMMAP 16 | 17 | // Define to 1 if you want to check for overlapping of memory ranges 18 | #define CHECK_MEM_RANGES 1 19 | 20 | // Define to 1 if you want to use the new floating-point implementation 21 | #undef HAVE_NEW_FP 22 | 23 | // Define to 1 if you want to enable VGA debugging 24 | #undef DEBUG_VGA 25 | 26 | // Define to 1 if you want to enable Serial Port debugging 27 | #undef DEBUG_SERIAL 28 | 29 | // Define to 1 if you want to enable IDE General debugging 30 | #undef DEBUG_IDE 31 | 32 | // Define to 1 if you want to enable IDE Busmaster debugging 33 | #undef DEBUG_IDE_BUSMASTER 34 | 35 | // Define to 1 if you want to enable IDE Command debugging 36 | #undef DEBUG_IDE_COMMAND 37 | 38 | // Define to 1 if you want to enable IDE CMD debugging 39 | #undef DEBUG_IDE_CMD 40 | 41 | // Define to 1 if you want to enable IDE DMA debugging 42 | #undef DEBUG_IDE_DMA 43 | 44 | // Define to 1 if you want to enable IDE Interrupt debugging 45 | #undef DEBUG_IDE_INTERRUPT 46 | 47 | // Define to 1 if you want to enable IDE Command Register debugging 48 | #undef DEBUG_IDE_REG_COMMAND 49 | 50 | // Define to 1 if you want to enable IDE Control Register debugging 51 | #undef DEBUG_IDE_REG_CONTROL 52 | 53 | // Define to 1 if you want to enable IDE ATAPI Packet debugging 54 | #undef DEBUG_IDE_PACKET 55 | 56 | // Define to 1 if you want to enable IDE Thread debugging 57 | #undef DEBUG_IDE_THREADS 58 | 59 | // Define to 1 if you want to enable IDE Mutexes debugging 60 | #undef DEBUG_IDE_LOCKS 61 | 62 | // Define to 1 if you want to enable IDE Multiple debugging 63 | #undef DEBUG_IDE_MULTIPLE 64 | 65 | // Define to 1 if you want to enable Floating Point conversions debugging 66 | #undef DEBUG_FP_CONVERSION 67 | 68 | // Define to 1 if you want to enable Floating Point load/store debugging 69 | #undef DEBUG_FP_LOADSTORE 70 | 71 | // Define to 1 if you want to enable General NIC debugging 72 | #undef DEBUG_NIC 73 | 74 | // Define to 1 if you want to enable NIC Filter debugging 75 | #undef DEBUG_NIC_FILTER 76 | 77 | // Define to 1 if you want to enable NIC Serial ROM debugging 78 | #undef DEBUG_NIC_SROM 79 | 80 | // Define to 1 if you want to enable unknown memory access debugging 81 | #undef DEBUG_UNKMEM 82 | 83 | // Define to 1 if you want to enable PCI debugging 84 | #undef DEBUG_PCI 85 | 86 | // Define to 1 if you want to enable Translationbuffer debugging 87 | #undef DEBUG_TB 88 | 89 | // Define to 1 if you want to enable I/O Port Access debugging 90 | #undef DEBUG_PORTACCESS 91 | 92 | // Define to 1 if you want to enable Keyboard debugging 93 | #undef DEBUG_KBD 94 | 95 | // Define to 1 if you want to enable Programmable Interrupt Controller (PIC) debugging 96 | #undef DEBUG_PIC 97 | 98 | // Define to 1 if you want to enable Printer port debugging 99 | #undef DEBUG_LPT 100 | 101 | // Define to 1 if you want to enable USB Controller debugging 102 | #undef DEBUG_USB 103 | 104 | // Define to 1 if you want to enable SCSI Device debugging 105 | #undef DEBUG_SCSI 106 | 107 | // Define to 1 if you want to enable Symbios SCSI Controller debugging 108 | #undef DEBUG_SYM 109 | 110 | // Define to 1 if you want to enable Symbios Registers debugging 111 | #undef DEBUG_SYM_REGS 112 | 113 | // Define to 1 if you want to enable Symbios SCRIPTS Execution debugging 114 | #undef DEBUG_SYM_SCRIPTS 115 | 116 | // Define to 1 if you want to enable DMA Controller debugging 117 | #undef DEBUG_DMA 118 | 119 | // Define to 1 if you want to enable backtrace on SIGSEGV debugging 120 | #undef DEBUG_BACKTRACE 121 | 122 | // Define to 1 if you want to enable mutex debugging 123 | #undef DEBUG_LOCKS 124 | 125 | // Define to 1 if you want to enable SDL Key translation debugging 126 | #undef DEBUG_SDL_KEY 127 | -------------------------------------------------------------------------------- /src/base/Mutex.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Mutex.cpp,v 1.2 2008/06/12 06:52:33 iamcamiel Exp $ 31 | * 32 | * X-1.2 Caolan McNamara 12-JUN-2008 33 | * Fixes to build on Fedora 9 / gcc 4.3.0. 34 | * 35 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 36 | * Initial version for ES40 emulator. 37 | **/ 38 | 39 | // 40 | // Mutex.cpp 41 | // 42 | // $Id: Mutex.cpp,v 1.2 2008/06/12 06:52:33 iamcamiel Exp $ 43 | // 44 | // Library: Foundation 45 | // Package: Threading 46 | // Module: Mutex 47 | // 48 | // Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. 49 | // and Contributors. 50 | // 51 | // Permission is hereby granted, free of charge, to any person or organization 52 | // obtaining a copy of the software and accompanying documentation covered by 53 | // this license (the "Software") to use, reproduce, display, distribute, 54 | // execute, and transmit the Software, and to prepare derivative works of the 55 | // Software, and to permit third-parties to whom the Software is furnished to 56 | // do so, all subject to the following: 57 | // 58 | // The copyright notices in the Software and this entire statement, including 59 | // the above license grant, this restriction and the following disclaimer, 60 | // must be included in all copies of the Software, in whole or in part, and 61 | // all derivative works of the Software, unless such copies or derivative 62 | // works are solely in the form of machine-executable object code generated by 63 | // a source language processor. 64 | // 65 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 66 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 67 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 68 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 69 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 70 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 71 | // DEALINGS IN THE SOFTWARE. 72 | // 73 | 74 | #include "Mutex.h" 75 | #include 76 | 77 | #if defined(POCO_OS_FAMILY_WINDOWS) 78 | #include "Mutex_WIN32.cpp" 79 | #else 80 | #include "Mutex_POSIX.cpp" 81 | #endif 82 | 83 | CMutex::CMutex() 84 | { 85 | lockName = strdup("anon"); 86 | } 87 | 88 | CMutex::CMutex(const char* lName) 89 | { 90 | lockName = strdup(lName); 91 | } 92 | 93 | 94 | CMutex::~CMutex() 95 | { 96 | free(lockName); 97 | } 98 | 99 | CFastMutex::CFastMutex() 100 | { 101 | lockName = strdup("anon"); 102 | } 103 | 104 | CFastMutex::CFastMutex(const char* lName) 105 | { 106 | lockName = strdup(lName); 107 | } 108 | 109 | 110 | CFastMutex::~CFastMutex() 111 | { 112 | free(lockName); 113 | } 114 | -------------------------------------------------------------------------------- /src/base/Semaphore_WIN32.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Semaphore_WIN32.h,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Semaphore_WIN32.h 38 | // 39 | // $Id: Semaphore_WIN32.h,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Semaphore 44 | // 45 | // Definition of the SemaphoreImpl class for WIN32. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_Semaphore_WIN32_INCLUDED 75 | #define Foundation_Semaphore_WIN32_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | #include "Exception.h" 80 | #include "UnWindows.h" 81 | 82 | class CSemaphoreImpl 83 | { 84 | protected: 85 | CSemaphoreImpl(int n, int max); 86 | ~CSemaphoreImpl(); 87 | void setImpl(); 88 | void waitImpl(); 89 | bool waitImpl(long milliseconds); 90 | 91 | private: 92 | HANDLE _sema; 93 | }; 94 | 95 | 96 | // 97 | // inlines 98 | // 99 | inline void CSemaphoreImpl::setImpl() 100 | { 101 | if (!ReleaseSemaphore(_sema, 1, NULL)) 102 | { 103 | throw CSystemException("cannot signal semaphore"); 104 | } 105 | } 106 | 107 | #endif // Foundation_Semaphore_WIN32_INCLUDED 108 | -------------------------------------------------------------------------------- /src/base/ScopedLock.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: ScopedLock.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // ScopedLock.h 38 | // 39 | // $Id: ScopedLock.h,v 1.1 2008/05/31 15:47:27 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Mutex 44 | // 45 | // Definition of the ScopedLock template class. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_ScopedLock_INCLUDED 75 | #define Foundation_ScopedLock_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | 80 | /** 81 | * \brief A class that simplifies thread synchronization with a mutex or fastmutex. 82 | * 83 | * The constructor accepts a Mutex and locks it. 84 | * The destructor unlocks the mutex. 85 | **/ 86 | template 87 | class CScopedLock 88 | { 89 | public: 90 | inline CScopedLock(M* mutex): _mutex(mutex) 91 | { 92 | _mutex->lock(LOCK_TIMEOUT_MS); 93 | } 94 | inline ~CScopedLock() 95 | { 96 | _mutex->unlock(); 97 | } 98 | 99 | private: 100 | M* _mutex; 101 | 102 | CScopedLock(); 103 | CScopedLock(const CScopedLock&); 104 | CScopedLock& operator = (const CScopedLock&); 105 | }; 106 | 107 | #endif // Foundation_ScopedLock_INCLUDED 108 | -------------------------------------------------------------------------------- /src/DMA.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains the definitions for the emulated DMA controller. 29 | * 30 | * $Id: DMA.h,v 1.6 2008/04/29 09:26:53 iamcamiel Exp $ 31 | * 32 | * X-1.5 Camiel Vanderhoeven 29-APR-2008 33 | * Removed unused reference to floppy disk image. 34 | * 35 | * X-1.4 Brian Wheeler 29-APR-2008 36 | * Fixed floppy disk implementation. 37 | * 38 | * X-1.3 Brian Wheeler 18-APR-2008 39 | * Rewrote DMA code to make it ready for floppy support. 40 | * 41 | * X-1.2 Camiel Vanderhoeven 14-MAR-2008 42 | * Formatting. 43 | * 44 | * X-1.1 Camiel Vanderhoeven 26-FEB-2008 45 | * Created. Contains code previously found in AliM1543C.h 46 | * 47 | * \author Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com) 48 | **/ 49 | #if !defined(INCLUDED_DMA_H) 50 | #define INCLUDED_DMA_H 51 | 52 | #include "SystemComponent.h" 53 | 54 | /** 55 | * \brief Emulated DMA controller. 56 | **/ 57 | 58 | 59 | class CDMA : public CSystemComponent 60 | { 61 | public: 62 | CDMA(CConfigurator* cfg, CSystem* c); 63 | virtual ~CDMA(); 64 | 65 | virtual int DoClock(); 66 | virtual void WriteMem(int index, u64 address, int dsize, u64 data); 67 | virtual u64 ReadMem(int index, u64 address, int dsize); 68 | virtual int SaveState(FILE* f); 69 | virtual int RestoreState(FILE* f); 70 | 71 | void set_request(int index, int channel, int data); 72 | void send_data(int channel, void *data); 73 | void recv_data(int channel, void *data); 74 | int get_count(int channel) { return state.channel[channel].count; }; 75 | 76 | private: 77 | void do_dma(); 78 | 79 | /// The state structure contains all elements that need to be saved to the statefile. 80 | struct SDMA_state 81 | { 82 | /// DMA channel state 83 | struct SDMA_chan 84 | { 85 | bool a_lobyte; // address lobyte expected 86 | bool c_lobyte; // count lobyte expected 87 | u16 current; 88 | u16 base; 89 | u16 pagebase; 90 | u16 count; 91 | u8 mode; 92 | } channel[8]; 93 | 94 | /// DMA controller state 95 | struct SDMA_ctrl 96 | { 97 | u8 status; 98 | u8 command; 99 | u8 request; 100 | u8 mask; 101 | } controller[2]; 102 | } 103 | state; 104 | }; 105 | 106 | #define DMA_IO_BASE 0x1000 107 | #define DMA0_IO_MAIN DMA_IO_BASE + 0 108 | #define DMA1_IO_MAIN DMA_IO_BASE + 1 109 | #define DMA_IO_LPAGE DMA_IO_BASE + 2 110 | #define DMA_IO_HPAGE DMA_IO_BASE + 3 111 | #define DMA0_IO_CHANNEL DMA_IO_BASE + 4 112 | #define DMA1_IO_CHANNEL DMA_IO_BASE + 5 113 | #define DMA0_IO_EXT DMA_IO_BASE + 6 114 | #define DMA1_IO_EXT DMA_IO_BASE + 7 115 | 116 | extern CDMA *theDMA; 117 | 118 | #endif // !defined(INCLUDED_DMA_H) 119 | -------------------------------------------------------------------------------- /src/base/Event_WIN32.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Event_WIN32.cpp,v 1.1 2008/05/31 15:47:21 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Event_WIN32.cpp 38 | // 39 | // $Id: Event_WIN32.cpp,v 1.1 2008/05/31 15:47:21 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Event 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Event_WIN32.h" 73 | 74 | 75 | CEventImpl::CEventImpl(bool autoReset) 76 | { 77 | _event = CreateEventW(NULL, autoReset ? FALSE : TRUE, FALSE, NULL); 78 | if (!_event) 79 | throw CSystemException("cannot create event"); 80 | } 81 | 82 | 83 | CEventImpl::~CEventImpl() 84 | { 85 | CloseHandle(_event); 86 | } 87 | 88 | 89 | void CEventImpl::waitImpl() 90 | { 91 | switch (WaitForSingleObject(_event, INFINITE)) 92 | { 93 | case WAIT_OBJECT_0: 94 | return; 95 | default: 96 | throw CSystemException("wait for event failed"); 97 | } 98 | } 99 | 100 | 101 | bool CEventImpl::waitImpl(long milliseconds) 102 | { 103 | switch (WaitForSingleObject(_event, milliseconds + 1)) 104 | { 105 | case WAIT_TIMEOUT: 106 | return false; 107 | case WAIT_OBJECT_0: 108 | return true; 109 | default: 110 | throw CSystemException("wait for event failed"); 111 | } 112 | } 113 | 114 | -------------------------------------------------------------------------------- /src/base/Mutex_WIN32.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Mutex_WIN32.cpp,v 1.1 2008/05/31 15:47:24 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Mutex_WIN32.cpp 38 | // 39 | // $Id: Mutex_WIN32.cpp,v 1.1 2008/05/31 15:47:24 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Mutex 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Mutex_WIN32.h" 73 | #include "Timestamp.h" 74 | 75 | CMutexImpl::CMutexImpl() 76 | { 77 | // the fct has a boolean return value under WInnNt/2000/XP but not on Win98 78 | // the return only checks if the input address of &_cs was valid, so it is safe to omit it 79 | InitializeCriticalSectionAndSpinCount(&_cs, 4000); 80 | } 81 | 82 | 83 | CMutexImpl::~CMutexImpl() 84 | { 85 | DeleteCriticalSection(&_cs); 86 | } 87 | 88 | 89 | bool CMutexImpl::tryLockImpl(long milliseconds) 90 | { 91 | const int sleepMillis = 5; 92 | CTimestamp now; 93 | CTimestamp::TimeDiff diff(CTimestamp::TimeDiff(milliseconds)*1000); 94 | do 95 | { 96 | try 97 | { 98 | if (TryEnterCriticalSection(&_cs) == TRUE) 99 | return true; 100 | } 101 | catch (...) 102 | { 103 | throw CSystemException("cannot lock mutex"); 104 | } 105 | Sleep(sleepMillis); 106 | } 107 | while (!now.isElapsed(diff)); 108 | return false; 109 | } 110 | -------------------------------------------------------------------------------- /src/base/Event_WIN32.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Event_WIN32.h,v 1.1 2008/05/31 15:47:22 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Event_WIN32.h 38 | // 39 | // $Id: Event_WIN32.h,v 1.1 2008/05/31 15:47:22 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Event 44 | // 45 | // Definition of the EventImpl class for WIN32. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_Event_WIN32_INCLUDED 75 | #define Foundation_Event_WIN32_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | #include "Exception.h" 80 | #include "UnWindows.h" 81 | 82 | 83 | class CEventImpl 84 | { 85 | protected: 86 | CEventImpl(bool autoReset = false); 87 | ~CEventImpl(); 88 | void setImpl(); 89 | void waitImpl(); 90 | bool waitImpl(long milliseconds); 91 | void resetImpl(); 92 | 93 | private: 94 | HANDLE _event; 95 | }; 96 | 97 | 98 | // 99 | // inlines 100 | // 101 | inline void CEventImpl::setImpl() 102 | { 103 | if (!SetEvent(_event)) 104 | { 105 | throw CSystemException("cannot signal event"); 106 | } 107 | } 108 | 109 | 110 | inline void CEventImpl::resetImpl() 111 | { 112 | if (!ResetEvent(_event)) 113 | { 114 | throw CSystemException("cannot reset event"); 115 | } 116 | } 117 | 118 | #endif // Foundation_Event_WIN32_INCLUDED 119 | -------------------------------------------------------------------------------- /src/DiskController.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | */ 25 | 26 | /** 27 | * \file 28 | * Contains definitions for the disk controller base class. 29 | * 30 | * $Id: DiskController.cpp,v 1.15 2008/04/29 08:03:21 iamcamiel Exp $ 31 | * 32 | * X-1.15 Camiel Vanderhoeven 29-APR-2008 33 | * CDiskController is no longer a CPCIDevice. devices that are both 34 | * should multiple inherit both. 35 | * 36 | * X-1.14 Camiel Vanderhoeven 14-MAR-2008 37 | * Formatting. 38 | * 39 | * X-1.13 Camiel Vanderhoeven 14-MAR-2008 40 | * 1. More meaningful exceptions replace throwing (int) 1. 41 | * 2. U64 macro replaces X64 macro. 42 | * 43 | * X-1.12 Camiel Vanderhoeven 14-JAN-2008 44 | * Removed unreferenced variable. 45 | * 46 | * X-1.11 Brian Wheeler 13-JAN-2008 47 | * Avoid deleting Disk devices twice. 48 | * 49 | * X-1.9 Camiel Vanderhoeven 12-JAN-2008 50 | * Made register_disk void and virtual. 51 | * 52 | * X-1.8 Camiel Vanderhoeven 29-DEC-2007 53 | * Fix memory-leak. 54 | * 55 | * X-1.7 Camiel Vanderhoeven 28-DEC-2007 56 | * Keep the compiler happy. 57 | * 58 | * X-1.6 Camiel Vanderhoeven 18-DEC-2007 59 | * Initialize pointers to 0 in constructor. (doh!) 60 | * 61 | * X-1.5 Camiel Vanderhoeven 17-DEC-2007 62 | * Removed excessive whitespace. 63 | * 64 | * X-1.4 Brian Wheeler 16-DEC-2007 65 | * Added newline at end of file. 66 | * 67 | * X-1.3 Camiel Vanderhoeven 16-DEC-2007 68 | * Include Disk.h, so children's destructors can be called. 69 | * 70 | * X-1.2 Camiel Vanderhoeven 14-DEC-2007 71 | * Delete children upon destruction. 72 | * 73 | * X-1.1 Camiel Vanderhoeven 12-DEC-2007 74 | * Initial version in CVS. 75 | **/ 76 | #include "StdAfx.h" 77 | #include "DiskController.h" 78 | #include "Disk.h" 79 | 80 | CDiskController::CDiskController(int num_busses, int num_devices) 81 | { 82 | num_bus = num_busses; 83 | num_dev = num_devices; 84 | 85 | disks = (CDisk**) calloc(num_bus * num_dev, sizeof(CDisk *)); 86 | } 87 | 88 | CDiskController::~CDiskController(void) 89 | { 90 | free(disks); 91 | } 92 | 93 | void CDiskController::register_disk(class CDisk* dsk, int bus, int dev) 94 | { 95 | if(bus >= num_bus) 96 | FAILURE(Configuration, "Can't register disk: bus number out of range"); 97 | if(dev >= num_dev) 98 | FAILURE(Configuration, "Can't register disk: device number out of range"); 99 | 100 | disks[bus * num_bus + dev] = dsk; 101 | } 102 | 103 | class CDisk* CDiskController::get_disk(int bus, int dev) 104 | { 105 | if(bus >= num_bus) 106 | return 0; 107 | if(dev >= num_dev) 108 | return 0; 109 | 110 | return disks[bus * num_bus + dev]; 111 | } 112 | -------------------------------------------------------------------------------- /src/base/Semaphore_WIN32.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Semaphore_WIN32.cpp,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Semaphore_WIN32.cpp 38 | // 39 | // $Id: Semaphore_WIN32.cpp,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Semaphore 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Semaphore_WIN32.h" 73 | 74 | CSemaphoreImpl::CSemaphoreImpl(int n, int max) 75 | { 76 | poco_assert (n >= 0 && max > 0 && n <= max); 77 | 78 | _sema = CreateSemaphoreW(NULL, n, max, NULL); 79 | if (!_sema) 80 | { 81 | throw CSystemException("cannot create semaphore"); 82 | } 83 | } 84 | 85 | 86 | CSemaphoreImpl::~CSemaphoreImpl() 87 | { 88 | CloseHandle(_sema); 89 | } 90 | 91 | 92 | void CSemaphoreImpl::waitImpl() 93 | { 94 | switch (WaitForSingleObject(_sema, INFINITE)) 95 | { 96 | case WAIT_OBJECT_0: 97 | return; 98 | default: 99 | throw CSystemException("wait for semaphore failed"); 100 | } 101 | } 102 | 103 | 104 | bool CSemaphoreImpl::waitImpl(long milliseconds) 105 | { 106 | switch (WaitForSingleObject(_sema, milliseconds + 1)) 107 | { 108 | case WAIT_TIMEOUT: 109 | return false; 110 | case WAIT_OBJECT_0: 111 | return true; 112 | default: 113 | throw CSystemException("wait for semaphore failed"); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /m4/x11.m4: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # ES40 emulator. 3 | # Copyright (C) 2007-2008 by the ES40 Emulator Project 4 | # 5 | # Website: http://sourceforge.net/projects/es40 6 | # E-mail : camiel@camicom.com 7 | # 8 | # This program is free software; you can redistribute it and/or 9 | # modify it under the terms of the GNU General Public License 10 | # as published by the Free Software Foundation; either version 2 11 | # of the License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | # 23 | # Although this is not required, the author would appreciate being notified of, 24 | # and receiving any modifications you may make to the source code that might serve 25 | # the general public. 26 | # 27 | ################################################################################ 28 | # 29 | # $Id: x11.m4,v 1.1 2008/03/20 07:49:55 iamcamiel Exp $ 30 | # 31 | # X-1.1 Camiel Vanderhoeven 20-MAR-2008 32 | # File Created. 33 | # 34 | ################################################################################ 35 | # 36 | # Check if X11 is installed, and configure paths 37 | 38 | dnl AM_PATH_X11([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) 39 | dnl test for X11, and define X11_CFLAGS and X11_LIBS 40 | dnl 41 | 42 | AC_DEFUN([AM_PATH_X11], 43 | [dnl 44 | dnl Get the cflags and libraries for X11 45 | dnl 46 | 47 | AC_PATH_X([X11],[X11/Xlib.h],[XOpenDisplay(NULL)]) 48 | 49 | not_really_there="" 50 | if test "X$no_x" = "X"; then 51 | if test "X$x_includes" = "X"; then 52 | AC_TRY_CPP([#include ], , not_really_there="yes") 53 | else 54 | if test ! -r $x_includes/X11/Intrinsic.h; then 55 | not_really_there="yes" 56 | fi 57 | fi 58 | fi 59 | 60 | if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then 61 | AC_MSG_CHECKING(for X11 header files) 62 | X11_CFLAGS="" 63 | AC_TRY_CPP([#include ], , X11_CFLAGS="nope") 64 | if test "$X11_CFLAGS" = "nope"; then 65 | dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include /usr/X11R6/include /usr/include/X11R6" 66 | for i in $dirs ; do 67 | if test -r $i/X11/Intrinsic.h; then 68 | AC_MSG_RESULT($i) 69 | X11_CFLAGS=" -I$i" 70 | break 71 | fi 72 | done 73 | fi 74 | else 75 | if test "$x_includes" != ""; then 76 | X11_CFLAGS=-I$x_includes 77 | else 78 | X11_CFLAGS="" 79 | fi 80 | fi 81 | if test "$X11_CFLAGS" = "nope"; then 82 | AC_MSG_RESULT(couldn't find any!) 83 | fi 84 | 85 | if test "$no_x" = "yes"; then 86 | AC_MSG_CHECKING(for X11 libraries) 87 | X11_LIBS="nope" 88 | dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/X11R6/lib /usr/lib/X11R6 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" 89 | for i in $dirs ; do 90 | if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then 91 | AC_MSG_RESULT($i) 92 | X11_LIBS="-L$i -lX11" 93 | break 94 | fi 95 | done 96 | else 97 | if test "$x_libraries" = ""; then 98 | X11_LIBS=-"lX11" 99 | else 100 | X11_LIBS="-L$x_libraries -lX11" 101 | fi 102 | fi 103 | if test "$X11_LIBS" = "nope" ; then 104 | AC_CHECK_LIB(Xwindow, XCreateWindow, X11_LIBS=-lXwindow) 105 | fi 106 | if test "$X11_LIBS" = "nope" ; then 107 | AC_MSG_RESULT(couldn't find any!) 108 | fi 109 | 110 | AC_MSG_CHECKING(whether to use X11) 111 | if test "$X11_FLAGS" = "nope" -o "$X11_LIBS" = "nope"; then 112 | AC_MSG_RESULT(no) 113 | X11_FLAGS="" 114 | X11_LIBS="" 115 | ifelse([$2], , :, [$2]) 116 | else 117 | AC_MSG_RESULT(yes) 118 | ifelse([$1], , :, [$1]) 119 | fi 120 | AC_SUBST(X11_CFLAGS) 121 | AC_SUBST(X11_LIBS) 122 | ]) 123 | -------------------------------------------------------------------------------- /src/base/Mutex_WIN32.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Mutex_WIN32.h,v 1.1 2008/05/31 15:47:24 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Mutex_WIN32.h 38 | // 39 | // $Id: Mutex_WIN32.h,v 1.1 2008/05/31 15:47:24 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Mutex 44 | // 45 | // Definition of the MutexImpl and FastMutexImpl classes for WIN32. 46 | // 47 | // Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_Mutex_WIN32_INCLUDED 75 | #define Foundation_Mutex_WIN32_INCLUDED 76 | 77 | #include "Foundation.h" 78 | #include "Exception.h" 79 | #include "UnWindows.h" 80 | 81 | class CMutexImpl 82 | { 83 | protected: 84 | CMutexImpl(); 85 | ~CMutexImpl(); 86 | void lockImpl(); 87 | bool tryLockImpl(); 88 | bool tryLockImpl(long milliseconds); 89 | void unlockImpl(); 90 | 91 | private: 92 | CRITICAL_SECTION _cs; 93 | }; 94 | 95 | 96 | typedef CMutexImpl CFastMutexImpl; 97 | 98 | 99 | // 100 | // inlines 101 | // 102 | inline void CMutexImpl::lockImpl() 103 | { 104 | try 105 | { 106 | EnterCriticalSection(&_cs); 107 | } 108 | catch (...) 109 | { 110 | throw CSystemException("cannot lock mutex"); 111 | } 112 | } 113 | 114 | 115 | inline bool CMutexImpl::tryLockImpl() 116 | { 117 | try 118 | { 119 | return TryEnterCriticalSection(&_cs) == TRUE; 120 | } 121 | catch (...) 122 | { 123 | } 124 | throw CSystemException("cannot lock mutex"); 125 | } 126 | 127 | 128 | inline void CMutexImpl::unlockImpl() 129 | { 130 | LeaveCriticalSection(&_cs); 131 | } 132 | 133 | #endif // Foundation_Mutex_WIN32_INCLUDED 134 | -------------------------------------------------------------------------------- /src/base/ThreadLocal.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: ThreadLocal.cpp,v 1.1 2008/05/31 15:47:29 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // ThreadLocal.cpp 38 | // 39 | // $Id: ThreadLocal.cpp,v 1.1 2008/05/31 15:47:29 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Threading 43 | // Module: Thread 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "ThreadLocal.h" 73 | #include "SingletonHolder.h" 74 | #include "Thread.h" 75 | 76 | CTLSAbstractSlot::CTLSAbstractSlot() 77 | { 78 | } 79 | 80 | 81 | CTLSAbstractSlot::~CTLSAbstractSlot() 82 | { 83 | } 84 | 85 | 86 | CThreadLocalStorage::CThreadLocalStorage() 87 | { 88 | } 89 | 90 | 91 | CThreadLocalStorage::~CThreadLocalStorage() 92 | { 93 | for (CTLSMap::iterator it = _map.begin(); it != _map.end(); ++it) 94 | { 95 | delete it->second; 96 | } 97 | } 98 | 99 | 100 | CTLSAbstractSlot*& CThreadLocalStorage::get(const void* key) 101 | { 102 | CTLSMap::iterator it = _map.find(key); 103 | if (it == _map.end()) 104 | return _map.insert(CTLSMap::value_type(key, 0)).first->second; 105 | else 106 | return it->second; 107 | } 108 | 109 | 110 | CThreadLocalStorage& CThreadLocalStorage::current() 111 | { 112 | CThread* pThread = CThread::current(); 113 | if (pThread) 114 | { 115 | return pThread->tls(); 116 | } 117 | else 118 | { 119 | static CSingletonHolder sh; 120 | return *sh.get(); 121 | } 122 | } 123 | 124 | 125 | void CThreadLocalStorage::clear() 126 | { 127 | CThread* pThread = CThread::current(); 128 | if (pThread) 129 | pThread->clearTLS(); 130 | } 131 | -------------------------------------------------------------------------------- /src/base/SingletonHolder.h: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: SingletonHolder.h,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // SingletonHolder.h 38 | // 39 | // $Id: SingletonHolder.h,v 1.1 2008/05/31 15:47:28 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Core 43 | // Module: SingletonHolder 44 | // 45 | // Definition of the SingletonHolder template. 46 | // 47 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 48 | // and Contributors. 49 | // 50 | // Permission is hereby granted, free of charge, to any person or organization 51 | // obtaining a copy of the software and accompanying documentation covered by 52 | // this license (the "Software") to use, reproduce, display, distribute, 53 | // execute, and transmit the Software, and to prepare derivative works of the 54 | // Software, and to permit third-parties to whom the Software is furnished to 55 | // do so, all subject to the following: 56 | // 57 | // The copyright notices in the Software and this entire statement, including 58 | // the above license grant, this restriction and the following disclaimer, 59 | // must be included in all copies of the Software, in whole or in part, and 60 | // all derivative works of the Software, unless such copies or derivative 61 | // works are solely in the form of machine-executable object code generated by 62 | // a source language processor. 63 | // 64 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 67 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 68 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 69 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 70 | // DEALINGS IN THE SOFTWARE. 71 | // 72 | 73 | 74 | #ifndef Foundation_SingletonHolder_INCLUDED 75 | #define Foundation_SingletonHolder_INCLUDED 76 | 77 | 78 | #include "Foundation.h" 79 | #include "Mutex.h" 80 | 81 | template 82 | class CSingletonHolder 83 | /// This is a helper template class for managing 84 | /// singleton objects allocated on the heap. 85 | /// The class ensures proper deletion (including 86 | /// calling of the destructor) of singleton objects 87 | /// when the application that created them terminates. 88 | { 89 | public: 90 | CSingletonHolder() 91 | /// Creates the SingletonHolder. 92 | { 93 | _pS = 0; 94 | } 95 | ~CSingletonHolder() 96 | /// Destroys the SingletonHolder and the singleton 97 | /// object that it holds. 98 | { 99 | delete _pS; 100 | } 101 | S* get() 102 | /// Returns a pointer to the singleton object 103 | /// hold by the SingletonHolder. The first call 104 | /// to get will create the singleton. 105 | { 106 | CFastMutex::CScopedLock lock(&_m); 107 | if (!_pS) _pS = new S; 108 | return _pS; 109 | } 110 | 111 | private: 112 | S* _pS; 113 | CFastMutex _m; 114 | }; 115 | 116 | #endif // Foundation_SingletonHolder_INCLUDED 117 | -------------------------------------------------------------------------------- /src/base/Bugcheck.cpp: -------------------------------------------------------------------------------- 1 | /* ES40 emulator. 2 | * Copyright (C) 2007-2008 by the ES40 Emulator Project 3 | * 4 | * WWW : http://www.es40.org 5 | * E-mail : camiel@es40.org 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Although this is not required, the author would appreciate being notified of, 22 | * and receiving any modifications you may make to the source code that might serve 23 | * the general public. 24 | * 25 | * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) 26 | * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. 27 | */ 28 | 29 | /** 30 | * $Id: Bugcheck.cpp,v 1.1 2008/05/31 15:47:19 iamcamiel Exp $ 31 | * 32 | * X-1.1 Camiel Vanderhoeven 31-MAY-2008 33 | * Initial version for ES40 emulator. 34 | **/ 35 | 36 | // 37 | // Bugcheck.cpp 38 | // 39 | // $Id: Bugcheck.cpp,v 1.1 2008/05/31 15:47:19 iamcamiel Exp $ 40 | // 41 | // Library: Foundation 42 | // Package: Core 43 | // Module: Bugcheck 44 | // 45 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 46 | // and Contributors. 47 | // 48 | // Permission is hereby granted, free of charge, to any person or organization 49 | // obtaining a copy of the software and accompanying documentation covered by 50 | // this license (the "Software") to use, reproduce, display, distribute, 51 | // execute, and transmit the Software, and to prepare derivative works of the 52 | // Software, and to permit third-parties to whom the Software is furnished to 53 | // do so, all subject to the following: 54 | // 55 | // The copyright notices in the Software and this entire statement, including 56 | // the above license grant, this restriction and the following disclaimer, 57 | // must be included in all copies of the Software, in whole or in part, and 58 | // all derivative works of the Software, unless such copies or derivative 59 | // works are solely in the form of machine-executable object code generated by 60 | // a source language processor. 61 | // 62 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 65 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 66 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 67 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 68 | // DEALINGS IN THE SOFTWARE. 69 | // 70 | 71 | 72 | #include "Bugcheck.h" 73 | #include "Exception.h" 74 | #include 75 | 76 | void CBugcheck::assertion(const char* cond, const char* file, int line) 77 | { 78 | throw CAssertionViolationException(what(cond, file, line)); 79 | } 80 | 81 | void CBugcheck::nullPointer(const char* ptr, const char* file, int line) 82 | { 83 | throw CNullPointerException(what(ptr, file, line)); 84 | } 85 | 86 | void CBugcheck::bugcheck(const char* file, int line) 87 | { 88 | throw CBugcheckException(what(0, file, line)); 89 | } 90 | 91 | void CBugcheck::bugcheck(const char* msg, const char* file, int line) 92 | { 93 | std::string m("Bugcheck"); 94 | if (msg) 95 | { 96 | m.append(": "); 97 | m.append(msg); 98 | } 99 | throw CBugcheckException(what(msg, file, line)); 100 | } 101 | 102 | void CBugcheck::debugger(const char* file, int line) 103 | { 104 | //Debugger::enter(file, line); 105 | } 106 | 107 | 108 | void CBugcheck::debugger(const char* msg, const char* file, int line) 109 | { 110 | //Debugger::enter(msg, file, line); 111 | } 112 | 113 | std::string CBugcheck::what(const char* msg, const char* file, int line) 114 | { 115 | std::ostringstream str; 116 | if (msg) str << msg << " "; 117 | str << "in file \"" << file << "\", line " << line; 118 | return str.str(); 119 | } 120 | --------------------------------------------------------------------------------