This commit is contained in:
Dagen Brock 2016-02-07 23:01:25 -06:00
parent b3ad34bdff
commit d9dde67041
109 changed files with 19520 additions and 19343 deletions

View File

@ -1,9 +1,9 @@
# GSport configuration file # GSport configuration file
s5d1 = s5d1 =
s5d2 = s5d2 =
s6d1 = s6d1 =
s6d2 = s6d2 =
s7d1 = NoBoot.po s7d1 = NoBoot.po

View File

@ -1,16 +1,16 @@
@echo off @echo off
REM REM
REM GSport - Windows startup batch file REM GSport - Windows startup batch file
REM REM
SET GSPORT_HOME=%CD%\ SET GSPORT_HOME=%CD%\
set CYGWIN=nodosfilewarning set CYGWIN=nodosfilewarning
:add_classpath :add_classpath
SET CWD=%CD% SET CWD=%CD%
if "%GSPORT_PATH_SET%" == "1" goto start if "%GSPORT_PATH_SET%" == "1" goto start
set GSPORT_PATH_SET=1 set GSPORT_PATH_SET=1
PATH=%PATH%;%GSPORT_HOME PATH=%PATH%;%GSPORT_HOME
:start :start
GSport.exe GSport.exe

3848
src/adb.c

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,76 +1,76 @@
# GSport OS/2 makefile # GSport OS/2 makefile
TARGET = gsport.exe TARGET = gsport.exe
OBJECTS1 = dirport.obj adb.obj clock.obj dis.obj engine_c.obj scc.obj \ OBJECTS1 = dirport.obj adb.obj clock.obj dis.obj engine_c.obj scc.obj \
iwm.obj joystick_driver.obj moremem.obj paddles.obj \ iwm.obj joystick_driver.obj moremem.obj paddles.obj \
sim65816.obj smartport.obj sound.obj \ sim65816.obj smartport.obj sound.obj \
video.obj config.obj scc_socket_os2.obj os2driver.obj os2snd_driver.obj video.obj config.obj scc_socket_os2.obj os2driver.obj os2snd_driver.obj
{..\..}.c.obj: {..\..}.c.obj:
@echo " Compile::C++ Compiler " @echo " Compile::C++ Compiler "
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
{src\}.c.obj: {src\}.c.obj:
@echo " Compile::C++ Compiler " @echo " Compile::C++ Compiler "
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
.c.obj: .c.obj:
@echo " Compile::C++ Compiler " @echo " Compile::C++ Compiler "
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
$(TARGET): $(OBJECTS1) $(TARGET): $(OBJECTS1)
@echo " Link::Linker " @echo " Link::Linker "
icc.exe @<< icc.exe @<<
/B" /de /pmtype:pm /st:196608 " /B" /de /pmtype:pm /st:196608 "
/Fe$(TARGET) /Fe$(TARGET)
so32dll.lib so32dll.lib
tcp32dll.lib tcp32dll.lib
$(OBJECTS1) $(OBJECTS1)
<< <<
rc gsportos2.rc $(TARGET) rc gsportos2.rc $(TARGET)
echo done echo done
clean: clean:
- rm $(OBJECTS1) - rm $(OBJECTS1)
- rm $(TARGET) - rm $(TARGET)
- rm gsportos2.res - rm gsportos2.res
- rm ../../size_s.h - rm ../../size_s.h
- rm ../../size_c.h - rm ../../size_c.h
- rm ../../8size_s.h - rm ../../8size_s.h
- rm ../../16size_s.h - rm ../../16size_s.h
- rm ../../8inst_s.h - rm ../../8inst_s.h
- rm ../../8inst_c.h - rm ../../8inst_c.h
- rm ../../16inst_s.h - rm ../../16inst_s.h
- rm ../../16inst_c.h - rm ../../16inst_c.h
../../size_c.h: ../../size_c.h:
call make_size.cmd call make_size.cmd
../../8inst_c.h: ../../8inst_c.h:
call make_inst.cmd call make_inst.cmd
# dependency stuff # dependency stuff
dirport.obj: src/dirport.c src/dirport.h dirport.obj: src/dirport.c src/dirport.h
adb.obj: ../../adb.c ../../adb.h ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h adb.obj: ../../adb.c ../../adb.h ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
engine_c.obj: ../../engine_c.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../protos_engine_c.h ../../size_c.h ../../op_routs.h ../../defs_instr.h ../../8inst_c.h ../../16inst_c.h engine_c.obj: ../../engine_c.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../protos_engine_c.h ../../size_c.h ../../op_routs.h ../../defs_instr.h ../../8inst_c.h ../../16inst_c.h
clock.obj: ..\..\clock.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h clock.obj: ..\..\clock.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
compile_time.obj: ../../compile_time.c compile_time.obj: ../../compile_time.c
config.obj: ../../config.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../config.h config.obj: ../../config.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../config.h
dis.obj: ../../dis.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../disas.h dis.obj: ../../dis.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../disas.h
scc.obj: ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h scc.obj: ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
scc_socket_driver.obj: ../../scc_socket_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h scc_socket_driver.obj: ../../scc_socket_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
scc_socket_os2.obj: scc_socket_os2.c scc_socket_os2.obj: scc_socket_os2.c
iwm.obj: ../../iwm.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../iwm_35_525.h iwm.obj: ../../iwm.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../iwm_35_525.h
joystick_driver.obj: ../../joystick_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h joystick_driver.obj: ../../joystick_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
moremem.obj: ../../moremem.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h moremem.obj: ../../moremem.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
paddles.obj: ../../paddles.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h paddles.obj: ../../paddles.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
parallel.obj: ../../parallel.c ../../defc.h parallel.obj: ../../parallel.c ../../defc.h
printer.obj: ../../printer.cpp printer.obj: ../../printer.cpp
sim65816.obj: ../../sim65816.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h sim65816.obj: ../../sim65816.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
smartport.obj: ../../smartport.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h smartport.obj: ../../smartport.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
sound.obj: ../../sound.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h sound.obj: ../../sound.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
sound_driver.obj: ../../sound_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../sound.h sound_driver.obj: ../../sound_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../sound.h
video.obj: ../../video.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../superhires.h ../../gsportfont.h video.obj: ../../video.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../superhires.h ../../gsportfont.h
os2driver.obj: os2driver.c gsportos2.h ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h os2driver.obj: os2driver.c gsportos2.h ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
os2snd_driver.obj: os2snd_driver.c os2snd_driver.obj: os2snd_driver.c

View File

@ -1,44 +1,46 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Copyright (C) 2010 by GSport contributors
This program is free software; you can redistribute it and/or modify it Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* */
* Function prototypes
*/ /*
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ); * Function prototypes
VOID os2_abort(HWND hwndFrame, HWND hwndClient); */
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
#define MSGBOXID 1001 VOID os2_abort(HWND hwndFrame, HWND hwndClient);
#define ID_WINDOW 256 #define MSGBOXID 1001
#define ID_OPTIONS 257 #define ID_WINDOW 256
#define ID_OPTION1 258
#define ID_OPTION2 259 #define ID_OPTIONS 257
#define ID_OPTION3 260 #define ID_OPTION1 258
#define ID_OPTION2 259
#define ID_EXITPROG 261 #define ID_OPTION3 260
#define IDS_HELLO 262 #define ID_EXITPROG 261
#define IDS_1 263
#define IDS_2 264 #define IDS_HELLO 262
#define IDS_3 265 #define IDS_1 263
#define IDS_2 264
#define ID_BITMAP 266 /* For testing backgrounds - can be removed once video works */ #define IDS_3 265
#define ID_BITMAP 266 /* For testing backgrounds - can be removed once video works */

View File

@ -1,48 +1,49 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Copyright (C) 2010 by GSport contributors
This program is free software; you can redistribute it and/or modify it Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <os2.h> */
#include "gsportos2.h"
#include <os2.h>
ICON ID_WINDOW gsportos2.ico #include "gsportos2.h"
BITMAP ID_BITMAP gsportos2.bmp ICON ID_WINDOW gsportos2.ico
MENU ID_WINDOW PRELOAD BITMAP ID_BITMAP gsportos2.bmp
BEGIN
SUBMENU "~Options", ID_OPTIONS MENU ID_WINDOW PRELOAD
BEGIN BEGIN
MENUITEM "Option ~1\tCtrl+A", ID_OPTION1, MIS_TEXT SUBMENU "~Options", ID_OPTIONS
MENUITEM "Option ~2\tCtrl+B", ID_OPTION2, MIS_TEXT BEGIN
MENUITEM "Option ~3\tCtrl+C", ID_OPTION3, MIS_TEXT MENUITEM "Option ~1\tCtrl+A", ID_OPTION1, MIS_TEXT
END MENUITEM "Option ~2\tCtrl+B", ID_OPTION2, MIS_TEXT
END MENUITEM "Option ~3\tCtrl+C", ID_OPTION3, MIS_TEXT
END
ACCELTABLE ID_WINDOW PRELOAD END
BEGIN
VK_F3, ID_EXITPROG, VIRTUALKEY ACCELTABLE ID_WINDOW PRELOAD
END BEGIN
VK_F3, ID_EXITPROG, VIRTUALKEY
STRINGTABLE PRELOAD END
BEGIN
IDS_HELLO, "Hello" STRINGTABLE PRELOAD
END BEGIN
 IDS_HELLO, "Hello"
END

View File

@ -1,76 +1,76 @@
/* /*
make_inst.cmd: make_inst.cmd:
Translation of the make_inst perl script and makefile to rexx for OS/2 Translation of the make_inst perl script and makefile to rexx for OS/2
8inst_s.h: instable.h 8inst_s.h: instable.h
$(PERL) make_inst s 8 instable.h > 8inst_s.h $(PERL) make_inst s 8 instable.h > 8inst_s.h
16inst_s.h: instable.h 16inst_s.h: instable.h
$(PERL) make_inst s 16 instable.h > 16inst_s.h $(PERL) make_inst s 16 instable.h > 16inst_s.h
8inst_c.h: instable.h 8inst_c.h: instable.h
$(PERL) make_inst c 8 instable.h > 8inst_c.h $(PERL) make_inst c 8 instable.h > 8inst_c.h
16inst_c.h: instable.h 16inst_c.h: instable.h
$(PERL) make_inst c 16 instable.h > 16inst_c.h $(PERL) make_inst c 16 instable.h > 16inst_c.h
*/ */
count = 0; count = 0;
FileNameIn = "..\..\instable.h" FileNameIn = "..\..\instable.h"
FileNameOut8s = "..\..\8inst_s.h" FileNameOut8s = "..\..\8inst_s.h"
FileNameOut8c = "..\..\8inst_c.h" FileNameOut8c = "..\..\8inst_c.h"
FileNameOut16s = "..\..\16inst_s.h" FileNameOut16s = "..\..\16inst_s.h"
FileNameOut16c = "..\..\16inst_c.h" FileNameOut16c = "..\..\16inst_c.h"
DEL FileNameOut8s DEL FileNameOut8s
DEL FileNameOut8c DEL FileNameOut8c
DEL FileNameOut16s DEL FileNameOut16s
DEL FileNameOut16c DEL FileNameOut16c
crud = STREAM(FileNameIn,"C","open read") crud = STREAM(FileNameIn,"C","open read")
crud = STREAM(FileNameOut8s,"C","open write") crud = STREAM(FileNameOut8s,"C","open write")
crud = STREAM(FileNameOut8c,"C","open write") crud = STREAM(FileNameOut8c,"C","open write")
crud = STREAM(FileNameOut16s,"C","open write") crud = STREAM(FileNameOut16s,"C","open write")
crud = STREAM(FileNameOut16c,"C","open write") crud = STREAM(FileNameOut16c,"C","open write")
Do while (STREAM(FileNameIn,"S") = "READY") Do while (STREAM(FileNameIn,"S") = "READY")
line = LINEIN(FileNameIn); line = LINEIN(FileNameIn);
SymPos = POS("_SYM",line) SymPos = POS("_SYM",line)
if (SymPos > 0) Then if (SymPos > 0) Then
Do Do
if POS("inst",line) > 0 Then if POS("inst",line) > 0 Then
Do Do
if (count > 0) Then if (count > 0) Then
Do Do
crud = LINEOUT(FileNameOut8c," break;"); crud = LINEOUT(FileNameOut8c," break;");
crud = LINEOUT(FileNameOut16c," break;"); crud = LINEOUT(FileNameOut16c," break;");
End End
newline = "case 0x"SUBSTR(line,SymPos-2,2)": "SUBSTR(line,SymPos+4) newline = "case 0x"SUBSTR(line,SymPos-2,2)": "SUBSTR(line,SymPos+4)
crud = LINEOUT(FileNameOut8c, newline); crud = LINEOUT(FileNameOut8c, newline);
crud = LINEOUT(FileNameOut16c, newline); crud = LINEOUT(FileNameOut16c, newline);
count = count + 1; count = count + 1;
End End
Else Else
Do Do
crud = LINEOUT(FileNameOut8s,SUBSTR(line,1,SymPos)" . "8" . "SUBSTR(line,SymPos+4)); crud = LINEOUT(FileNameOut8s,SUBSTR(line,1,SymPos)" . "8" . "SUBSTR(line,SymPos+4));
crud = LINEOUT(FileNameOut16s,SUBSTR(line,1,SymPos)" . "16" . "SUBSTR(line,SymPos+4)); crud = LINEOUT(FileNameOut16s,SUBSTR(line,1,SymPos)" . "16" . "SUBSTR(line,SymPos+4));
End End
End End
Else Else
Do Do
crud = LINEOUT(FileNameOut8c,line); crud = LINEOUT(FileNameOut8c,line);
crud = LINEOUT(FileNameOut8s,line); crud = LINEOUT(FileNameOut8s,line);
crud = LINEOUT(FileNameOut16c,line); crud = LINEOUT(FileNameOut16c,line);
crud = LINEOUT(FileNameOut16s,line); crud = LINEOUT(FileNameOut16s,line);
End End
End End
say "Lines read: "Count say "Lines read: "Count
crud = STREAM(FileNameIn,"C","close") crud = STREAM(FileNameIn,"C","close")
crud = STREAM(FileNameOut8s,"C","close") crud = STREAM(FileNameOut8s,"C","close")
crud = STREAM(FileNameOut8c,"C","close") crud = STREAM(FileNameOut8c,"C","close")
crud = STREAM(FileNameOut16s,"C","close") crud = STREAM(FileNameOut16s,"C","close")
crud = STREAM(FileNameOut16c,"C","close") crud = STREAM(FileNameOut16c,"C","close")

View File

@ -1,71 +1,71 @@
/* /*
make_inst.cmd: make_inst.cmd:
Translation of the make_size perl script and makefile to rexx for OS/2 Translation of the make_size perl script and makefile to rexx for OS/2
size_c.h: size_tab.h size_c.h: size_tab.h
$(PERL) make_size c size_tab.h > size_c.h $(PERL) make_size c size_tab.h > size_c.h
size_s.h: size_tab.h size_s.h: size_tab.h
$(PERL) make_size s size_tab.h > size_s.h $(PERL) make_size s size_tab.h > size_s.h
8size_s.h: size_tab.h 8size_s.h: size_tab.h
$(PERL) make_size 8 size_tab.h > 8size_s.h $(PERL) make_size 8 size_tab.h > 8size_s.h
16size_s.h: size_tab.h 16size_s.h: size_tab.h
$(PERL) make_size 16 size_tab.h > 16size_s.h $(PERL) make_size 16 size_tab.h > 16size_s.h
*/ */
FileNameIn = "..\..\size_tab.h" FileNameIn = "..\..\size_tab.h"
FileNameOuts = "..\..\size_s.h" FileNameOuts = "..\..\size_s.h"
FileNameOutc = "..\..\size_c.h" FileNameOutc = "..\..\size_c.h"
FileNameOut8 = "..\..\8size_s.h" FileNameOut8 = "..\..\8size_s.h"
FileNameOut16 = "..\..\16size_s.h" FileNameOut16 = "..\..\16size_s.h"
DEL FileNameOuts DEL FileNameOuts
DEL FileNameOutc DEL FileNameOutc
DEL FileNameOut8 DEL FileNameOut8
DEL FileNameOut16 DEL FileNameOut16
crud = STREAM(FileNameIn,"C","open read") crud = STREAM(FileNameIn,"C","open read")
crud = STREAM(FileNameOuts,"C","open write") crud = STREAM(FileNameOuts,"C","open write")
crud = STREAM(FileNameOutc,"C","open write") crud = STREAM(FileNameOutc,"C","open write")
crud = STREAM(FileNameOut8,"C","open write") crud = STREAM(FileNameOut8,"C","open write")
crud = STREAM(FileNameOut16,"C","open write") crud = STREAM(FileNameOut16,"C","open write")
Do while (STREAM(FileNameIn,"S") = "READY") Do while (STREAM(FileNameIn,"S") = "READY")
line = LINEIN(FileNameIn); line = LINEIN(FileNameIn);
SymPos = POS("_SYM",line) SymPos = POS("_SYM",line)
if (SymPos > 0) Then if (SymPos > 0) Then
Do Do
newline = " .byte 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6) newline = " .byte 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
crud = LINEOUT(FileNameOuts, newline); crud = LINEOUT(FileNameOuts, newline);
newline = " 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6) newline = " 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
crud = LINEOUT(FileNameOutc, newline); crud = LINEOUT(FileNameOutc, newline);
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 8 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6) newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 8 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
crud = LINEOUT(FileNameOut8, newline); crud = LINEOUT(FileNameOut8, newline);
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 16 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6) newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 16 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
crud = LINEOUT(FileNameOut16, newline); crud = LINEOUT(FileNameOut16, newline);
End End
Else if (POS(".block",line) > 0) Then Else if (POS(".block",line) > 0) Then
Do Do
crud = LINEOUT(FileNameOuts, ""); crud = LINEOUT(FileNameOuts, "");
crud = LINEOUT(FileNameOutc, ""); crud = LINEOUT(FileNameOutc, "");
crud = LINEOUT(FileNameOut8, line); crud = LINEOUT(FileNameOut8, line);
crud = LINEOUT(FileNameOut16, line); crud = LINEOUT(FileNameOut16, line);
End End
Else Else
Do Do
crud = LINEOUT(FileNameOuts, line); crud = LINEOUT(FileNameOuts, line);
crud = LINEOUT(FileNameOutc, line); crud = LINEOUT(FileNameOutc, line);
crud = LINEOUT(FileNameOut8, line); crud = LINEOUT(FileNameOut8, line);
crud = LINEOUT(FileNameOut16, line); crud = LINEOUT(FileNameOut16, line);
End End
End End
crud = STREAM(FileNameIn,"C","close") crud = STREAM(FileNameIn,"C","close")
crud = STREAM(FileNameOuts,"C","close") crud = STREAM(FileNameOuts,"C","close")
crud = STREAM(FileNameOutc,"C","close") crud = STREAM(FileNameOutc,"C","close")
crud = STREAM(FileNameOut8,"C","close") crud = STREAM(FileNameOut8,"C","close")
crud = STREAM(FileNameOut16,"C","close") crud = STREAM(FileNameOut16,"C","close")

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,23 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2010 by GSport contributors
Copyright (C) 2016 - Dagen Brock
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the This program is free software; you can redistribute it and/or modify it
Free Software Foundation; either version 2 of the License, or (at your under the terms of the GNU General Public License as published by the
option) any later version. Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY This program is distributed in the hope that it will be useful, but
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
for more details. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., You should have received a copy of the GNU General Public License along
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA with this program; if not, write to the Free Software Foundation, Inc.,
*/ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
int g_preferred_rate = 48000;
int g_preferred_rate = 48000;

View File

@ -1,12 +1,12 @@
/* scc_socket_driver.c */ /* scc_socket_driver.c */
void scc_socket_init(int port) void scc_socket_init(int port)
{} {}
void scc_socket_change_params(int port) void scc_socket_change_params(int port)
{} {}
void scc_socket_empty_writebuf(int port, double dcycs) void scc_socket_empty_writebuf(int port, double dcycs)
{} {}
void scc_socket_fill_readbuf(int port, int space_left, double dcycs) void scc_socket_fill_readbuf(int port, int space_left, double dcycs)
{} {}

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +1,84 @@
/* /*
* This file is part of VICE, the Versatile Commodore Emulator. * This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice. * See README for copyright notice.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA. * 02111-1307 USA.
* *
*/ */
#ifndef VICE_DIRPORT_H #ifndef VICE_DIRPORT_H
#define VICE_DIRPORT_H #define VICE_DIRPORT_H
#define INCL_DOS #define INCL_DOS
#include <os2.h> #include <os2.h>
#include <malloc.h> #include <malloc.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef _A_VOLID #ifndef _A_VOLID
#define _A_VOLID 0 #define _A_VOLID 0
#endif #endif
#ifndef _A_NORMAL #ifndef _A_NORMAL
#define _A_NORMAL FILE_NORMAL #define _A_NORMAL FILE_NORMAL
#endif #endif
#ifndef _A_RDONLY #ifndef _A_RDONLY
#define _A_RDONLY FILE_READONLY #define _A_RDONLY FILE_READONLY
#endif #endif
#ifndef _A_HIDDEN #ifndef _A_HIDDEN
#define _A_HIDDEN FILE_HIDDEN #define _A_HIDDEN FILE_HIDDEN
#endif #endif
#ifndef _A_SYSTEM #ifndef _A_SYSTEM
#define _A_SYSTEM FILE_SYSTEM #define _A_SYSTEM FILE_SYSTEM
#endif #endif
#ifndef _A_SUBDIR #ifndef _A_SUBDIR
#define _A_SUBDIR FILE_DIRECTORY #define _A_SUBDIR FILE_DIRECTORY
#endif #endif
#ifndef _A_ARCH #ifndef _A_ARCH
#define _A_ARCH FILE_ARCHIVED #define _A_ARCH FILE_ARCHIVED
#endif #endif
#define _A_ANY FILE_NORMAL | FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED #define _A_ANY FILE_NORMAL | FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED
#ifndef EPERM #ifndef EPERM
#define EPERM EDOM // Operation not permitted = Domain Error #define EPERM EDOM // Operation not permitted = Domain Error
#endif #endif
#define dirent _FILEFINDBUF3 #define dirent _FILEFINDBUF3
#define d_name achName /* For struct dirent portability */ #define d_name achName /* For struct dirent portability */
#define d_size cbFile #define d_size cbFile
#define mkdir(name, mode) mkdir(name) #define mkdir(name, mode) mkdir(name)
#ifndef WATCOM_COMPILE #ifndef WATCOM_COMPILE
#define S_ISDIR(mode) ((mode) & S_IFDIR) #define S_ISDIR(mode) ((mode) & S_IFDIR)
typedef struct _DIR { typedef struct _DIR {
struct dirent buffer; struct dirent buffer;
HDIR handle; HDIR handle;
APIRET ulrc; APIRET ulrc;
} DIR; } DIR;
extern DIR *opendir(char *path); extern DIR *opendir(char *path);
extern struct dirent *readdir(DIR *dirp); extern struct dirent *readdir(DIR *dirp);
extern int closedir(DIR *dirp); extern int closedir(DIR *dirp);
#endif #endif
#endif /* DIRPORT__H */ #endif /* DIRPORT__H */


View File

@ -1,302 +1,304 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** This module implements AARP, a necessary protocol for ELAP communication. **/ */
#include <stdbool.h> /** This module implements AARP, a necessary protocol for ELAP communication. **/
#include <time.h>
#include "../defc.h" #include <stdbool.h>
#include "atbridge.h" #include <time.h>
#include "elap.h" #include "../defc.h"
#include "port.h" #include "atbridge.h"
#include "elap_defs.h" #include "elap.h"
#include "aarp.h" #include "port.h"
#include "elap_defs.h"
#ifdef WIN32 #include "aarp.h"
#include <winsock.h>
#elif __linux__ #ifdef WIN32
#include <netinet/in.h> #include <winsock.h>
#endif #elif __linux__
#include <netinet/in.h>
struct amt_entry_t #endif
{
struct at_addr_t protocol; struct amt_entry_t
struct ether_addr_t hardware; {
struct at_addr_t protocol;
struct amt_entry_t* next; struct ether_addr_t hardware;
};
struct amt_entry_t* next;
typedef struct amt_entry_t* amt_t; };
static amt_t amt = 0; typedef struct amt_entry_t* amt_t;
static unsigned int retry_count; static amt_t amt = 0;
static clock_t retry_timer;
static unsigned int retry_count;
static clock_t retry_timer;
void aarp_init()
{
aarp_retry_reset(); void aarp_init()
} {
aarp_retry_reset();
void aarp_shutdown() }
{
struct amt_entry_t* entry = amt; void aarp_shutdown()
while (entry) {
{ struct amt_entry_t* entry = amt;
struct amt_entry_t* next = entry->next; while (entry)
free(entry); {
entry = next; struct amt_entry_t* next = entry->next;
} free(entry);
} entry = next;
}
//// }
static void aarp_send_packet(enum AARP_FUNCTION function, const struct at_addr_t* source_at_addr, const struct at_addr_t* dest_at_addr, const struct ether_addr_t* dest_hw_addr) ////
{
if (source_at_addr && dest_at_addr && dest_hw_addr) static void aarp_send_packet(enum AARP_FUNCTION function, const struct at_addr_t* source_at_addr, const struct at_addr_t* dest_at_addr, const struct ether_addr_t* dest_hw_addr)
{ {
struct aarp_header_t response; if (source_at_addr && dest_at_addr && dest_hw_addr)
response.hardware_type = htons(AARP_HARDWARE_ETHER); {
response.protocol_type = htons(AARP_PROTOCOL_TYPE); struct aarp_header_t response;
response.hw_addr_len = AARP_HW_ADDR_LEN; response.hardware_type = htons(AARP_HARDWARE_ETHER);
response.protocol_addr_len = AARP_PROTOCOL_ADDR_LEN; response.protocol_type = htons(AARP_PROTOCOL_TYPE);
response.function = htons(function); response.hw_addr_len = AARP_HW_ADDR_LEN;
response.protocol_addr_len = AARP_PROTOCOL_ADDR_LEN;
memcpy(&response.source_proto_addr.addr, source_at_addr, sizeof(response.source_proto_addr.addr)); response.function = htons(function);
response.source_proto_addr.addr.network = htons(response.source_proto_addr.addr.network);
response.source_proto_addr.zero = 0x00; memcpy(&response.source_proto_addr.addr, source_at_addr, sizeof(response.source_proto_addr.addr));
response.source_proto_addr.addr.network = htons(response.source_proto_addr.addr.network);
memcpy(&response.dest_proto_addr.addr, dest_at_addr, sizeof(response.dest_proto_addr.addr)); response.source_proto_addr.zero = 0x00;
response.dest_proto_addr.addr.network = htons(response.dest_proto_addr.addr.network);
response.dest_proto_addr.zero = 0x00; memcpy(&response.dest_proto_addr.addr, dest_at_addr, sizeof(response.dest_proto_addr.addr));
response.dest_proto_addr.addr.network = htons(response.dest_proto_addr.addr.network);
memcpy(response.source_hw_addr.mac, elap_get_mac()->mac, sizeof(response.source_hw_addr.mac)); response.dest_proto_addr.zero = 0x00;
memcpy(response.dest_hw_addr.mac, &dest_hw_addr->mac, sizeof(response.dest_hw_addr.mac)); memcpy(response.source_hw_addr.mac, elap_get_mac()->mac, sizeof(response.source_hw_addr.mac));
if (dest_hw_addr == &HW_ZERO) memcpy(response.dest_hw_addr.mac, &dest_hw_addr->mac, sizeof(response.dest_hw_addr.mac));
elap_send(&HW_APPLETALK_BROADCAST, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
else if (dest_hw_addr == &HW_ZERO)
elap_send(&response.dest_hw_addr, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response); elap_send(&HW_APPLETALK_BROADCAST, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
} else
} elap_send(&response.dest_hw_addr, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
}
void aarp_probe(const struct at_addr_t* addr) }
{
if (addr) void aarp_probe(const struct at_addr_t* addr)
{ {
aarp_send_packet(AARP_FUNCTION_PROBE, addr, addr, &HW_ZERO); if (addr)
} {
} aarp_send_packet(AARP_FUNCTION_PROBE, addr, addr, &HW_ZERO);
}
static void aarp_request(const struct at_addr_t* addr) }
{
if (addr) static void aarp_request(const struct at_addr_t* addr)
{ {
aarp_send_packet(AARP_FUNCTION_REQUEST, atbridge_get_addr(), addr, &HW_ZERO); if (addr)
} {
} aarp_send_packet(AARP_FUNCTION_REQUEST, atbridge_get_addr(), addr, &HW_ZERO);
}
//// }
static struct amt_entry_t* amt_lookup_entry_hardware(const struct ether_addr_t* hardware) ////
{
if (hardware) static struct amt_entry_t* amt_lookup_entry_hardware(const struct ether_addr_t* hardware)
{ {
struct amt_entry_t* entry = amt; if (hardware)
while (entry) {
{ struct amt_entry_t* entry = amt;
if (memcmp(&entry->hardware, hardware, sizeof(entry->hardware)) == 0) while (entry)
return entry; {
entry = entry->next; if (memcmp(&entry->hardware, hardware, sizeof(entry->hardware)) == 0)
} return entry;
} entry = entry->next;
return 0; }
} }
return 0;
static struct amt_entry_t* amt_lookup_entry_protocol(const struct at_addr_t* protocol) }
{
if (protocol) static struct amt_entry_t* amt_lookup_entry_protocol(const struct at_addr_t* protocol)
{ {
struct amt_entry_t* entry = amt; if (protocol)
while (entry) {
{ struct amt_entry_t* entry = amt;
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0) while (entry)
return entry; {
entry = entry->next; if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
} return entry;
} entry = entry->next;
return 0; }
} }
return 0;
static void amt_delete_entry_protocol(const struct at_addr_t* protocol) }
{
if (protocol) static void amt_delete_entry_protocol(const struct at_addr_t* protocol)
{ {
struct amt_entry_t* entry = amt; if (protocol)
struct amt_entry_t* previous = amt; {
while (entry) struct amt_entry_t* entry = amt;
{ struct amt_entry_t* previous = amt;
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0) while (entry)
{ {
previous->next = entry->next; if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
free(entry); {
break; previous->next = entry->next;
} free(entry);
previous = entry; break;
entry = entry->next; }
} previous = entry;
} entry = entry->next;
} }
}
static void amt_add(const struct at_addr_t* protocol, const struct ether_addr_t* hardware) }
{
// Does an entry matching one of the protocol or hardware addresses exist? If so, update it. static void amt_add(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol); {
if (entry) // Does an entry matching one of the protocol or hardware addresses exist? If so, update it.
{ struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
memcpy(&entry->hardware, hardware, sizeof(entry->hardware)); if (entry)
return; {
} memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
return;
entry = amt_lookup_entry_hardware(hardware); }
if (entry)
{ entry = amt_lookup_entry_hardware(hardware);
memcpy(&entry->protocol, protocol, sizeof(entry->protocol)); if (entry)
return; {
} memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
return;
// Otherwise, add a new entry. }
entry = (struct amt_entry_t*)malloc(sizeof(struct amt_entry_t));
memcpy(&entry->hardware, hardware, sizeof(entry->hardware)); // Otherwise, add a new entry.
memcpy(&entry->protocol, protocol, sizeof(entry->protocol)); entry = (struct amt_entry_t*)malloc(sizeof(struct amt_entry_t));
entry->next = amt; memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
amt = entry; memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
} entry->next = amt;
amt = entry;
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol) }
{
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol); const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol)
if (entry) {
{ struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
aarp_retry_reset(); if (entry)
return (const struct ether_addr_t*)&entry->hardware; {
} aarp_retry_reset();
else return (const struct ether_addr_t*)&entry->hardware;
{ }
// The AMT doesn't have this protocol address so issue a request at no more than the AARP_PROBE_INTERVAL period. else
if (((clock() - retry_timer) >= (AARP_REQUEST_INTERVAL * CLOCKS_PER_SEC / 1000)) && {
(retry_count > 0)) // The AMT doesn't have this protocol address so issue a request at no more than the AARP_PROBE_INTERVAL period.
{ if (((clock() - retry_timer) >= (AARP_REQUEST_INTERVAL * CLOCKS_PER_SEC / 1000)) &&
aarp_request(protocol); (retry_count > 0))
{
retry_count--; aarp_request(protocol);
retry_timer = clock();
retry_count--;
//atbridge_printf("AARP request count %d timer %d.\n", retry_count, retry_timer); retry_timer = clock();
}
//atbridge_printf("AARP request count %d timer %d.\n", retry_count, retry_timer);
return 0; }
}
} return 0;
}
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware) }
{
struct amt_entry_t* entry = amt_lookup_entry_hardware(hardware); const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware)
if (entry) {
return (const struct at_addr_t*)&entry->protocol; struct amt_entry_t* entry = amt_lookup_entry_hardware(hardware);
else if (entry)
return 0; return (const struct at_addr_t*)&entry->protocol;
} else
return 0;
bool aarp_retry() }
{
return retry_count > 0; bool aarp_retry()
} {
return retry_count > 0;
void aarp_retry_reset() }
{
retry_count = AARP_REQUEST_COUNT; void aarp_retry_reset()
retry_timer = clock(); {
} retry_count = AARP_REQUEST_COUNT;
retry_timer = clock();
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware) }
{
amt_add(protocol, hardware); void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
} {
amt_add(protocol, hardware);
bool aarp_address_used(const struct at_addr_t* protocol) }
{
// reference 2-8 bool aarp_address_used(const struct at_addr_t* protocol)
if (protocol) {
{ // reference 2-8
// Check for reserved node numbers, per reference 3-9. if (protocol)
if (protocol->node == 0x00 || protocol->node == 0xfe || protocol->node == 0xff) {
return true; // Check for reserved node numbers, per reference 3-9.
if (protocol->node == 0x00 || protocol->node == 0xfe || protocol->node == 0xff)
// Look for the address in the AMT. If it's there, another node is using this address. return true;
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
if (entry) // Look for the address in the AMT. If it's there, another node is using this address.
return true; struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
if (entry)
// Try a probe. If this address is in use, another node will reply with an AARP RESPONSE packet. return true;
// Return true to advise the caller that the address is not known to be in use. The caller should
// retry aarp_try_address() every 200 ms (AARP_PROBE_INTERVAL) and 10 times (AARP_PROBE_COUNT), // Try a probe. If this address is in use, another node will reply with an AARP RESPONSE packet.
// per the AARP protocol definition, before choosing this address. // Return true to advise the caller that the address is not known to be in use. The caller should
aarp_probe(protocol); // retry aarp_try_address() every 200 ms (AARP_PROBE_INTERVAL) and 10 times (AARP_PROBE_COUNT),
return false; // per the AARP protocol definition, before choosing this address.
} aarp_probe(protocol);
return false; return false;
} }
return false;
//// }
void aarp_handle_packet(const struct aarp_header_t* aarp) ////
{
if (aarp && void aarp_handle_packet(const struct aarp_header_t* aarp)
aarp->hardware_type == AARP_HARDWARE_ETHER && {
aarp->protocol_type == AARP_PROTOCOL_TYPE && if (aarp &&
aarp->hw_addr_len == AARP_HW_ADDR_LEN && aarp->hardware_type == AARP_HARDWARE_ETHER &&
aarp->protocol_addr_len == AARP_PROTOCOL_ADDR_LEN) aarp->protocol_type == AARP_PROTOCOL_TYPE &&
{ aarp->hw_addr_len == AARP_HW_ADDR_LEN &&
switch (aarp->function) aarp->protocol_addr_len == AARP_PROTOCOL_ADDR_LEN)
{ {
case AARP_FUNCTION_REQUEST: switch (aarp->function)
if (((aarp->dest_proto_addr.addr.network == atbridge_get_net()) || {
(aarp->dest_proto_addr.addr.network == 0x00 /* reference 4-6 */)) && case AARP_FUNCTION_REQUEST:
(aarp->dest_proto_addr.addr.node == atbridge_get_node())) if (((aarp->dest_proto_addr.addr.network == atbridge_get_net()) ||
{ (aarp->dest_proto_addr.addr.network == 0x00 /* reference 4-6 */)) &&
// Generate a response for the AARP request. (aarp->dest_proto_addr.addr.node == atbridge_get_node()))
aarp_send_packet(AARP_FUNCTION_RESPONSE, &aarp->dest_proto_addr.addr, &aarp->source_proto_addr.addr, &aarp->source_hw_addr); {
} // Generate a response for the AARP request.
break; aarp_send_packet(AARP_FUNCTION_RESPONSE, &aarp->dest_proto_addr.addr, &aarp->source_proto_addr.addr, &aarp->source_hw_addr);
case AARP_FUNCTION_RESPONSE: }
aarp_glean(&aarp->source_proto_addr.addr, &aarp->source_hw_addr); break;
aarp_glean(&aarp->dest_proto_addr.addr, &aarp->dest_hw_addr); case AARP_FUNCTION_RESPONSE:
break; aarp_glean(&aarp->source_proto_addr.addr, &aarp->source_hw_addr);
case AARP_FUNCTION_PROBE: aarp_glean(&aarp->dest_proto_addr.addr, &aarp->dest_hw_addr);
// AMT entry aging, method 2, reference 2-11 break;
amt_delete_entry_protocol(&aarp->dest_proto_addr.addr); case AARP_FUNCTION_PROBE:
break; // AMT entry aging, method 2, reference 2-11
default: amt_delete_entry_protocol(&aarp->dest_proto_addr.addr);
break; break;
} default:
} break;
} }
}
}

View File

@ -1,37 +1,39 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct at_addr_t; */
struct aarp_header_t;
struct ether_addr_t; struct at_addr_t;
struct aarp_header_t;
void aarp_init(); struct ether_addr_t;
void aarp_shutdown();
void aarp_init();
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol); void aarp_shutdown();
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware);
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol);
bool aarp_retry(); const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware);
void aarp_retry_reset();
bool aarp_retry();
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware); void aarp_retry_reset();
bool aarp_address_used(const struct at_addr_t* protocol); void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware);
void aarp_handle_packet(const struct aarp_header_t* aarp); bool aarp_address_used(const struct at_addr_t* protocol);
void aarp_handle_packet(const struct aarp_header_t* aarp);

View File

@ -1,137 +1,139 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
typedef byte at_node_t; */
static const at_node_t at_broadcast_node = 0xFF;
typedef byte at_node_t;
typedef word16 at_network_t; static const at_node_t at_broadcast_node = 0xFF;
#pragma pack(push, 1) typedef word16 at_network_t;
struct at_addr_t
{ #pragma pack(push, 1)
at_network_t network; struct at_addr_t
at_node_t node; {
}; at_network_t network;
#pragma pack(pop) at_node_t node;
};
enum LAP_TYPES { /* reference C-6 */ #pragma pack(pop)
LAP_DDP_SHORT = 0x01,
LAP_DDP_LONG = 0x02 enum LAP_TYPES { /* reference C-6 */
}; LAP_DDP_SHORT = 0x01,
LAP_DDP_LONG = 0x02
enum DDP_SOCKETS { /* reference C-7 */ };
DDP_SOCKET_INVALID_00 = 0x00,
DDP_SOCKET_RTMP = 0x01, enum DDP_SOCKETS { /* reference C-7 */
DDP_SOCKET_NIS = 0x02, DDP_SOCKET_INVALID_00 = 0x00,
DDP_SOCKET_ECHO = 0x04, DDP_SOCKET_RTMP = 0x01,
DDP_SOCKET_ZIS = 0x06, DDP_SOCKET_NIS = 0x02,
DDP_SOCKET_INVALID_FF = 0xFF, DDP_SOCKET_ECHO = 0x04,
}; DDP_SOCKET_ZIS = 0x06,
DDP_SOCKET_INVALID_FF = 0xFF,
enum DDP_TYPES { /* reference C-6 */ };
DDP_TYPE_INVALID = 0x00,
DDP_TYPE_RTMP = 0x01, enum DDP_TYPES { /* reference C-6 */
DDP_TYPE_NBP = 0x02, DDP_TYPE_INVALID = 0x00,
DDP_TYPE_ATP = 0x03, DDP_TYPE_RTMP = 0x01,
DDP_TYPE_AEP = 0x04, DDP_TYPE_NBP = 0x02,
DDP_TYPE_RTMP_REQUEST = 0x05, DDP_TYPE_ATP = 0x03,
DDP_TYPE_ZIP = 0x06, DDP_TYPE_AEP = 0x04,
DDP_TYPE_ADSP = 0x07, DDP_TYPE_RTMP_REQUEST = 0x05,
DDP_TYPE_RESERVED_08 = 0x08, DDP_TYPE_ZIP = 0x06,
DDP_TYPE_RESERVED_09 = 0x09, DDP_TYPE_ADSP = 0x07,
DDP_TYPE_RESERVED_0A = 0x0A, DDP_TYPE_RESERVED_08 = 0x08,
DDP_TYPE_RESERVED_0B = 0x0B, DDP_TYPE_RESERVED_09 = 0x09,
DDP_TYPE_RESERVED_0C = 0x0C, DDP_TYPE_RESERVED_0A = 0x0A,
DDP_TYPE_RESERVED_0D = 0x0D, DDP_TYPE_RESERVED_0B = 0x0B,
DDP_TYPE_RESERVED_0E = 0x0E, DDP_TYPE_RESERVED_0C = 0x0C,
DDP_TYPE_RESERVED_0F = 0x0F DDP_TYPE_RESERVED_0D = 0x0D,
}; DDP_TYPE_RESERVED_0E = 0x0E,
DDP_TYPE_RESERVED_0F = 0x0F
#pragma pack(push, 1) };
struct DDP_LONG
{ #pragma pack(push, 1)
byte length[2]; struct DDP_LONG
word16 checksum; {
at_network_t dest_net; byte length[2];
at_network_t source_net; word16 checksum;
at_node_t dest_node; at_network_t dest_net;
at_node_t source_node; at_network_t source_net;
byte dest_socket; at_node_t dest_node;
byte source_socket; at_node_t source_node;
byte type; byte dest_socket;
}; byte source_socket;
byte type;
struct DDP_SHORT };
{
byte length[2]; struct DDP_SHORT
byte dest_socket; {
byte source_socket; byte length[2];
byte type; byte dest_socket;
}; byte source_socket;
byte type;
enum RTMP_FUNCTIONS { /* reference C-8*/ };
RTMP_FUNCTION_REQUEST = 0x01,
RTMP_FUNCTION_RDR_SPLIT = 0x02, enum RTMP_FUNCTIONS { /* reference C-8*/
RTMP_FUNCTION_RDR_NO_SPLIT = 0x03 RTMP_FUNCTION_REQUEST = 0x01,
}; RTMP_FUNCTION_RDR_SPLIT = 0x02,
RTMP_FUNCTION_RDR_NO_SPLIT = 0x03
struct rtmp_request_t };
{
byte function; struct rtmp_request_t
}; {
byte function;
struct rtmp_nonextended_data_t };
{
at_network_t net; struct rtmp_nonextended_data_t
byte id_length; {
at_node_t node; at_network_t net;
word16 zero; byte id_length;
byte delimiter; at_node_t node;
}; word16 zero;
byte delimiter;
struct rtmp_nonextended_response_t };
{
at_network_t net; struct rtmp_nonextended_response_t
byte id_length; {
at_node_t node; at_network_t net;
}; byte id_length;
at_node_t node;
struct rtmp_extended_data_t };
{
at_network_t net; struct rtmp_extended_data_t
byte id_length; {
at_node_t node; at_network_t net;
}; byte id_length;
at_node_t node;
struct rtmp_nonextended_tuple_t };
{
at_network_t net; struct rtmp_nonextended_tuple_t
byte distance; {
}; at_network_t net;
byte distance;
struct rtmp_extended_tuple_t };
{
at_network_t range_start; struct rtmp_extended_tuple_t
byte distance; {
at_network_t range_end; at_network_t range_start;
byte delimiter; byte distance;
}; at_network_t range_end;
byte delimiter;
static const byte RTMP_TUPLE_DELIMITER = 0x82; };
#pragma pack(pop)
static const byte RTMP_TUPLE_DELIMITER = 0x82;
#pragma pack(pop)

View File

@ -1,426 +1,428 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** This module is the "heart" of the bridge and provides the connection between the ELAP and LLAP ports. **/ */
#include <stdbool.h> /** This module is the "heart" of the bridge and provides the connection between the ELAP and LLAP ports. **/
#include "../defc.h"
#include <stddef.h> #include <stdbool.h>
#include <time.h> #include "../defc.h"
#include "atbridge.h" #include <stddef.h>
#include "port.h" #include <time.h>
#include "elap.h" #include "atbridge.h"
#include "llap.h" #include "port.h"
#include "aarp.h" #include "elap.h"
#include "llap.h"
#ifdef WIN32 #include "aarp.h"
#include <winsock.h>
#elif __linux__ #ifdef WIN32
#include <netinet/in.h> #include <winsock.h>
#endif #elif __linux__
#include <netinet/in.h>
extern struct packet_port_t elap_port; #endif
static bool diagnostics = false; extern struct packet_port_t elap_port;
static bool sent_rtmp_request = false;
static bool diagnostics = false;
static struct at_addr_t local_address = { 0, 0 }; static bool sent_rtmp_request = false;
static const at_network_t NET_STARTUP_LOW = 0xFF00; static struct at_addr_t local_address = { 0, 0 };
static const at_network_t NET_STARTUP_HIGH = 0xFFFE;
static const at_node_t NODE_STARTUP_LOW = 0x01; static const at_network_t NET_STARTUP_LOW = 0xFF00;
static const at_node_t NODE_STARTUP_HIGH = 0xFE; static const at_network_t NET_STARTUP_HIGH = 0xFFFE;
static const at_node_t NODE_STARTUP_LOW = 0x01;
static void send_rtmp_request(); static const at_node_t NODE_STARTUP_HIGH = 0xFE;
bool atbridge_init() static void send_rtmp_request();
{
// If the GS reboots, we may try to reinitialize the bridge. If this is the case, keep the old address and AMT. bool atbridge_init()
if (local_address.network == 0) {
{ // If the GS reboots, we may try to reinitialize the bridge. If this is the case, keep the old address and AMT.
// Obtain a provisional node address and startup range network. if (local_address.network == 0)
// {
// This isn't correct for an extended network (like ELAP) but works adequately on small networks. // Obtain a provisional node address and startup range network.
// The bridge should follow the complicated process on page 4-9 to obtain the network and node number. //
srand((unsigned int)time(0)); // This isn't correct for an extended network (like ELAP) but works adequately on small networks.
local_address.network = (at_network_t)((double)rand()/RAND_MAX * (NET_STARTUP_HIGH - NET_STARTUP_LOW) + NET_STARTUP_LOW); // The bridge should follow the complicated process on page 4-9 to obtain the network and node number.
local_address.node = (at_node_t)((double)rand()/RAND_MAX + (NODE_STARTUP_HIGH - NODE_STARTUP_LOW) + 0x01); srand((unsigned int)time(0));
local_address.network = (at_network_t)((double)rand()/RAND_MAX * (NET_STARTUP_HIGH - NET_STARTUP_LOW) + NET_STARTUP_LOW);
aarp_init(); local_address.node = (at_node_t)((double)rand()/RAND_MAX + (NODE_STARTUP_HIGH - NODE_STARTUP_LOW) + 0x01);
llap_init();
if (!elap_init()) aarp_init();
{ llap_init();
atbridge_shutdown(); if (!elap_init())
return false; {
} atbridge_shutdown();
} return false;
return true; }
} }
return true;
void atbridge_shutdown() }
{
llap_shutdown(); void atbridge_shutdown()
elap_shutdown(); {
aarp_shutdown(); llap_shutdown();
} elap_shutdown();
aarp_shutdown();
void atbridge_set_diagnostics(bool enabled) }
{
diagnostics = enabled; void atbridge_set_diagnostics(bool enabled)
} {
diagnostics = enabled;
bool atbridge_get_diagnostics() }
{
return diagnostics; bool atbridge_get_diagnostics()
} {
return diagnostics;
void atbridge_printf(const char *fmt, ...) }
{
if (atbridge_get_diagnostics()) void atbridge_printf(const char *fmt, ...)
{ {
va_list args; if (atbridge_get_diagnostics())
va_start(args, fmt); {
vprintf(fmt, args); va_list args;
va_end(args); va_start(args, fmt);
} vprintf(fmt, args);
} va_end(args);
}
const struct at_addr_t* atbridge_get_addr() }
{
return &local_address; const struct at_addr_t* atbridge_get_addr()
} {
return &local_address;
const at_network_t atbridge_get_net() }
{
return local_address.network; const at_network_t atbridge_get_net()
} {
return local_address.network;
const at_node_t atbridge_get_node() }
{
return local_address.node; const at_node_t atbridge_get_node()
} {
return local_address.node;
void atbridge_set_net(at_network_t net) }
{
local_address.network = net; void atbridge_set_net(at_network_t net)
} {
local_address.network = net;
void atbridge_set_node(at_node_t node) }
{
local_address.node = node; void atbridge_set_node(at_node_t node)
} {
local_address.node = node;
bool atbridge_address_used(const struct at_addr_t* addr) }
{
if (!sent_rtmp_request) bool atbridge_address_used(const struct at_addr_t* addr)
send_rtmp_request(); {
return aarp_address_used(addr); if (!sent_rtmp_request)
} send_rtmp_request();
return aarp_address_used(addr);
/* Calculate a DDP checksum, per Apple's documented algorithm in 4-17 of "Inside AppleTalk". */ }
static word16 get_checksum(size_t size, byte data[])
{ /* Calculate a DDP checksum, per Apple's documented algorithm in 4-17 of "Inside AppleTalk". */
word16 cksum = 0; static word16 get_checksum(size_t size, byte data[])
for (unsigned int i = 0; i < size; i++) {
{ word16 cksum = 0;
cksum += data[i]; for (unsigned int i = 0; i < size; i++)
cksum = (cksum << 1) | ((cksum & 0x8000) >> 15); // roll left {
} cksum += data[i];
if (cksum == 0) cksum = (cksum << 1) | ((cksum & 0x8000) >> 15); // roll left
cksum = 0xffff; }
return cksum; if (cksum == 0)
} cksum = 0xffff;
return cksum;
static void calculate_checksum(struct packet_t* packet) }
{
if (packet && packet->data && (packet->size >= sizeof(struct DDP_LONG)) && (packet->type == LAP_DDP_LONG)) static void calculate_checksum(struct packet_t* packet)
{ {
struct DDP_LONG* header = (struct DDP_LONG*)(packet->data); if (packet && packet->data && (packet->size >= sizeof(struct DDP_LONG)) && (packet->type == LAP_DDP_LONG))
header->checksum = htons(get_checksum( {
packet->size - offsetof(struct DDP_LONG, dest_net), struct DDP_LONG* header = (struct DDP_LONG*)(packet->data);
(byte*)&header->dest_net)); header->checksum = htons(get_checksum(
} packet->size - offsetof(struct DDP_LONG, dest_net),
} (byte*)&header->dest_net));
}
/* Convert a long-form DDP header to a short-form header. This function only converts the headers. */ }
static word16 convert_ddp_header_to_short(const struct DDP_LONG* in, struct DDP_SHORT* out)
{ /* Convert a long-form DDP header to a short-form header. This function only converts the headers. */
word16 size; static word16 convert_ddp_header_to_short(const struct DDP_LONG* in, struct DDP_SHORT* out)
{
if (!in || !out) word16 size;
return 0;
if (!in || !out)
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) - (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT)); return 0;
out->length[0] = (size >> 8) & 0x03; size = ((in->length[0] & 0x3) << 8) + (in->length[1]) - (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
out->length[1] = size & 0xff;
out->length[0] = (size >> 8) & 0x03;
out->dest_socket = in->dest_socket; out->length[1] = size & 0xff;
out->source_socket = in->source_socket;
out->dest_socket = in->dest_socket;
out->type = in->type; out->source_socket = in->source_socket;
return size; out->type = in->type;
}
return size;
/* Convert a short-form DDP header to a long-form header. ELAP requires long-form, but LLAP often uses short-form. */ }
/* This function only converts the headers. */
static word16 convert_ddp_header_to_long(const struct at_addr_t dest, const struct at_addr_t source, const struct DDP_SHORT* in, struct DDP_LONG* out) /* Convert a short-form DDP header to a long-form header. ELAP requires long-form, but LLAP often uses short-form. */
{ /* This function only converts the headers. */
word16 size; static word16 convert_ddp_header_to_long(const struct at_addr_t dest, const struct at_addr_t source, const struct DDP_SHORT* in, struct DDP_LONG* out)
{
if (!in || !out) word16 size;
return 0;
if (!in || !out)
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) + (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT)); return 0;
out->length[0] = (size >> 8) & 0x03;
out->length[1] = size & 0xff; size = ((in->length[0] & 0x3) << 8) + (in->length[1]) + (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
out->length[0] = (size >> 8) & 0x03;
out->checksum = 0x0000; /* 0x0000 == no checksum calculated, reference 4-17 */ out->length[1] = size & 0xff;
if (dest.network) out->checksum = 0x0000; /* 0x0000 == no checksum calculated, reference 4-17 */
out->dest_net = dest.network;
else if (dest.network)
out->dest_net = atbridge_get_net(); out->dest_net = dest.network;
out->dest_net = (at_network_t)htons(out->dest_net); else
out->dest_net = atbridge_get_net();
if (source.network) out->dest_net = (at_network_t)htons(out->dest_net);
out->source_net = source.network;
else if (source.network)
out->source_net = atbridge_get_net(); out->source_net = source.network;
out->source_net = (at_network_t)htons(out->source_net); else
out->source_net = atbridge_get_net();
out->dest_node = dest.node; out->source_net = (at_network_t)htons(out->source_net);
out->source_node = source.node;
out->dest_node = dest.node;
out->dest_socket = in->dest_socket; out->source_node = source.node;
out->source_socket = in->source_socket;
out->dest_socket = in->dest_socket;
out->type = in->type; out->source_socket = in->source_socket;
return size; out->type = in->type;
}
return size;
/* Convert a short-form DDP packet to a long-form packet. */ }
/* This function converts an entire packet, not just the header. */
static void convert_ddp_packet_to_long(struct packet_t* packet) /* Convert a short-form DDP packet to a long-form packet. */
{ /* This function converts an entire packet, not just the header. */
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data && (packet->size >= sizeof(struct DDP_SHORT))) static void convert_ddp_packet_to_long(struct packet_t* packet)
{ {
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data; if (packet && (packet->type == LAP_DDP_SHORT) && packet->data && (packet->size >= sizeof(struct DDP_SHORT)))
{
const size_t payload_size = packet->size - sizeof(struct DDP_SHORT); struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_LONG));
struct DDP_LONG* header_long = (struct DDP_LONG*)data; const size_t payload_size = packet->size - sizeof(struct DDP_SHORT);
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_LONG));
const word16 size = convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long); struct DDP_LONG* header_long = (struct DDP_LONG*)data;
packet->dest.network = ntohs(header_long->dest_net);
packet->source.network = ntohs(header_long->source_net); const word16 size = convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
packet->dest.network = ntohs(header_long->dest_net);
memcpy(data + sizeof(struct DDP_LONG), packet->data + sizeof(struct DDP_SHORT), payload_size); packet->source.network = ntohs(header_long->source_net);
packet->type = LAP_DDP_LONG; memcpy(data + sizeof(struct DDP_LONG), packet->data + sizeof(struct DDP_SHORT), payload_size);
packet->size = size;
packet->type = LAP_DDP_LONG;
// Replace the original short-form packet data. packet->size = size;
free(packet->data);
packet->data = data; // Replace the original short-form packet data.
free(packet->data);
calculate_checksum(packet); packet->data = data;
}
} calculate_checksum(packet);
}
/* Convert a long-form DDP packet to short-form. */ }
static void convert_ddp_packet_to_short(struct packet_t* packet)
{ /* Convert a long-form DDP packet to short-form. */
if (packet && (packet->type == LAP_DDP_LONG) && packet->data) static void convert_ddp_packet_to_short(struct packet_t* packet)
{ {
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data; if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
{
const size_t payload_size = packet->size - sizeof(struct DDP_LONG); struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_SHORT));
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data; const size_t payload_size = packet->size - sizeof(struct DDP_LONG);
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_SHORT));
const word16 size = convert_ddp_header_to_short(header_long, header_short); struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
memcpy(data + sizeof(struct DDP_SHORT), packet->data + sizeof(struct DDP_LONG), payload_size); const word16 size = convert_ddp_header_to_short(header_long, header_short);
packet->type = LAP_DDP_SHORT; memcpy(data + sizeof(struct DDP_SHORT), packet->data + sizeof(struct DDP_LONG), payload_size);
packet->size = size;
packet->type = LAP_DDP_SHORT;
free(packet->data); packet->size = size;
packet->data = data;
} free(packet->data);
} packet->data = data;
}
/*static void convert_rtmp_to_extended(struct packet_t* packet) }
{
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data) /*static void convert_rtmp_to_extended(struct packet_t* packet)
{ {
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data; if (packet && (packet->type == LAP_DDP_SHORT) && packet->data)
if (header_short->type != DDP_TYPE_RTMP || header_short->dest_socket != DDP_SOCKET_RTMP) {
return; struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
if (header_short->type != DDP_TYPE_RTMP || header_short->dest_socket != DDP_SOCKET_RTMP)
struct rtmp_nonextended_data_t* in = (struct rtmp_nonextended_data_t*)(packet->data + sizeof(struct DDP_SHORT)); return;
// Construct a new long-form DDP packet header. struct rtmp_nonextended_data_t* in = (struct rtmp_nonextended_data_t*)(packet->data + sizeof(struct DDP_SHORT));
size_t size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_extended_data_t);
byte* data = (byte*)malloc(size); // Construct a new long-form DDP packet header.
struct DDP_LONG* header_long = (struct DDP_LONG*)data; size_t size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_extended_data_t);
convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long); byte* data = (byte*)malloc(size);
struct DDP_LONG* header_long = (struct DDP_LONG*)data;
struct rtmp_extended_data_t* out = (struct rtmp_extended_data_t*)(data + sizeof(struct DDP_LONG)); convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
out->net = in->net;
out->id_length = in->id_length; struct rtmp_extended_data_t* out = (struct rtmp_extended_data_t*)(data + sizeof(struct DDP_LONG));
out->node = in->node; out->net = in->net;
out->id_length = in->id_length;
// Copy the routing tuples. out->node = in->node;
struct rtmp_nonextended_tuple_t* in_tuple = (struct rtmp_nonextended_tuple_t*)(packet->data + sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_data_t));
struct rtmp_extended_tuple_t* out_tuple = (struct rtmp_extended_tuple_t*)(data + size); // Copy the routing tuples.
while ((byte*)in_tuple < (packet->data + packet->size)) struct rtmp_nonextended_tuple_t* in_tuple = (struct rtmp_nonextended_tuple_t*)(packet->data + sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_data_t));
{ struct rtmp_extended_tuple_t* out_tuple = (struct rtmp_extended_tuple_t*)(data + size);
size += sizeof(struct rtmp_extended_tuple_t); while ((byte*)in_tuple < (packet->data + packet->size))
realloc(data, size); {
out_tuple->range_start = in_tuple->net; size += sizeof(struct rtmp_extended_tuple_t);
out_tuple->distance = in_tuple->distance | 0x80; realloc(data, size);
out_tuple->range_end = in_tuple->net; out_tuple->range_start = in_tuple->net;
out_tuple->delimiter = RTMP_TUPLE_DELIMITER; out_tuple->distance = in_tuple->distance | 0x80;
in_tuple++; out_tuple->range_end = in_tuple->net;
} out_tuple->delimiter = RTMP_TUPLE_DELIMITER;
in_tuple++;
free(packet->data); }
packet->data = data;
packet->size = size; free(packet->data);
packet->type = LAP_DDP_LONG; packet->data = data;
} packet->size = size;
}*/ packet->type = LAP_DDP_LONG;
}
static void convert_rtmp_to_nonextended(struct packet_t* packet) }*/
{
if (packet && (packet->type == LAP_DDP_LONG) && packet->data) static void convert_rtmp_to_nonextended(struct packet_t* packet)
{ {
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data; if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP) {
return; struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG)); return;
size_t size = sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_response_t); struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
byte* data = (byte*)malloc(size);
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data; size_t size = sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_response_t);
convert_ddp_header_to_short(header_long, header_short); byte* data = (byte*)malloc(size);
header_short->length[0] = (size >> 8) & 0x03; struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
header_short->length[1] = size & 0xff; convert_ddp_header_to_short(header_long, header_short);
header_short->length[0] = (size >> 8) & 0x03;
struct rtmp_nonextended_response_t* out = (struct rtmp_nonextended_response_t*)(data + sizeof(struct DDP_SHORT)); header_short->length[1] = size & 0xff;
out->net = in->net;
out->id_length = in->id_length; struct rtmp_nonextended_response_t* out = (struct rtmp_nonextended_response_t*)(data + sizeof(struct DDP_SHORT));
out->node = in->node; out->net = in->net;
out->id_length = in->id_length;
/*rtmp_extended_tuple_t* in_tuple = (rtmp_extended_tuple_t*)(packet->data + sizeof(DDP_LONG) + sizeof(rtmp_extended_data_t)); out->node = in->node;
rtmp_nonextended_tuple_t* out_tuple = (rtmp_nonextended_tuple_t*)(data + size);
while ((byte*)in_tuple < (packet->data + packet->size)) /*rtmp_extended_tuple_t* in_tuple = (rtmp_extended_tuple_t*)(packet->data + sizeof(DDP_LONG) + sizeof(rtmp_extended_data_t));
{ rtmp_nonextended_tuple_t* out_tuple = (rtmp_nonextended_tuple_t*)(data + size);
size += sizeof(rtmp_nonextended_tuple_t); while ((byte*)in_tuple < (packet->data + packet->size))
realloc(data, size); {
out_tuple->net = in_tuple->range_start; size += sizeof(rtmp_nonextended_tuple_t);
out_tuple->distance = in_tuple->distance & 0x7f; realloc(data, size);
in_tuple++; out_tuple->net = in_tuple->range_start;
}*/ out_tuple->distance = in_tuple->distance & 0x7f;
in_tuple++;
free(packet->data); }*/
packet->data = data;
packet->size = size; free(packet->data);
packet->type = LAP_DDP_SHORT; packet->data = data;
} packet->size = size;
} packet->type = LAP_DDP_SHORT;
}
/* Learn our network number from RTMP packets. */ }
/* "Inside AppleTalk", section 4-8, describes this approach for non-extended networks.
Technically, we probably should be doing the more complicated extended network approach (also on 4-8), /* Learn our network number from RTMP packets. */
but the easy approach using RTMP seems adequate for now. */ /* "Inside AppleTalk", section 4-8, describes this approach for non-extended networks.
static void glean_net_from_rtmp(struct packet_t* packet) Technically, we probably should be doing the more complicated extended network approach (also on 4-8),
{ but the easy approach using RTMP seems adequate for now. */
if (packet && (packet->type == LAP_DDP_LONG) && packet->data) static void glean_net_from_rtmp(struct packet_t* packet)
{ {
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data; if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP) {
return; struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG)); return;
atbridge_set_net(ntohs(in->net)); struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
}
} atbridge_set_net(ntohs(in->net));
}
static void send_rtmp_request() }
{
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t)); static void send_rtmp_request()
{
packet->type = LAP_DDP_LONG; struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
packet->dest.network = atbridge_get_net();
packet->dest.node = 255; packet->type = LAP_DDP_LONG;
packet->source.network = atbridge_get_net(); packet->dest.network = atbridge_get_net();
packet->source.node = atbridge_get_node(); packet->dest.node = 255;
packet->next = 0; packet->source.network = atbridge_get_net();
packet->size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_request_t); packet->source.node = atbridge_get_node();
packet->data = (byte*)malloc(packet->size); packet->next = 0;
packet->size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_request_t);
struct DDP_LONG* header = (struct DDP_LONG*)packet->data; packet->data = (byte*)malloc(packet->size);
header->type = DDP_TYPE_RTMP_REQUEST;
header->source_net = htons(packet->source.network); struct DDP_LONG* header = (struct DDP_LONG*)packet->data;
header->source_node = packet->source.node; header->type = DDP_TYPE_RTMP_REQUEST;
header->source_socket = DDP_SOCKET_RTMP; header->source_net = htons(packet->source.network);
header->dest_net = htons(packet->dest.network); header->source_node = packet->source.node;
header->dest_node = packet->dest.node; header->source_socket = DDP_SOCKET_RTMP;
header->dest_socket = DDP_SOCKET_RTMP; header->dest_net = htons(packet->dest.network);
header->length[0] = (packet->size >> 8) & 0x03; header->dest_node = packet->dest.node;
header->length[1] = packet->size & 0xff; header->dest_socket = DDP_SOCKET_RTMP;
header->length[0] = (packet->size >> 8) & 0x03;
struct rtmp_request_t* request = (struct rtmp_request_t*)(packet->data + sizeof(struct DDP_LONG)); header->length[1] = packet->size & 0xff;
request->function = RTMP_FUNCTION_REQUEST;
struct rtmp_request_t* request = (struct rtmp_request_t*)(packet->data + sizeof(struct DDP_LONG));
calculate_checksum(packet); request->function = RTMP_FUNCTION_REQUEST;
elap_enqueue_out(packet); calculate_checksum(packet);
sent_rtmp_request = true;
} elap_enqueue_out(packet);
sent_rtmp_request = true;
void atbridge_process() }
{
elap_process(); void atbridge_process()
//llap_process(); {
elap_process();
struct packet_t* packet = elap_dequeue_in(); //llap_process();
if (packet)
{ struct packet_t* packet = elap_dequeue_in();
glean_net_from_rtmp(packet); if (packet)
convert_rtmp_to_nonextended(packet); {
// The GS should understand long-form DDP, but converting to short-form ought to slightly improve performance (fewer bytes for the GS to process). glean_net_from_rtmp(packet);
convert_ddp_packet_to_short(packet); convert_rtmp_to_nonextended(packet);
llap_enqueue_out(packet); // The GS should understand long-form DDP, but converting to short-form ought to slightly improve performance (fewer bytes for the GS to process).
} convert_ddp_packet_to_short(packet);
packet = llap_dequeue_in(); llap_enqueue_out(packet);
if (packet) }
{ packet = llap_dequeue_in();
// ELAP does not support short-form DDP, so convert such packets to long-form. if (packet)
convert_ddp_packet_to_long(packet); {
elap_enqueue_out(packet); // ELAP does not support short-form DDP, so convert such packets to long-form.
} convert_ddp_packet_to_long(packet);
} elap_enqueue_out(packet);
}
}

View File

@ -1,47 +1,49 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** */
ATBridge is a limited function AppleTalk bridge that allows GSPort to connect to an
EtherTalk network. The bridge has two ports, one the emulated LocalTalk port and the /**
other an EtherTalk Phase II port. ATBridge is a limited function AppleTalk bridge that allows GSPort to connect to an
EtherTalk network. The bridge has two ports, one the emulated LocalTalk port and the
Due to timing requirements of LocalTalk, it is not reasonable to transparently bridge other an EtherTalk Phase II port.
LLAP traffic to ELAP. For example, implementing the lapENQ/lapACK LLAP control packets
requires AARP queries on the ELAP port, which can't be reasonably done within the 200us Due to timing requirements of LocalTalk, it is not reasonable to transparently bridge
LLAP interframe gap. So, we must implement the local bridge functionality detailed LLAP traffic to ELAP. For example, implementing the lapENQ/lapACK LLAP control packets
in "Inside AppleTalk", including AARP, RTMP, ZIP, and DDP routing. requires AARP queries on the ELAP port, which can't be reasonably done within the 200us
**/ LLAP interframe gap. So, we must implement the local bridge functionality detailed
#include "atalk.h" in "Inside AppleTalk", including AARP, RTMP, ZIP, and DDP routing.
**/
bool atbridge_init(); #include "atalk.h"
void atbridge_shutdown();
void atbridge_process(); bool atbridge_init();
void atbridge_shutdown();
void atbridge_set_diagnostics(bool enabled); void atbridge_process();
bool atbridge_get_diagnostics();
void atbridge_printf(const char *fmt, ...); void atbridge_set_diagnostics(bool enabled);
bool atbridge_get_diagnostics();
const struct at_addr_t* atbridge_get_addr(); void atbridge_printf(const char *fmt, ...);
const at_network_t atbridge_get_net();
const at_node_t atbridge_get_node(); const struct at_addr_t* atbridge_get_addr();
void atbridge_set_net(at_network_t net); const at_network_t atbridge_get_net();
void atbridge_set_node(at_node_t node); const at_node_t atbridge_get_node();
bool atbridge_address_used(const struct at_addr_t* addr); void atbridge_set_net(at_network_t net);
void atbridge_set_node(at_node_t node);
bool atbridge_address_used(const struct at_addr_t* addr);

View File

@ -1,108 +1,108 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\arch\win32\pcap.h" /> <ClInclude Include="..\arch\win32\pcap.h" />
<ClInclude Include="aarp.h" /> <ClInclude Include="aarp.h" />
<ClInclude Include="atalk.h" /> <ClInclude Include="atalk.h" />
<ClInclude Include="atbridge.h" /> <ClInclude Include="atbridge.h" />
<ClInclude Include="elap.h" /> <ClInclude Include="elap.h" />
<ClInclude Include="elap_defs.h" /> <ClInclude Include="elap_defs.h" />
<ClInclude Include="llap.h" /> <ClInclude Include="llap.h" />
<ClInclude Include="pcap_delay.h" /> <ClInclude Include="pcap_delay.h" />
<ClInclude Include="port.h" /> <ClInclude Include="port.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="aarp.c" /> <ClCompile Include="aarp.c" />
<ClCompile Include="atbridge.c" /> <ClCompile Include="atbridge.c" />
<ClCompile Include="elap.c" /> <ClCompile Include="elap.c" />
<ClCompile Include="llap.c" /> <ClCompile Include="llap.c" />
<ClCompile Include="pcap_delay.c" /> <ClCompile Include="pcap_delay.c" />
<ClCompile Include="port.c" /> <ClCompile Include="port.c" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}</ProjectGuid> <ProjectGuid>{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>atbridge</RootNamespace> <RootNamespace>atbridge</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup /> <PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Lib> <Lib>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib> <Lib>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,66 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Resource Files"> <Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="llap.h"> <ClInclude Include="llap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="atbridge.h"> <ClInclude Include="atbridge.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="elap.h"> <ClInclude Include="elap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\pcap.h"> <ClInclude Include="..\arch\win32\pcap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="port.h"> <ClInclude Include="port.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="aarp.h"> <ClInclude Include="aarp.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="elap_defs.h"> <ClInclude Include="elap_defs.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="atalk.h"> <ClInclude Include="atalk.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="pcap_delay.h"> <ClInclude Include="pcap_delay.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="llap.c"> <ClCompile Include="llap.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="atbridge.c"> <ClCompile Include="atbridge.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="elap.c"> <ClCompile Include="elap.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="port.c"> <ClCompile Include="port.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="aarp.c"> <ClCompile Include="aarp.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="pcap_delay.c"> <ClCompile Include="pcap_delay.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,398 +1,400 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** This module implements the ELAP port of the bridge. **/ */
#include <stdbool.h> /** This module implements the ELAP port of the bridge. **/
#include "../defc.h"
#include "atbridge.h" #include <stdbool.h>
#include "elap.h" #include "../defc.h"
#include "port.h" #include "atbridge.h"
#include "aarp.h" #include "elap.h"
#include "elap_defs.h" #include "port.h"
#include "pcap_delay.h" #include "aarp.h"
#include "elap_defs.h"
#ifdef __CYGWIN__ #include "pcap_delay.h"
#include <Windows.h>
#include <NspAPI.h> #ifdef __CYGWIN__
#endif #include <Windows.h>
#ifdef WIN32 #include <NspAPI.h>
#include <winsock.h> #endif
#include <IPHlpApi.h> #ifdef WIN32
#endif #include <winsock.h>
#ifdef __linux__ #include <IPHlpApi.h>
#include <netinet/in.h> #endif
#include <netpacket/packet.h> #ifdef __linux__
#endif #include <netinet/in.h>
#include <netpacket/packet.h>
extern int g_ethernet_interface; #endif
static pcap_t* pcap_session; extern int g_ethernet_interface;
static struct packet_port_t elap_port; static pcap_t* pcap_session;
static struct ether_addr_t HW_LOCAL;
static struct packet_port_t elap_port;
/*static void dump_device_list(pcap_if_t* devices) static struct ether_addr_t HW_LOCAL;
{
int i = 0; /*static void dump_device_list(pcap_if_t* devices)
for(pcap_if_t* device = devices; device; device = device->next) {
{ int i = 0;
printf("%d. %s", ++i, device->name); for(pcap_if_t* device = devices; device; device = device->next)
if (device->description) {
printf(" (%s)\n", device->description); printf("%d. %s", ++i, device->name);
else if (device->description)
printf(" (No description available)\n"); printf(" (%s)\n", device->description);
} else
}*/ printf(" (No description available)\n");
}
static void elap_clone_host_mac(pcap_if_t* device) }*/
{
if (!device) static void elap_clone_host_mac(pcap_if_t* device)
return; {
if (!device)
#ifdef WIN32 return;
////
// Extract the device GUID, which Windows uses to identify the device. #ifdef WIN32
char* name = device->name; ////
while (name && *name != '{') // Extract the device GUID, which Windows uses to identify the device.
name++; char* name = device->name;
size_t guidLen = strlen(name); while (name && *name != '{')
name++;
//// size_t guidLen = strlen(name);
// Find and copy the device MAC address.
ULONG size = sizeof(IP_ADAPTER_ADDRESSES) * 15; ////
IP_ADAPTER_ADDRESSES* addresses = malloc(size); // Find and copy the device MAC address.
ULONG size = sizeof(IP_ADAPTER_ADDRESSES) * 15;
ULONG result = GetAdaptersAddresses(AF_UNSPEC, IP_ADAPTER_ADDRESSES* addresses = malloc(size);
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
ULONG result = GetAdaptersAddresses(AF_UNSPEC,
if (result == ERROR_BUFFER_OVERFLOW) GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
{
// The addresses buffer is too small. Allocate a bigger buffer. if (result == ERROR_BUFFER_OVERFLOW)
free(addresses); {
addresses = malloc(size); // The addresses buffer is too small. Allocate a bigger buffer.
result = GetAdaptersAddresses(AF_UNSPEC, free(addresses);
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size); addresses = malloc(size);
} result = GetAdaptersAddresses(AF_UNSPEC,
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
if (result == NO_ERROR) }
{
// Search for the desired adapter address. if (result == NO_ERROR)
IP_ADAPTER_ADDRESSES* current = addresses; {
while (current) // Search for the desired adapter address.
{ IP_ADAPTER_ADDRESSES* current = addresses;
if (current->PhysicalAddressLength == ETHER_ADDR_LEN && memcmp(current->AdapterName, name, guidLen) == 0) while (current)
{ {
memcpy(&HW_LOCAL.mac, &current->PhysicalAddress, sizeof(HW_LOCAL.mac)); if (current->PhysicalAddressLength == ETHER_ADDR_LEN && memcmp(current->AdapterName, name, guidLen) == 0)
break; {
} memcpy(&HW_LOCAL.mac, &current->PhysicalAddress, sizeof(HW_LOCAL.mac));
current = current->Next; break;
} }
} current = current->Next;
else }
{ }
halt_printf("ATBridge: Failed to find host MAC address (%d).", result); else
} {
halt_printf("ATBridge: Failed to find host MAC address (%d).", result);
free(addresses); }
#else
free(addresses);
#else
#ifdef AF_PACKET #ifdef AF_PACKET
struct pcap_addr* address; struct pcap_addr* address;
for (address = device->addresses; address != 0; address = address->next) for (address = device->addresses; address != 0; address = address->next)
if (address->addr->sa_family == AF_PACKET) if (address->addr->sa_family == AF_PACKET)
{ {
struct sockaddr_ll* ll = (struct sockaddr_ll*)address->addr; struct sockaddr_ll* ll = (struct sockaddr_ll*)address->addr;
memcpy(&HW_LOCAL.mac, ll->sll_addr, sizeof(HW_LOCAL.mac)); memcpy(&HW_LOCAL.mac, ll->sll_addr, sizeof(HW_LOCAL.mac));
} }
#endif #endif
#endif #endif
} }
const struct ether_addr_t* elap_get_mac() const struct ether_addr_t* elap_get_mac()
{ {
return &HW_LOCAL; return &HW_LOCAL;
} }
bool elap_init() bool elap_init()
{ {
port_init(&elap_port); port_init(&elap_port);
memcpy(&HW_LOCAL, &HW_LOCAL_DEFAULT, sizeof(HW_LOCAL)); memcpy(&HW_LOCAL, &HW_LOCAL_DEFAULT, sizeof(HW_LOCAL));
pcap_if_t* device; pcap_if_t* device;
pcap_if_t* alldevs; pcap_if_t* alldevs;
int i = 0; int i = 0;
char errbuf[PCAP_ERRBUF_SIZE]; char errbuf[PCAP_ERRBUF_SIZE];
// Load the PCAP library. // Load the PCAP library.
if (!pcapdelay_load()) if (!pcapdelay_load())
{ {
halt_printf("ATBridge: PCAP not available.\n"); halt_printf("ATBridge: PCAP not available.\n");
return false; return false;
} }
// Retrieve the device list. // Retrieve the device list.
if(pcapdelay_findalldevs(&alldevs, errbuf) == -1) if(pcapdelay_findalldevs(&alldevs, errbuf) == -1)
{ {
atbridge_printf("ATBridge: Error enumerating PCAP devices: %s\n", errbuf); atbridge_printf("ATBridge: Error enumerating PCAP devices: %s\n", errbuf);
return false; return false;
} }
//dump_device_list(alldevs); //dump_device_list(alldevs);
// Jump to the selected adapter. // Jump to the selected adapter.
for (device = alldevs, i = 0; i < g_ethernet_interface; device = device->next, i++); for (device = alldevs, i = 0; i < g_ethernet_interface; device = device->next, i++);
if (!device) if (!device)
{ {
halt_printf("ATBridge: PCAP device not found. Check interface number in settings.\n"); halt_printf("ATBridge: PCAP device not found. Check interface number in settings.\n");
return false; return false;
} }
// Clone the MAC address of the underlying interface. In certain configurations (e.g. Windows with an MS Loopback // Clone the MAC address of the underlying interface. In certain configurations (e.g. Windows with an MS Loopback
// interface), the interface, even in promiscous mode, filters foreign MAC addresses. // interface), the interface, even in promiscous mode, filters foreign MAC addresses.
elap_clone_host_mac(device); elap_clone_host_mac(device);
// Open the adapter, // Open the adapter,
if ((pcap_session = pcapdelay_open_live(device->name, // name of the device if ((pcap_session = pcapdelay_open_live(device->name, // name of the device
65536, // portion of the packet to capture. 65536, // portion of the packet to capture.
// 65536 grants that the whole packet will be captured on all the MACs. // 65536 grants that the whole packet will be captured on all the MACs.
1, // promiscuous mode (nonzero means promiscuous) 1, // promiscuous mode (nonzero means promiscuous)
1, // read timeout 1, // read timeout
errbuf // error buffer errbuf // error buffer
)) == NULL) )) == NULL)
{ {
halt_printf("ATBridge: Unable to open the adapter. Pcap does not support %s.\n", device->name); halt_printf("ATBridge: Unable to open the adapter. Pcap does not support %s.\n", device->name);
pcapdelay_freealldevs(alldevs); pcapdelay_freealldevs(alldevs);
return false; return false;
} }
// The device must support Ethernet because the bridge "speaks" EtherTalk. // The device must support Ethernet because the bridge "speaks" EtherTalk.
if (pcapdelay_datalink(pcap_session) == DLT_EN10MB) if (pcapdelay_datalink(pcap_session) == DLT_EN10MB)
{ {
pcapdelay_setnonblock(pcap_session, 1, errbuf); pcapdelay_setnonblock(pcap_session, 1, errbuf);
atbridge_printf("ATBridge: AppleTalk bridging using network device '%s' with Ethernet address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X.\n", atbridge_printf("ATBridge: AppleTalk bridging using network device '%s' with Ethernet address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X.\n",
device->description, HW_LOCAL.mac[0], HW_LOCAL.mac[1], HW_LOCAL.mac[2], HW_LOCAL.mac[3], HW_LOCAL.mac[4], HW_LOCAL.mac[5]); device->description, HW_LOCAL.mac[0], HW_LOCAL.mac[1], HW_LOCAL.mac[2], HW_LOCAL.mac[3], HW_LOCAL.mac[4], HW_LOCAL.mac[5]);
pcapdelay_freealldevs(alldevs); pcapdelay_freealldevs(alldevs);
return true; return true;
} }
else else
{ {
pcapdelay_close(pcap_session); pcapdelay_close(pcap_session);
pcap_session = 0; pcap_session = 0;
halt_printf("ATBridge: Selected network device %s must support Ethernet.\n", device->description); halt_printf("ATBridge: Selected network device %s must support Ethernet.\n", device->description);
pcapdelay_freealldevs(alldevs); pcapdelay_freealldevs(alldevs);
return false; return false;
} }
} }
void elap_shutdown() void elap_shutdown()
{ {
port_shutdown(&elap_port); port_shutdown(&elap_port);
if (pcap_session) if (pcap_session)
{ {
pcapdelay_close(pcap_session); pcapdelay_close(pcap_session);
pcap_session = 0; pcap_session = 0;
} }
pcapdelay_unload(); pcapdelay_unload();
} }
void elap_enqueue_out(struct packet_t* packet) void elap_enqueue_out(struct packet_t* packet)
{ {
enqueue_packet(&elap_port.out, packet); enqueue_packet(&elap_port.out, packet);
} }
struct packet_t* elap_dequeue_in() struct packet_t* elap_dequeue_in()
{ {
return dequeue(&elap_port.in); return dequeue(&elap_port.in);
} }
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[]) void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[])
{ {
if (pcap_session && dest && discriminator) if (pcap_session && dest && discriminator)
{ {
// Allocate heap space for the frame. // Allocate heap space for the frame.
const size_t frame_size = sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t) + size; const size_t frame_size = sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t) + size;
u_char* frame_data; u_char* frame_data;
size_t pad = 0; size_t pad = 0;
if (frame_size < ETHER_MIN_SIZE) if (frame_size < ETHER_MIN_SIZE)
pad = ETHER_MIN_SIZE - frame_size; pad = ETHER_MIN_SIZE - frame_size;
frame_data = (u_char*)malloc(frame_size + pad); frame_data = (u_char*)malloc(frame_size + pad);
// Build the 802.3 header. // Build the 802.3 header.
struct ethernet_header_t* ether = (struct ethernet_header_t*)frame_data; struct ethernet_header_t* ether = (struct ethernet_header_t*)frame_data;
memcpy(ether->dest.mac, dest, sizeof(ether->dest.mac)); memcpy(ether->dest.mac, dest, sizeof(ether->dest.mac));
memcpy(ether->source.mac, HW_LOCAL.mac, sizeof(ether->source.mac)); memcpy(ether->source.mac, HW_LOCAL.mac, sizeof(ether->source.mac));
ether->length = htons(frame_size - sizeof(struct ethernet_header_t)); ether->length = htons(frame_size - sizeof(struct ethernet_header_t));
// Build the 802.2 header. // Build the 802.2 header.
struct snap_header_t* snap = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t)); struct snap_header_t* snap = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t));
snap->dsap = SNAP_DSAP; snap->dsap = SNAP_DSAP;
snap->ssap = SNAP_SSAP; snap->ssap = SNAP_SSAP;
snap->control = SNAP_CONTROL; snap->control = SNAP_CONTROL;
memcpy(&snap->discriminator, discriminator, sizeof(snap->discriminator)); memcpy(&snap->discriminator, discriminator, sizeof(snap->discriminator));
// Add the data payload. // Add the data payload.
struct snap_header_t* payload = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t)); struct snap_header_t* payload = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
memcpy(payload, data, size); memcpy(payload, data, size);
// Add padding to meet minimum Ethernet frame size. // Add padding to meet minimum Ethernet frame size.
if (pad > 0) if (pad > 0)
memset(frame_data + frame_size, 0, pad); memset(frame_data + frame_size, 0, pad);
pcapdelay_sendpacket(pcap_session, frame_data, frame_size + pad); pcapdelay_sendpacket(pcap_session, frame_data, frame_size + pad);
} }
} }
static bool elap_send_one_queued() static bool elap_send_one_queued()
{ {
// Attempt to send one packet out the host network interface. // Attempt to send one packet out the host network interface.
struct packet_t* packet = queue_peek(&elap_port.out); struct packet_t* packet = queue_peek(&elap_port.out);
if (packet) if (packet)
{ {
// Find the MAC address. // Find the MAC address.
const struct ether_addr_t* dest; const struct ether_addr_t* dest;
if (packet->dest.node == at_broadcast_node) if (packet->dest.node == at_broadcast_node)
dest = &HW_APPLETALK_BROADCAST; dest = &HW_APPLETALK_BROADCAST;
else else
dest = aarp_request_hardware(&packet->dest); dest = aarp_request_hardware(&packet->dest);
// Send it. // Send it.
if (dest) if (dest)
{ {
elap_send(dest, &SNAP_APPLETALK, packet->size, packet->data); elap_send(dest, &SNAP_APPLETALK, packet->size, packet->data);
dequeue(&elap_port.out); dequeue(&elap_port.out);
free(packet->data); free(packet->data);
free(packet); free(packet);
} }
else else
{ {
// AARP does not have the needed hardware address. Give AARP time to obtain the address and keep the current packet. // AARP does not have the needed hardware address. Give AARP time to obtain the address and keep the current packet.
if (!aarp_retry()) if (!aarp_retry())
{ {
// However, if AARP has reached the retry limit, the packet is undeliverable. Discard the packet and move on. // However, if AARP has reached the retry limit, the packet is undeliverable. Discard the packet and move on.
atbridge_printf("ATBridge: AARP failed to find MAC address for network %d node %d. Dropping packet.\n", packet->dest.network, packet->dest.node); atbridge_printf("ATBridge: AARP failed to find MAC address for network %d node %d. Dropping packet.\n", packet->dest.network, packet->dest.node);
aarp_retry_reset(); aarp_retry_reset();
dequeue(&elap_port.out); dequeue(&elap_port.out);
free(packet->data); free(packet->data);
free(packet); free(packet);
} }
} }
return true; return true;
} }
else else
return false; return false;
} }
static void elap_send_all_queued() static void elap_send_all_queued()
{ {
while (elap_send_one_queued()); while (elap_send_one_queued());
} }
static bool elap_receive_one() static bool elap_receive_one()
{ {
if (!pcap_session) if (!pcap_session)
return false; return false;
struct pcap_pkthdr header; struct pcap_pkthdr header;
const u_char* packet = pcapdelay_next(pcap_session, &header); const u_char* packet = pcapdelay_next(pcap_session, &header);
if (packet) if (packet)
{ {
// Receive and process one packet from the host network interface. // Receive and process one packet from the host network interface.
//// ////
// Check the Ethernet 802.3 header. // Check the Ethernet 802.3 header.
const struct ethernet_header_t* ether = (struct ethernet_header_t*)packet; const struct ethernet_header_t* ether = (struct ethernet_header_t*)packet;
if (header.len > sizeof(struct ethernet_header_t) && if (header.len > sizeof(struct ethernet_header_t) &&
ntohs(ether->length) <= ETHER_MAX_SIZE && ntohs(ether->length) <= ETHER_MAX_SIZE &&
ntohs(ether->length) > sizeof(struct snap_header_t) && ntohs(ether->length) > sizeof(struct snap_header_t) &&
(memcmp(&ether->source, &HW_LOCAL, sizeof(ether->source)) != 0) && /* Ignore packets sent from our node. */ (memcmp(&ether->source, &HW_LOCAL, sizeof(ether->source)) != 0) && /* Ignore packets sent from our node. */
(memcmp(&ether->dest, &HW_LOCAL, sizeof(ether->dest)) == 0 || /* Accept packets destined for our node ... */ (memcmp(&ether->dest, &HW_LOCAL, sizeof(ether->dest)) == 0 || /* Accept packets destined for our node ... */
memcmp(&ether->dest, &HW_APPLETALK_BROADCAST, sizeof(ether->dest)) == 0 /* ... or for broadcast. */) memcmp(&ether->dest, &HW_APPLETALK_BROADCAST, sizeof(ether->dest)) == 0 /* ... or for broadcast. */)
) )
{ {
// Check the 802.2 SNAP header. // Check the 802.2 SNAP header.
const struct snap_header_t* snap = (struct snap_header_t*)(packet + sizeof(struct ethernet_header_t)); const struct snap_header_t* snap = (struct snap_header_t*)(packet + sizeof(struct ethernet_header_t));
if (snap->dsap == SNAP_DSAP && if (snap->dsap == SNAP_DSAP &&
snap->ssap == SNAP_SSAP && snap->ssap == SNAP_SSAP &&
snap->control == SNAP_CONTROL) snap->control == SNAP_CONTROL)
{ {
if (memcmp(&snap->discriminator, &SNAP_APPLETALK, sizeof(snap->discriminator)) == 0) if (memcmp(&snap->discriminator, &SNAP_APPLETALK, sizeof(snap->discriminator)) == 0)
{ {
// Handle an AppleTalk packet. // Handle an AppleTalk packet.
const size_t payload_size = ntohs(ether->length) - sizeof(struct snap_header_t); const size_t payload_size = ntohs(ether->length) - sizeof(struct snap_header_t);
const u_char* payload = packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t); const u_char* payload = packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t);
byte* copy = (byte*)malloc(payload_size); byte* copy = (byte*)malloc(payload_size);
memcpy(copy, payload, payload_size); memcpy(copy, payload, payload_size);
// ELAP does not support short-form DDP, so this must be a long-form DDP packet. // ELAP does not support short-form DDP, so this must be a long-form DDP packet.
struct at_addr_t source, dest; struct at_addr_t source, dest;
if (payload_size >= sizeof(struct DDP_LONG)) if (payload_size >= sizeof(struct DDP_LONG))
{ {
// Extract the protocol address from the header. // Extract the protocol address from the header.
// //
// ELAP really shouldn't be looking at the header for the next level of the protocol stack, // ELAP really shouldn't be looking at the header for the next level of the protocol stack,
// but this is a convenient place to glean addresses for the AMT, a process that needs both // but this is a convenient place to glean addresses for the AMT, a process that needs both
// hardware and protocol addresses. // hardware and protocol addresses.
struct DDP_LONG* header = (struct DDP_LONG*)copy; struct DDP_LONG* header = (struct DDP_LONG*)copy;
dest.network = (at_network_t)ntohs(header->dest_net); dest.network = (at_network_t)ntohs(header->dest_net);
source.network = (at_network_t)ntohs(header->source_net); source.network = (at_network_t)ntohs(header->source_net);
dest.node = header->dest_node; dest.node = header->dest_node;
source.node = header->source_node; source.node = header->source_node;
enqueue(&elap_port.in, dest, source, LAP_DDP_LONG, payload_size, copy); enqueue(&elap_port.in, dest, source, LAP_DDP_LONG, payload_size, copy);
aarp_glean(&source, &ether->source); aarp_glean(&source, &ether->source);
} }
else else
atbridge_printf("ATBridge: Dropping invalid short ELAP frame.\n"); atbridge_printf("ATBridge: Dropping invalid short ELAP frame.\n");
} }
else if (memcmp(&snap->discriminator, &SNAP_AARP, sizeof(snap->discriminator)) == 0) else if (memcmp(&snap->discriminator, &SNAP_AARP, sizeof(snap->discriminator)) == 0)
{ {
// Handle an AARP packet. // Handle an AARP packet.
struct aarp_header_t* aarp = (struct aarp_header_t*)(packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t)); struct aarp_header_t* aarp = (struct aarp_header_t*)(packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
aarp->dest_proto_addr.addr.network = ntohs(aarp->dest_proto_addr.addr.network); aarp->dest_proto_addr.addr.network = ntohs(aarp->dest_proto_addr.addr.network);
aarp->source_proto_addr.addr.network = ntohs(aarp->source_proto_addr.addr.network); aarp->source_proto_addr.addr.network = ntohs(aarp->source_proto_addr.addr.network);
aarp->function = ntohs(aarp->function); aarp->function = ntohs(aarp->function);
aarp->hardware_type = ntohs(aarp->hardware_type); aarp->hardware_type = ntohs(aarp->hardware_type);
aarp->protocol_type = ntohs(aarp->protocol_type); aarp->protocol_type = ntohs(aarp->protocol_type);
aarp_handle_packet(aarp); aarp_handle_packet(aarp);
} }
} }
} }
return true; return true;
} }
else else
return false; return false;
} }
static void elap_receive_all() static void elap_receive_all()
{ {
while (elap_receive_one()); while (elap_receive_one());
} }
void elap_process() void elap_process()
{ {
elap_receive_all(); elap_receive_all();
elap_send_all_queued(); elap_send_all_queued();
} }

View File

@ -1,36 +1,38 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** ELAP port of the AppleTalk Bridge **/ */
bool elap_init(); /** ELAP port of the AppleTalk Bridge **/
void elap_shutdown();
void elap_process(); bool elap_init();
void elap_shutdown();
struct packet_t; void elap_process();
void elap_enqueue_out(struct packet_t* packet); struct packet_t;
struct packet_t* elap_dequeue_in();
void elap_enqueue_out(struct packet_t* packet);
struct ether_addr_t; struct packet_t* elap_dequeue_in();
struct snap_discriminator_t;
struct ether_addr_t;
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[]); struct snap_discriminator_t;
const struct ether_addr_t* elap_get_mac(); void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[]);
const struct ether_addr_t* elap_get_mac();

View File

@ -1,117 +1,119 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Ethernet addresses are 6 bytes */ */
#define ETHER_ADDR_LEN 6
/* Ethernet addresses are 6 bytes */
static const word16 ETHER_MAX_SIZE = 0x5DC; #define ETHER_ADDR_LEN 6
static const word16 ETHER_MIN_SIZE = 60;
static const byte SNAP_DSAP = 0xAA; static const word16 ETHER_MAX_SIZE = 0x5DC;
static const byte SNAP_SSAP = 0xAA; static const word16 ETHER_MIN_SIZE = 60;
static const byte SNAP_CONTROL = 0x03; static const byte SNAP_DSAP = 0xAA;
static const byte SNAP_SSAP = 0xAA;
#define OUI_APPLETALK_1 0x08 static const byte SNAP_CONTROL = 0x03;
#define OUI_APPLETALK_2 0x00
#define OUI_APPLETALK_3 0x07 #define OUI_APPLETALK_1 0x08
#define TYPE_APPLETALK_1 0x80 #define OUI_APPLETALK_2 0x00
#define TYPE_APPLETALK_2 0x9B #define OUI_APPLETALK_3 0x07
#define TYPE_APPLETALK_1 0x80
#define OUI_AARP_1 0x00 #define TYPE_APPLETALK_2 0x9B
#define OUI_AARP_2 0x00
#define OUI_AARP_3 0x00 #define OUI_AARP_1 0x00
#define TYPE_AARP_1 0x80 #define OUI_AARP_2 0x00
#define TYPE_AARP_2 0xF3 #define OUI_AARP_3 0x00
#define TYPE_AARP_1 0x80
static const byte AARP_HARDWARE_ETHER = 0x01; #define TYPE_AARP_2 0xF3
static const word16 AARP_PROTOCOL_TYPE = 0x809B;
static const byte AARP_HW_ADDR_LEN = 6; static const byte AARP_HARDWARE_ETHER = 0x01;
static const byte AARP_PROTOCOL_ADDR_LEN = 4; static const word16 AARP_PROTOCOL_TYPE = 0x809B;
enum AARP_FUNCTION static const byte AARP_HW_ADDR_LEN = 6;
{ static const byte AARP_PROTOCOL_ADDR_LEN = 4;
AARP_FUNCTION_REQUEST = 0x01, enum AARP_FUNCTION
AARP_FUNCTION_RESPONSE = 0x02, {
AARP_FUNCTION_PROBE = 0x03 AARP_FUNCTION_REQUEST = 0x01,
}; AARP_FUNCTION_RESPONSE = 0x02,
AARP_FUNCTION_PROBE = 0x03
// reference C-4 };
static const long AARP_PROBE_INTERVAL = 200; /* milliseconds */
static const unsigned int AARP_PROBE_COUNT = 10; // reference C-4
static const long AARP_PROBE_INTERVAL = 200; /* milliseconds */
// reference 2-9 and 3-9, optional and at developer discretion static const unsigned int AARP_PROBE_COUNT = 10;
static const long AARP_REQUEST_INTERVAL = 200; /* milliseconds */
static const unsigned int AARP_REQUEST_COUNT = 10; // reference 2-9 and 3-9, optional and at developer discretion
static const long AARP_REQUEST_INTERVAL = 200; /* milliseconds */
#pragma pack(push, 1) static const unsigned int AARP_REQUEST_COUNT = 10;
struct ether_addr_t
{ #pragma pack(push, 1)
byte mac[ETHER_ADDR_LEN]; struct ether_addr_t
}; {
byte mac[ETHER_ADDR_LEN];
/* Ethernet 802.2/802.3/SNAP header */ };
struct ethernet_header_t
{ /* Ethernet 802.2/802.3/SNAP header */
// 802.3 header struct ethernet_header_t
struct ether_addr_t dest; {
struct ether_addr_t source; // 802.3 header
word16 length; struct ether_addr_t dest;
}; struct ether_addr_t source;
word16 length;
struct snap_discriminator_t };
{
byte oui[3]; struct snap_discriminator_t
byte type[2]; {
}; byte oui[3];
byte type[2];
struct snap_header_t };
{
// 802.2 header struct snap_header_t
byte dsap; {
byte ssap; // 802.2 header
byte control; byte dsap;
byte ssap;
// SNAP header byte control;
struct snap_discriminator_t discriminator;
}; // SNAP header
struct snap_discriminator_t discriminator;
struct protocol_addr_t };
{
byte zero; // Reference C-4 and 3-11: The protocol address is four bytes with the high byte zero. struct protocol_addr_t
struct at_addr_t addr; {
}; byte zero; // Reference C-4 and 3-11: The protocol address is four bytes with the high byte zero.
struct at_addr_t addr;
struct aarp_header_t };
{
word16 hardware_type; struct aarp_header_t
word16 protocol_type; {
byte hw_addr_len; word16 hardware_type;
byte protocol_addr_len; word16 protocol_type;
word16 function; byte hw_addr_len;
struct ether_addr_t source_hw_addr; byte protocol_addr_len;
struct protocol_addr_t source_proto_addr; word16 function;
struct ether_addr_t dest_hw_addr; struct ether_addr_t source_hw_addr;
struct protocol_addr_t dest_proto_addr; struct protocol_addr_t source_proto_addr;
}; struct ether_addr_t dest_hw_addr;
#pragma pack(pop) struct protocol_addr_t dest_proto_addr;
};
static const struct ether_addr_t HW_APPLETALK_BROADCAST = {{ 0x09, 0x00, 0x07, 0xff, 0xff, 0xff }}; #pragma pack(pop)
static const struct ether_addr_t HW_LOCAL_DEFAULT = {{0x02 /* unicast, locally administered */, 'A', '2', 'G', 'S', 0x00}};
//static const struct ether_addr_t HW_LOCAL = {{ 0x02 /* unicast, locally administered */, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }}; static const struct ether_addr_t HW_APPLETALK_BROADCAST = {{ 0x09, 0x00, 0x07, 0xff, 0xff, 0xff }};
static const struct ether_addr_t HW_ZERO = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; static const struct ether_addr_t HW_LOCAL_DEFAULT = {{0x02 /* unicast, locally administered */, 'A', '2', 'G', 'S', 0x00}};
static const struct snap_discriminator_t SNAP_APPLETALK = {{ OUI_APPLETALK_1, OUI_APPLETALK_2, OUI_APPLETALK_3}, {TYPE_APPLETALK_1, TYPE_APPLETALK_2 }}; //static const struct ether_addr_t HW_LOCAL = {{ 0x02 /* unicast, locally administered */, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }};
static const struct snap_discriminator_t SNAP_AARP = {{ OUI_AARP_1, OUI_AARP_2, OUI_AARP_3}, {TYPE_AARP_1, TYPE_AARP_2 }}; static const struct ether_addr_t HW_ZERO = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
static const struct snap_discriminator_t SNAP_APPLETALK = {{ OUI_APPLETALK_1, OUI_APPLETALK_2, OUI_APPLETALK_3}, {TYPE_APPLETALK_1, TYPE_APPLETALK_2 }};
static const struct snap_discriminator_t SNAP_AARP = {{ OUI_AARP_1, OUI_AARP_2, OUI_AARP_3}, {TYPE_AARP_1, TYPE_AARP_2 }};

View File

@ -1,332 +1,334 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** This module implements the LLAP port of the bridge. **/ */
#include <stdbool.h> /** This module implements the LLAP port of the bridge. **/
#include "../defc.h"
#include "atbridge.h" #include <stdbool.h>
#include "port.h" #include "../defc.h"
#include "llap.h" #include "atbridge.h"
#include "port.h"
typedef enum { #include "llap.h"
LLAP_DDP_SHORT = 0x01,
LLAP_DDP_LONG = 0x02, typedef enum {
LLAP_ENQ = 0x81, LLAP_DDP_SHORT = 0x01,
LLAP_ACK = 0x82, LLAP_DDP_LONG = 0x02,
LLAP_RTS = 0x84, LLAP_ENQ = 0x81,
LLAP_CTS = 0x85 LLAP_ACK = 0x82,
} LLAP_TYPES; LLAP_RTS = 0x84,
LLAP_CTS = 0x85
const unsigned int LLAP_PACKET_MAX = 603 /* bytes */; } LLAP_TYPES;
const unsigned int LLAP_PACKET_MIN = 3 /* bytes */;
const double LLAP_IDG = 400 /* microseconds */; const unsigned int LLAP_PACKET_MAX = 603 /* bytes */;
const double LLAP_IFG = 200 /* microseconds */; const unsigned int LLAP_PACKET_MIN = 3 /* bytes */;
const double GAP_TOLERANCE = 4.0; const double LLAP_IDG = 400 /* microseconds */;
const double LLAP_IFG = 200 /* microseconds */;
static struct packet_port_t llap_port; const double GAP_TOLERANCE = 4.0;
typedef enum { static struct packet_port_t llap_port;
DIALOG_READY,
DIALOG_GOT_CTS, typedef enum {
DIALOG_WAIT_IDG DIALOG_READY,
} DIALOG_STATE; DIALOG_GOT_CTS,
static DIALOG_STATE dialog_state; DIALOG_WAIT_IDG
static double dialog_end_dcycs; } DIALOG_STATE;
static double last_frame_dcycs; static DIALOG_STATE dialog_state;
static double dialog_end_dcycs;
void llap_init() static double last_frame_dcycs;
{
dialog_state = DIALOG_READY; void llap_init()
last_frame_dcycs = 0; {
port_init(&llap_port); dialog_state = DIALOG_READY;
} last_frame_dcycs = 0;
port_init(&llap_port);
void llap_shutdown() }
{
port_shutdown(&llap_port); void llap_shutdown()
} {
port_shutdown(&llap_port);
}
/** Queue one data packet out from the bridge's LLAP port and into the guest. **/
void llap_enqueue_out(struct packet_t* packet)
{ /** Queue one data packet out from the bridge's LLAP port and into the guest. **/
// Generate the RTS. void llap_enqueue_out(struct packet_t* packet)
struct packet_t* rts = (struct packet_t*)malloc(sizeof(struct packet_t)); {
rts->source.network = packet->source.network; // Generate the RTS.
rts->source.node = packet->source.node; struct packet_t* rts = (struct packet_t*)malloc(sizeof(struct packet_t));
rts->dest.network = packet->dest.network; rts->source.network = packet->source.network;
rts->dest.node = packet->dest.node; rts->source.node = packet->source.node;
rts->size = 0; rts->dest.network = packet->dest.network;
rts->data = 0; rts->dest.node = packet->dest.node;
rts->type = LLAP_RTS; rts->size = 0;
enqueue_packet(&llap_port.out, rts); rts->data = 0;
rts->type = LLAP_RTS;
// Enqueue the data. enqueue_packet(&llap_port.out, rts);
enqueue_packet(&llap_port.out, packet);
} // Enqueue the data.
enqueue_packet(&llap_port.out, packet);
struct packet_t* llap_dequeue_in() }
{
return dequeue(&llap_port.in); struct packet_t* llap_dequeue_in()
} {
return dequeue(&llap_port.in);
static void llap_dump_packet(size_t size, byte data[]) }
{
if (size < LLAP_PACKET_MIN) static void llap_dump_packet(size_t size, byte data[])
atbridge_printf("LLAP short packet.\n"); {
else if (size > LLAP_PACKET_MAX) if (size < LLAP_PACKET_MIN)
atbridge_printf("LLAP long packet.\n"); atbridge_printf("LLAP short packet.\n");
else else if (size > LLAP_PACKET_MAX)
{ atbridge_printf("LLAP long packet.\n");
at_node_t dest = data[0]; else
at_node_t source = data[1]; {
LLAP_TYPES type = (LLAP_TYPES)(data[2]); at_node_t dest = data[0];
at_node_t source = data[1];
const char* typeName = 0; LLAP_TYPES type = (LLAP_TYPES)(data[2]);
switch (type)
{ const char* typeName = 0;
case LLAP_DDP_SHORT: switch (type)
typeName = "DDP (short)"; {
break; case LLAP_DDP_SHORT:
case LLAP_DDP_LONG: typeName = "DDP (short)";
typeName = "DDP (long)"; break;
break; case LLAP_DDP_LONG:
case LLAP_ENQ: typeName = "DDP (long)";
typeName = "lapENQ"; break;
break; case LLAP_ENQ:
case LLAP_ACK: typeName = "lapENQ";
typeName = "lapACK"; break;
break; case LLAP_ACK:
case LLAP_RTS: typeName = "lapACK";
typeName = "lapRTS"; break;
break; case LLAP_RTS:
case LLAP_CTS: typeName = "lapRTS";
typeName = "lapCTS"; break;
break; case LLAP_CTS:
} typeName = "lapCTS";
break;
if (typeName) }
atbridge_printf("LLAP[%d->%d] %s: %d bytes.\n", source, dest, typeName, size);
else if (typeName)
atbridge_printf("LLAP[%d->%d] %x: %d bytes.\n", source, dest, type, size); atbridge_printf("LLAP[%d->%d] %s: %d bytes.\n", source, dest, typeName, size);
else
/*for (size_t i = 0; i < size; i++) atbridge_printf("LLAP[%d->%d] %x: %d bytes.\n", source, dest, type, size);
atbridge_printf("%02x ", data[i]);
atbridge_printf("\n");*/ /*for (size_t i = 0; i < size; i++)
} atbridge_printf("%02x ", data[i]);
} atbridge_printf("\n");*/
}
/** Reply to a control packet from the GS **/ }
static void llap_reply_control(at_node_t dest, at_node_t source, LLAP_TYPES type)
{ /** Reply to a control packet from the GS **/
struct at_addr_t dest_addr = { 0, dest }; static void llap_reply_control(at_node_t dest, at_node_t source, LLAP_TYPES type)
struct at_addr_t source_addr = { 0, source }; {
struct at_addr_t dest_addr = { 0, dest };
// Insert control packets at the head of the queue contrary to normal FIFO queue operation struct at_addr_t source_addr = { 0, source };
// to ensure that control frames arrive in the intended order.
insert(&llap_port.out, dest_addr, source_addr, type, 0, 0); // Insert control packets at the head of the queue contrary to normal FIFO queue operation
} // to ensure that control frames arrive in the intended order.
insert(&llap_port.out, dest_addr, source_addr, type, 0, 0);
/** Accept a data packet from the GS. **/ }
static void llap_handle_data(size_t size, byte data[])
{ /** Accept a data packet from the GS. **/
at_node_t dest = data[0]; static void llap_handle_data(size_t size, byte data[])
at_node_t source = data[1]; {
LLAP_TYPES type = (LLAP_TYPES)(data[2]); at_node_t dest = data[0];
at_node_t source = data[1];
const size_t data_size = size - 3; LLAP_TYPES type = (LLAP_TYPES)(data[2]);
byte* data_copy = (byte*)malloc(data_size);
memcpy(data_copy, data + 3, data_size); const size_t data_size = size - 3;
byte* data_copy = (byte*)malloc(data_size);
struct at_addr_t dest_addr = { 0, dest }; memcpy(data_copy, data + 3, data_size);
struct at_addr_t source_addr = { 0, source };
enqueue(&llap_port.in, dest_addr, source_addr, type, data_size, data_copy); struct at_addr_t dest_addr = { 0, dest };
} struct at_addr_t source_addr = { 0, source };
enqueue(&llap_port.in, dest_addr, source_addr, type, data_size, data_copy);
/** Accept a control packet from the GS. **/ }
static void llap_handle_control(size_t size, byte data[])
{ /** Accept a control packet from the GS. **/
at_node_t dest = data[0]; static void llap_handle_control(size_t size, byte data[])
at_node_t source = data[1]; {
LLAP_TYPES type = (LLAP_TYPES)(data[2]); at_node_t dest = data[0];
at_node_t source = data[1];
struct at_addr_t addr = { atbridge_get_net(), dest }; LLAP_TYPES type = (LLAP_TYPES)(data[2]);
switch (type) struct at_addr_t addr = { atbridge_get_net(), dest };
{
case LLAP_ENQ: switch (type)
// Require the GS to take a valid "client" address not known to be in use. {
if (dest > 127 || dest == 0 || atbridge_address_used(&addr)) case LLAP_ENQ:
llap_reply_control(source, dest, LLAP_ACK); // Require the GS to take a valid "client" address not known to be in use.
break; if (dest > 127 || dest == 0 || atbridge_address_used(&addr))
case LLAP_ACK: llap_reply_control(source, dest, LLAP_ACK);
break; break;
case LLAP_RTS: case LLAP_ACK:
if (dest != at_broadcast_node) break;
// The GS is trying to make a directed transmission. Provide the required RTS/CTS handshake. case LLAP_RTS:
// Note that broadcast packets do not require a CTS. if (dest != at_broadcast_node)
llap_reply_control(source, dest, LLAP_CTS); // The GS is trying to make a directed transmission. Provide the required RTS/CTS handshake.
break; // Note that broadcast packets do not require a CTS.
case LLAP_CTS: llap_reply_control(source, dest, LLAP_CTS);
// The GS sent a CTS. If the bridge has pending data, prepare to deliver the packet. break;
dialog_state = DIALOG_GOT_CTS; case LLAP_CTS:
break; // The GS sent a CTS. If the bridge has pending data, prepare to deliver the packet.
default: dialog_state = DIALOG_GOT_CTS;
break; break;
} default:
} break;
}
/** Occassionally, we receive an invalid packet from the GS. I'm unsure if this is due to a bug in GS/OS }
or, more likely, a bug in the SCC emulation. Regardless, when such a thing does occur, discard the
current, corrupted dialog. Link errors are routine in real LocalTalk networks, and LocalTalk will recover. /** Occassionally, we receive an invalid packet from the GS. I'm unsure if this is due to a bug in GS/OS
**/ or, more likely, a bug in the SCC emulation. Regardless, when such a thing does occur, discard the
static void llap_reset_dialog() current, corrupted dialog. Link errors are routine in real LocalTalk networks, and LocalTalk will recover.
{ **/
dialog_state = DIALOG_READY; static void llap_reset_dialog()
last_frame_dcycs = 0; {
dialog_state = DIALOG_READY;
// Discard packets until the queue is either empty or the next dialog starts (and dialogs begin with an RTS). last_frame_dcycs = 0;
while (true)
{ // Discard packets until the queue is either empty or the next dialog starts (and dialogs begin with an RTS).
struct packet_t* packet = queue_peek(&llap_port.out); while (true)
{
if (packet && (packet->type != LLAP_RTS)) struct packet_t* packet = queue_peek(&llap_port.out);
{
packet = dequeue(&llap_port.out); if (packet && (packet->type != LLAP_RTS))
if (packet->data) {
free(packet->data); packet = dequeue(&llap_port.out);
free(packet); if (packet->data)
} free(packet->data);
else free(packet);
break; }
} else
} break;
}
/** Transfer (send) one LLAP packet from the GS. **/ }
void llap_enqueue_in(double dcycs, size_t size, byte data[])
{ /** Transfer (send) one LLAP packet from the GS. **/
atbridge_printf("<%0.0f> TX: ", dcycs); void llap_enqueue_in(double dcycs, size_t size, byte data[])
llap_dump_packet(size, data); {
atbridge_printf("<%0.0f> TX: ", dcycs);
if (size < LLAP_PACKET_MIN) llap_dump_packet(size, data);
atbridge_printf("ATBridge: Dropping LLAP short packet.\n");
else if (size > LLAP_PACKET_MAX) if (size < LLAP_PACKET_MIN)
atbridge_printf("ATBridge: Dropping LLAP long packet.\n"); atbridge_printf("ATBridge: Dropping LLAP short packet.\n");
else else if (size > LLAP_PACKET_MAX)
{ atbridge_printf("ATBridge: Dropping LLAP long packet.\n");
last_frame_dcycs = dcycs; else
LLAP_TYPES type = (LLAP_TYPES)(data[2]); {
last_frame_dcycs = dcycs;
switch (type) LLAP_TYPES type = (LLAP_TYPES)(data[2]);
{
case LLAP_DDP_SHORT: switch (type)
case LLAP_DDP_LONG: {
llap_handle_data(size, data); case LLAP_DDP_SHORT:
break; case LLAP_DDP_LONG:
case LLAP_ENQ: llap_handle_data(size, data);
case LLAP_ACK: break;
case LLAP_RTS: case LLAP_ENQ:
case LLAP_CTS: case LLAP_ACK:
llap_handle_control(size, data); case LLAP_RTS:
break; case LLAP_CTS:
default: llap_handle_control(size, data);
// Intentionally check for valid types and ingore packets with invalid types. break;
// Sometimes, the bridge gets invalid packets from the GS, which tends to break the bridge. default:
atbridge_printf("ATBridge: Dropping LLAP packet with invalid type.\n"); // Intentionally check for valid types and ingore packets with invalid types.
llap_reset_dialog(); // Sometimes, the bridge gets invalid packets from the GS, which tends to break the bridge.
} atbridge_printf("ATBridge: Dropping LLAP packet with invalid type.\n");
} llap_reset_dialog();
} }
}
/** Transfer (receive) one LLAP packet to the GS. **/ }
void llap_dequeue_out(double dcycs, size_t* size, byte* data[])
{ /** Transfer (receive) one LLAP packet to the GS. **/
*size = 0; void llap_dequeue_out(double dcycs, size_t* size, byte* data[])
{
// The LocalTalk protocol requires a minimum 400us gap between dialogs (called the IDG). *size = 0;
// If necessary, wait for the IDG.
if (dialog_state == DIALOG_WAIT_IDG) // The LocalTalk protocol requires a minimum 400us gap between dialogs (called the IDG).
{ // If necessary, wait for the IDG.
if ((dcycs - dialog_end_dcycs) >= LLAP_IDG) if (dialog_state == DIALOG_WAIT_IDG)
// The IDG is done. {
dialog_state = DIALOG_READY; if ((dcycs - dialog_end_dcycs) >= LLAP_IDG)
else // The IDG is done.
// Continue waiting for the IDG. dialog_state = DIALOG_READY;
return; else
} // Continue waiting for the IDG.
// The LocalTalk protocols requires a maximum 200us gap between frames within a dialog (called the IFG). return;
// If we exceed the IFG, the bridge must be stuck in an incomplete or corrupt dialog. In this case, }
// discard the current dialog and try again. // The LocalTalk protocols requires a maximum 200us gap between frames within a dialog (called the IFG).
if ((dialog_state != DIALOG_READY) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IFG))) // If we exceed the IFG, the bridge must be stuck in an incomplete or corrupt dialog. In this case,
{ // discard the current dialog and try again.
llap_reset_dialog(); if ((dialog_state != DIALOG_READY) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IFG)))
atbridge_printf("ATBridge: Dialog reset due to IFG violation.\n"); {
} llap_reset_dialog();
atbridge_printf("ATBridge: Dialog reset due to IFG violation.\n");
struct packet_t* packet = queue_peek(&llap_port.out); }
if ((dialog_state == DIALOG_READY) && (packet) && !(packet->type & 0x80) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IDG))) struct packet_t* packet = queue_peek(&llap_port.out);
{
llap_reset_dialog(); if ((dialog_state == DIALOG_READY) && (packet) && !(packet->type & 0x80) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IDG)))
packet = queue_peek(&llap_port.out); {
atbridge_printf("ATBridge: Dialog reset due to IDG violation.\n"); llap_reset_dialog();
} packet = queue_peek(&llap_port.out);
atbridge_printf("ATBridge: Dialog reset due to IDG violation.\n");
if (packet && }
((packet->type & 0x80) || /* Pass along control frames without waiting for a CTS. */
(!(packet->type & 0x80) && (packet->dest.node == at_broadcast_node) && (dialog_state == DIALOG_READY)) || /* Pass along broadcast frames, which don't wait for CTS frames. */ if (packet &&
(!(packet->type & 0x80) && (packet->dest.node != at_broadcast_node) && (dialog_state == DIALOG_GOT_CTS)))) /* Pass along directed frames only after receiving a CTS handshake. */ ((packet->type & 0x80) || /* Pass along control frames without waiting for a CTS. */
{ (!(packet->type & 0x80) && (packet->dest.node == at_broadcast_node) && (dialog_state == DIALOG_READY)) || /* Pass along broadcast frames, which don't wait for CTS frames. */
dequeue(&llap_port.out); (!(packet->type & 0x80) && (packet->dest.node != at_broadcast_node) && (dialog_state == DIALOG_GOT_CTS)))) /* Pass along directed frames only after receiving a CTS handshake. */
{
// Prepend the LLAP header. dequeue(&llap_port.out);
*size = packet->size + 3 + 2;
*data = (byte*)malloc(*size); // Prepend the LLAP header.
(*data)[0] = packet->dest.node; *size = packet->size + 3 + 2;
(*data)[1] = packet->source.node; *data = (byte*)malloc(*size);
(*data)[2] = packet->type; (*data)[0] = packet->dest.node;
(*data)[1] = packet->source.node;
// Insert the data into the new LLAP packet. (*data)[2] = packet->type;
if (*size)
memcpy((*data) + 3, packet->data, packet->size); // Insert the data into the new LLAP packet.
if (*size)
// Fake a frame check sequence (FCS). Since our SCC emulation doesn't actually memcpy((*data) + 3, packet->data, packet->size);
// check the FCS, the value of the FCS doesn't matter.
(*data)[packet->size + 3 + 0] = 0xff; // Fake a frame check sequence (FCS). Since our SCC emulation doesn't actually
(*data)[packet->size + 3 + 1] = 0xff; // check the FCS, the value of the FCS doesn't matter.
(*data)[packet->size + 3 + 0] = 0xff;
atbridge_printf("<%0.0f> RX: ", dcycs); (*data)[packet->size + 3 + 1] = 0xff;
llap_dump_packet(*size, *data);
atbridge_printf("<%0.0f> RX: ", dcycs);
if (packet->type & 0x80) llap_dump_packet(*size, *data);
dialog_state = DIALOG_READY;
else if (packet->type & 0x80)
{ dialog_state = DIALOG_READY;
// This was the last packet in the dialog. else
dialog_state = DIALOG_WAIT_IDG; {
dialog_end_dcycs = dcycs; // This was the last packet in the dialog.
} dialog_state = DIALOG_WAIT_IDG;
dialog_end_dcycs = dcycs;
last_frame_dcycs = dcycs; }
free(packet->data); last_frame_dcycs = dcycs;
free(packet);
} free(packet->data);
} free(packet);
}
}

View File

@ -1,37 +1,39 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct packet_t; */
/** LLAP port of the AppleTalk Bridge **/ struct packet_t;
void llap_init(); /** LLAP port of the AppleTalk Bridge **/
void llap_shutdown();
void llap_init();
/** Send one LLAP packet from the GS void llap_shutdown();
*/
void llap_enqueue_in(double dcycs, size_t size, byte data[]); /** Send one LLAP packet from the GS
*/
/** Receive one LLAP packet from the world to the GS and return the size void llap_enqueue_in(double dcycs, size_t size, byte data[]);
*/
void llap_dequeue_out(double dcycs, size_t* size, byte* data[]); /** Receive one LLAP packet from the world to the GS and return the size
*/
void llap_dequeue_out(double dcycs, size_t* size, byte* data[]);
void llap_enqueue_out(struct packet_t* packet);
struct packet_t* llap_dequeue_in();
void llap_enqueue_out(struct packet_t* packet);
struct packet_t* llap_dequeue_in();

View File

@ -1,171 +1,173 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <stdbool.h> */
#include "pcap_delay.h"
#include <stdbool.h>
#ifdef WIN32 #include "pcap_delay.h"
#include <Windows.h>
static HMODULE module = NULL; #ifdef WIN32
#elif __linux__ #include <Windows.h>
#include <dlfcn.h> static HMODULE module = NULL;
static void* module = 0; #elif __linux__
#endif #include <dlfcn.h>
static void* module = 0;
#endif
bool pcapdelay_load()
{
if (!pcapdelay_is_loaded()) bool pcapdelay_load()
{ {
#ifdef WIN32 if (!pcapdelay_is_loaded())
module = LoadLibrary("wpcap.dll"); {
#elif __linux__ #ifdef WIN32
module = dlopen("libpcap.so", RTLD_LAZY); module = LoadLibrary("wpcap.dll");
#endif #elif __linux__
} module = dlopen("libpcap.so", RTLD_LAZY);
return pcapdelay_is_loaded(); #endif
} }
return pcapdelay_is_loaded();
bool pcapdelay_is_loaded() }
{
#ifdef WIN32 bool pcapdelay_is_loaded()
return module != NULL; {
#elif __linux__ #ifdef WIN32
return module != 0; return module != NULL;
#endif #elif __linux__
return 0; return module != 0;
} #endif
return 0;
void pcapdelay_unload() }
{
if (pcapdelay_is_loaded()) void pcapdelay_unload()
{ {
#ifdef WIN32 if (pcapdelay_is_loaded())
FreeLibrary(module); {
module = NULL; #ifdef WIN32
#elif __linux__ FreeLibrary(module);
dlclose(module); module = NULL;
module = 0; #elif __linux__
#endif dlclose(module);
} module = 0;
} #endif
}
typedef void (*PFNVOID)(); }
static PFNVOID delay_load(const char* proc, PFNVOID* ppfn) typedef void (*PFNVOID)();
{
if (pcapdelay_load() && proc && ppfn && !*ppfn) static PFNVOID delay_load(const char* proc, PFNVOID* ppfn)
{ {
#ifdef WIN32 if (pcapdelay_load() && proc && ppfn && !*ppfn)
*ppfn = (PFNVOID)GetProcAddress(module, proc); {
#elif __linux__ #ifdef WIN32
*ppfn = (PFNVOID)dlsym(module, proc); *ppfn = (PFNVOID)GetProcAddress(module, proc);
#endif #elif __linux__
} *ppfn = (PFNVOID)dlsym(module, proc);
if (ppfn) #endif
return *ppfn; }
else if (ppfn)
return 0; return *ppfn;
} else
return 0;
void pcapdelay_freealldevs(pcap_if_t* a0) }
{
typedef void (*PFN)(pcap_if_t*); void pcapdelay_freealldevs(pcap_if_t* a0)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_freealldevs", (PFNVOID*)&pfn))) typedef void (*PFN)(pcap_if_t*);
(*pfn)(a0); static PFN pfn = 0;
} if ((pfn = (PFN)delay_load("pcap_freealldevs", (PFNVOID*)&pfn)))
(*pfn)(a0);
pcap_t* pcapdelay_open_live(const char* a0, int a1, int a2, int a3, char* a4) }
{
typedef pcap_t* (*PFN)(const char*, int, int, int, char*); pcap_t* pcapdelay_open_live(const char* a0, int a1, int a2, int a3, char* a4)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_open_live", (PFNVOID*)&pfn))) typedef pcap_t* (*PFN)(const char*, int, int, int, char*);
return (*pfn)(a0, a1, a2, a3, a4); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_open_live", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1, a2, a3, a4);
} else
return 0;
void pcapdelay_close(pcap_t* a0) }
{
typedef void (*PFN)(pcap_t*); void pcapdelay_close(pcap_t* a0)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_close", (PFNVOID*)&pfn))) typedef void (*PFN)(pcap_t*);
(*pfn)(a0); static PFN pfn = 0;
} if ((pfn = (PFN)delay_load("pcap_close", (PFNVOID*)&pfn)))
(*pfn)(a0);
int pcapdelay_findalldevs(pcap_if_t** a0, char* a1) }
{
typedef int (*PFN)(pcap_if_t**, char*); int pcapdelay_findalldevs(pcap_if_t** a0, char* a1)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_findalldevs", (PFNVOID*)&pfn))) typedef int (*PFN)(pcap_if_t**, char*);
return (*pfn)(a0, a1); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_findalldevs", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1);
} else
return 0;
int pcapdelay_datalink(pcap_t* a0) }
{
typedef int(*PFN)(pcap_t*); int pcapdelay_datalink(pcap_t* a0)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_datalink", (PFNVOID*)&pfn))) typedef int(*PFN)(pcap_t*);
return (*pfn)(a0); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_datalink", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0);
} else
return 0;
int pcapdelay_setnonblock(pcap_t* a0, int a1, char* a2) }
{
typedef int(*PFN)(pcap_t*, int, char*); int pcapdelay_setnonblock(pcap_t* a0, int a1, char* a2)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_setnonblock", (PFNVOID*)&pfn))) typedef int(*PFN)(pcap_t*, int, char*);
return (*pfn)(a0, a1, a2); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_setnonblock", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1, a2);
} else
return 0;
int pcapdelay_sendpacket(pcap_t* a0, u_char* a1, int a2) }
{
typedef int(*PFN)(pcap_t*, u_char*, int); int pcapdelay_sendpacket(pcap_t* a0, u_char* a1, int a2)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_sendpacket", (PFNVOID*)&pfn))) typedef int(*PFN)(pcap_t*, u_char*, int);
return (*pfn)(a0, a1, a2); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_sendpacket", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1, a2);
} else
return 0;
const u_char* pcapdelay_next(pcap_t* a0, struct pcap_pkthdr* a1) }
{
typedef const u_char*(*PFN)(pcap_t*, struct pcap_pkthdr*); const u_char* pcapdelay_next(pcap_t* a0, struct pcap_pkthdr* a1)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_next", (PFNVOID*)&pfn))) typedef const u_char*(*PFN)(pcap_t*, struct pcap_pkthdr*);
return (*pfn)(a0, a1); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_next", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1);
} else
return 0;
int pcapdelay_dispatch(pcap_t* a0, int a1, pcap_handler a2, u_char* a3) }
{
typedef const int(*PFN)(pcap_t *, int, pcap_handler, u_char *); int pcapdelay_dispatch(pcap_t* a0, int a1, pcap_handler a2, u_char* a3)
static PFN pfn = 0; {
if ((pfn = (PFN)delay_load("pcap_dispatch", (PFNVOID*)&pfn))) typedef const int(*PFN)(pcap_t *, int, pcap_handler, u_char *);
return (*pfn)(a0, a1, a2, a3); static PFN pfn = 0;
else if ((pfn = (PFN)delay_load("pcap_dispatch", (PFNVOID*)&pfn)))
return 0; return (*pfn)(a0, a1, a2, a3);
} else
return 0;
}

View File

@ -1,48 +1,50 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
This interface provides a thin, delay-loaded wrapper around the PCAP library so that */
you may start GSport without intalling PCAP. Of course, some features that require /*
PCAP won't be available. This interface provides a thin, delay-loaded wrapper around the PCAP library so that
you may start GSport without intalling PCAP. Of course, some features that require
This wrapper provides a subset of the available PCAP APIs necessary for ATBridge. PCAP won't be available.
Feel free to extend the wrapper.
*/ This wrapper provides a subset of the available PCAP APIs necessary for ATBridge.
Feel free to extend the wrapper.
#ifdef WIN32 */
#include "../arch/win32/pcap.h"
#elif __linux__ #ifdef WIN32
#include <pcap.h> #include "../arch/win32/pcap.h"
#elif __APPLE__ #elif __linux__
#include <pcap/pcap.h> #include <pcap.h>
#endif #elif __APPLE__
#include <pcap/pcap.h>
bool pcapdelay_load(); #endif
bool pcapdelay_is_loaded();
void pcapdelay_unload(); bool pcapdelay_load();
bool pcapdelay_is_loaded();
void pcapdelay_freealldevs(pcap_if_t *); void pcapdelay_unload();
pcap_t* pcapdelay_open_live(const char *, int, int, int, char *);
void pcapdelay_close(pcap_t *); void pcapdelay_freealldevs(pcap_if_t *);
int pcapdelay_findalldevs(pcap_if_t **, char *); pcap_t* pcapdelay_open_live(const char *, int, int, int, char *);
int pcapdelay_datalink(pcap_t *); void pcapdelay_close(pcap_t *);
int pcapdelay_setnonblock(pcap_t *, int, char *); int pcapdelay_findalldevs(pcap_if_t **, char *);
int pcapdelay_sendpacket(pcap_t *p, u_char *buf, int size); int pcapdelay_datalink(pcap_t *);
const u_char* pcapdelay_next(pcap_t *, struct pcap_pkthdr *); int pcapdelay_setnonblock(pcap_t *, int, char *);
int pcapdelay_dispatch(pcap_t *, int, pcap_handler, u_char *); int pcapdelay_sendpacket(pcap_t *p, u_char *buf, int size);
const u_char* pcapdelay_next(pcap_t *, struct pcap_pkthdr *);
int pcapdelay_dispatch(pcap_t *, int, pcap_handler, u_char *);

View File

@ -1,139 +1,141 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** This module implements queues for storing and transferring packets within the bridge. **/ */
#include "../defc.h" /** This module implements queues for storing and transferring packets within the bridge. **/
#include "atalk.h"
#include "port.h" #include "../defc.h"
#include "atalk.h"
void port_init(struct packet_port_t* port) #include "port.h"
{
if (port) void port_init(struct packet_port_t* port)
{ {
queue_init(&port->in); if (port)
queue_init(&port->out); {
} queue_init(&port->in);
} queue_init(&port->out);
}
void port_shutdown(struct packet_port_t* port) }
{
if (port) void port_shutdown(struct packet_port_t* port)
{ {
queue_shutdown(&port->in); if (port)
queue_shutdown(&port->out); {
} queue_shutdown(&port->in);
} queue_shutdown(&port->out);
}
void queue_init(struct packet_queue_t* queue) }
{
if (queue) void queue_init(struct packet_queue_t* queue)
{ {
queue->head = queue->tail = 0; if (queue)
} {
} queue->head = queue->tail = 0;
}
void queue_shutdown(struct packet_queue_t* queue) }
{
if (queue) void queue_shutdown(struct packet_queue_t* queue)
{ {
struct packet_t* packet = dequeue(queue); if (queue)
while (packet) {
{ struct packet_t* packet = dequeue(queue);
if (packet->data) while (packet)
free(packet->data); {
free(packet); if (packet->data)
packet = dequeue(queue); free(packet->data);
} free(packet);
} packet = dequeue(queue);
} }
}
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]) }
{
if (!queue) void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
return; {
if (!queue)
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t)); return;
packet->dest.network = dest.network;
packet->dest.node = dest.node; struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
packet->source.network = source.network; packet->dest.network = dest.network;
packet->source.node = source.node; packet->dest.node = dest.node;
packet->type = type; packet->source.network = source.network;
packet->size = size; packet->source.node = source.node;
packet->data = data; packet->type = type;
enqueue_packet(queue, packet); packet->size = size;
} packet->data = data;
enqueue_packet(queue, packet);
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet) }
{
packet->next = 0; void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet)
{
if (queue->tail) packet->next = 0;
queue->tail->next = packet;
else if (queue->tail)
queue->head = packet; queue->tail->next = packet;
queue->tail = packet; else
} queue->head = packet;
queue->tail = packet;
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]) }
{
if (!queue) void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
return; {
if (!queue)
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t)); return;
packet->dest.network = dest.network;
packet->dest.node = dest.node; struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
packet->source.network = source.network; packet->dest.network = dest.network;
packet->source.node = source.node; packet->dest.node = dest.node;
packet->type = type; packet->source.network = source.network;
packet->size = size; packet->source.node = source.node;
packet->data = data; packet->type = type;
insert_packet(queue, packet); packet->size = size;
} packet->data = data;
insert_packet(queue, packet);
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet) }
{
packet->next = queue->head; void insert_packet(struct packet_queue_t* queue, struct packet_t* packet)
queue->head = packet; {
if (!queue->tail) packet->next = queue->head;
queue->tail = queue->head; queue->head = packet;
} if (!queue->tail)
queue->tail = queue->head;
struct packet_t* dequeue(struct packet_queue_t* queue) }
{
if (queue && queue->head) struct packet_t* dequeue(struct packet_queue_t* queue)
{ {
struct packet_t* packet = queue->head; if (queue && queue->head)
if (queue->tail == queue->head) {
queue->tail = queue->head = 0; struct packet_t* packet = queue->head;
else if (queue->tail == queue->head)
queue->head = packet->next; queue->tail = queue->head = 0;
return packet; else
} queue->head = packet->next;
else return packet;
return 0; }
} else
return 0;
struct packet_t* queue_peek(struct packet_queue_t* queue) }
{
if (queue) struct packet_t* queue_peek(struct packet_queue_t* queue)
return queue->head; {
else if (queue)
return 0; return queue->head;
} else
return 0;
}

View File

@ -1,58 +1,60 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013-2014 by Peter Neubauer Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it Copyright (C) 2013-2014 by Peter Neubauer
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct packet_t */
{
struct at_addr_t dest; struct packet_t
struct at_addr_t source; {
byte type; struct at_addr_t dest;
size_t size; struct at_addr_t source;
byte* data; byte type;
struct packet_t* next; size_t size;
}; byte* data;
struct packet_t* next;
struct packet_queue_t };
{
struct packet_t* head; struct packet_queue_t
struct packet_t* tail; {
}; struct packet_t* head;
struct packet_t* tail;
void queue_init(struct packet_queue_t* queue); };
void queue_shutdown(struct packet_queue_t* queue);
void queue_init(struct packet_queue_t* queue);
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]); void queue_shutdown(struct packet_queue_t* queue);
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet);
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
struct packet_t* dequeue(struct packet_queue_t* queue); void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet);
struct packet_t* queue_peek(struct packet_queue_t* queue);
struct packet_t* dequeue(struct packet_queue_t* queue);
// Insert the packet at the head of the queue, contrary to normal FIFO operation. struct packet_t* queue_peek(struct packet_queue_t* queue);
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet); // Insert the packet at the head of the queue, contrary to normal FIFO operation.
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet);
struct packet_port_t
{
struct packet_queue_t in; struct packet_port_t
struct packet_queue_t out; {
}; struct packet_queue_t in;
struct packet_queue_t out;
void port_init(struct packet_port_t* port); };
void port_shutdown(struct packet_port_t* port);
void port_init(struct packet_port_t* port);
void port_shutdown(struct packet_port_t* port);

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -29,7 +31,7 @@
#endif #endif
extern int Verbose; extern int Verbose;
extern word32 g_vbl_count; // OG change int to word32 extern word32 g_vbl_count; // OG change int to word32
extern int g_rom_version; extern int g_rom_version;
extern int g_config_gsport_update_needed; extern int g_config_gsport_update_needed;
@ -108,7 +110,7 @@ micro_sleep(double dtime)
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
Sleep((DWORD)(dtime * 1000)); Sleep((DWORD)(dtime * 1000));
#else #else
Timer.tv_sec = 0; Timer.tv_sec = 0;
Timer.tv_usec = (dtime * 1000000.0); Timer.tv_usec = (dtime * 1000000.0);
@ -141,13 +143,13 @@ clk_bram_set(int bram_num, int offset, int val)
g_bram[bram_num][offset] = val; g_bram[bram_num][offset] = val;
} }
extern void x_clk_setup_bram_version(); extern void x_clk_setup_bram_version();
void void
clk_setup_bram_version() clk_setup_bram_version()
{ {
x_clk_setup_bram_version(); x_clk_setup_bram_version();
} }
void void
@ -204,29 +206,29 @@ update_cur_time()
time_t cur_time; time_t cur_time;
unsigned int secs, secs2; unsigned int secs, secs2;
#ifdef UNDER_CE // OG Not supported on WIndows CE #ifdef UNDER_CE // OG Not supported on WIndows CE
/* /*
SYSTEMTIME stime; SYSTEMTIME stime;
FILETIME ftime; FILETIME ftime;
GetLocalTime(&stime); GetLocalTime(&stime);
SystemTimeToFileTime(&stime,&ftime); SystemTimeToFileTime(&stime,&ftime);
cur_time = ftime.dwLowDateTime; cur_time = ftime.dwLowDateTime;
*/ */
cur_time = time(0); cur_time = time(0);
secs=0; secs=0;
secs2=0; secs2=0;
#else #else
cur_time = time(0); cur_time = time(0);
/* Figure out the timezone (effectively) by diffing two times. */ /* Figure out the timezone (effectively) by diffing two times. */
/* this is probably not right for a few hours around daylight savings*/ /* this is probably not right for a few hours around daylight savings*/
/* time transition */ /* time transition */
secs2 = (unsigned int)mktime(gmtime(&cur_time)); secs2 = (unsigned int)mktime(gmtime(&cur_time));
tm_ptr = localtime(&cur_time); tm_ptr = localtime(&cur_time);
secs = (unsigned int)mktime(tm_ptr); secs = (unsigned int)mktime(tm_ptr);
#ifdef MAC #ifdef MAC
/* Mac OS X's mktime function modifies the tm_ptr passed in for */ /* Mac OS X's mktime function modifies the tm_ptr passed in for */
@ -241,7 +243,7 @@ update_cur_time()
secs += 3600; secs += 3600;
} }
#endif #endif
#endif #endif
/* add in secs to make date based on Apple Jan 1, 1904 instead of */ /* add in secs to make date based on Apple Jan 1, 1904 instead of */
/* Unix's Jan 1, 1970 */ /* Unix's Jan 1, 1970 */
/* So add in 66 years and 17 leap year days (1904 is a leap year) */ /* So add in 66 years and 17 leap year days (1904 is a leap year) */

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2014 by GSport contributors Copyright (C) 2010 - 2014 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -97,17 +99,17 @@ extern char* g_printer_font_courier;
extern char* g_printer_font_script; extern char* g_printer_font_script;
extern char* g_printer_font_ocra; extern char* g_printer_font_ocra;
extern int g_printer_timeout; extern int g_printer_timeout;
extern int g_imagewriter; extern int g_imagewriter;
extern int g_imagewriter_dpi; extern int g_imagewriter_dpi;
extern char* g_imagewriter_output; extern char* g_imagewriter_output;
extern int g_imagewriter_multipage; extern int g_imagewriter_multipage;
extern int g_imagewriter_timeout; extern int g_imagewriter_timeout;
extern char* g_imagewriter_fixed_font; extern char* g_imagewriter_fixed_font;
extern char* g_imagewriter_prop_font; extern char* g_imagewriter_prop_font;
extern int g_imagewriter_paper; extern int g_imagewriter_paper;
extern int g_imagewriter_banner; extern int g_imagewriter_banner;
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
extern int g_win_show_console_request; extern int g_win_show_console_request;
extern int g_win_status_debug_request; extern int g_win_status_debug_request;
@ -197,14 +199,14 @@ Cfg_menu g_cfg_disk_menu[] = {
{ 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 },
}; };
// OG Use define instead of const for joystick_types // OG Use define instead of const for joystick_types
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x) #define TOSTRING(x) STRINGIFY(x)
Cfg_menu g_cfg_joystick_menu[] = { Cfg_menu g_cfg_joystick_menu[] = {
{ "Joystick Configuration", g_cfg_joystick_menu, 0, 0, CFGTYPE_MENU }, { "Joystick Configuration", g_cfg_joystick_menu, 0, 0, CFGTYPE_MENU },
{ "Joystick Emulation,"TOSTRING(JOYSTICK_TYPE_KEYPAD)",Keypad Joystick,"TOSTRING(JOYSTICK_TYPE_MOUSE)",Mouse Joystick,"TOSTRING(JOYSTICK_TYPE_NATIVE_1)",Native Joystick 1," { "Joystick Emulation,"TOSTRING(JOYSTICK_TYPE_KEYPAD)",Keypad Joystick,"TOSTRING(JOYSTICK_TYPE_MOUSE)",Mouse Joystick,"TOSTRING(JOYSTICK_TYPE_NATIVE_1)",Native Joystick 1,"
TOSTRING(JOYSTICK_TYPE_NATIVE_2)",Native Joystick 2,"TOSTRING(JOYSTICK_TYPE_NONE)",No Joystick", KNMP(g_joystick_type), CFGTYPE_INT }, TOSTRING(JOYSTICK_TYPE_NATIVE_2)",Native Joystick 2,"TOSTRING(JOYSTICK_TYPE_NONE)",No Joystick", KNMP(g_joystick_type), CFGTYPE_INT },
{ "Joystick Scale X,0x100,Standard,0x119,+10%,0x133,+20%," { "Joystick Scale X,0x100,Standard,0x119,+10%,0x133,+20%,"
"0x150,+30%,0xb0,-30%,0xcd,-20%,0xe7,-10%", "0x150,+30%,0xb0,-30%,0xcd,-20%,0xe7,-10%",
KNMP(g_joystick_scale_factor_x), CFGTYPE_INT }, KNMP(g_joystick_scale_factor_x), CFGTYPE_INT },
@ -287,7 +289,7 @@ Cfg_menu g_cfg_ethernet_menu[] = {
}; };
#ifdef HAVE_SDL #ifdef HAVE_SDL
Cfg_menu g_cfg_printer_menu[] = { Cfg_menu g_cfg_printer_menu[] = {
{ "Virtual Epson Configuration", g_cfg_printer_menu, 0, 0, CFGTYPE_MENU }, { "Virtual Epson Configuration", g_cfg_printer_menu, 0, 0, CFGTYPE_MENU },
{ "Virtual Printer Type,0,Epson LQ", { "Virtual Printer Type,0,Epson LQ",
KNMP(g_printer), CFGTYPE_INT }, KNMP(g_printer), CFGTYPE_INT },
{ "Printer DPI,60,60x60 dpi,180,180x180 dpi,360,360x360 dpi", { "Printer DPI,60,60x60 dpi,180,180x180 dpi,360,360x360 dpi",
@ -313,36 +315,36 @@ Cfg_menu g_cfg_printer_menu[] = {
{ 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 },
}; };
Cfg_menu g_cfg_imagewriter_menu[] = { Cfg_menu g_cfg_imagewriter_menu[] = {
{ "Virtual ImageWriter Configuration", g_cfg_imagewriter_menu, 0, 0, CFGTYPE_MENU }, { "Virtual ImageWriter Configuration", g_cfg_imagewriter_menu, 0, 0, CFGTYPE_MENU },
{ "Virtual Printer Type,0,ImageWriter II,1,ImageWriter LQ", { "Virtual Printer Type,0,ImageWriter II,1,ImageWriter LQ",
KNMP(g_imagewriter), CFGTYPE_INT }, KNMP(g_imagewriter), CFGTYPE_INT },
{ "Paper Size,0,US Letter (8.5x11in),1,US Legal (8.5x14in),2,ISO A4 (210 x 297mm),3,ISO B5 (176 x 250mm),4,Wide Fanfold (14 x 11in),5,Ledger (11 x 17in),6,ISO A3 (297 x 420mm)", { "Paper Size,0,US Letter (8.5x11in),1,US Legal (8.5x14in),2,ISO A4 (210 x 297mm),3,ISO B5 (176 x 250mm),4,Wide Fanfold (14 x 11in),5,Ledger (11 x 17in),6,ISO A3 (297 x 420mm)",
KNMP(g_imagewriter_paper), CFGTYPE_INT }, KNMP(g_imagewriter_paper), CFGTYPE_INT },
{ "Printer DPI,360,360x360 dpi (Best for 8-bit software),720,720x720 dpi (Best for GS/OS & IW LQ Modes),1440,1440x1440 dpi", { "Printer DPI,360,360x360 dpi (Best for 8-bit software),720,720x720 dpi (Best for GS/OS & IW LQ Modes),1440,1440x1440 dpi",
KNMP(g_imagewriter_dpi), CFGTYPE_INT }, KNMP(g_imagewriter_dpi), CFGTYPE_INT },
{ "Banner Printing (Limited To 144x144 dpi Output),0,Banner Printing Off,3,3 Pages Long,4,4 Pages Long,5,5 Pages Long,6,6 Pages Long,7,7 Pages Long,8,8 Pages Long,9,9 Pages Long,10,10 Pages Long", { "Banner Printing (Limited To 144x144 dpi Output),0,Banner Printing Off,3,3 Pages Long,4,4 Pages Long,5,5 Pages Long,6,6 Pages Long,7,7 Pages Long,8,8 Pages Long,9,9 Pages Long,10,10 Pages Long",
KNMP(g_imagewriter_banner), CFGTYPE_INT }, KNMP(g_imagewriter_banner), CFGTYPE_INT },
{ "Printer Output Type,bmp,Windows Bitmap,ps,Postscript (B&W),colorps,Postscript (Color),printer,Direct to host printer,text,Text file", { "Printer Output Type,bmp,Windows Bitmap,ps,Postscript (B&W),colorps,Postscript (Color),printer,Direct to host printer,text,Text file",
KNMP(g_imagewriter_output), CFGTYPE_STR }, KNMP(g_imagewriter_output), CFGTYPE_STR },
{ "Multipage Files? (PS and Direct to Host Only),0,No,1,Yes", { "Multipage Files? (PS and Direct to Host Only),0,No,1,Yes",
KNMP(g_imagewriter_multipage), CFGTYPE_INT }, KNMP(g_imagewriter_multipage), CFGTYPE_INT },
{ "Printer Timeout,0,Never,2,2 sec.,15,15 sec.,30,30 sec.,60, 1 min.", { "Printer Timeout,0,Never,2,2 sec.,15,15 sec.,30,30 sec.,60, 1 min.",
KNMP(g_imagewriter_timeout), CFGTYPE_INT }, KNMP(g_imagewriter_timeout), CFGTYPE_INT },
{ "", 0, 0, 0, 0 },
{ "ImageWriter Fonts", 0, 0, 0, 0 },
{ "-----------------", 0, 0, 0, 0 },
{ "", 0, 0, 0, 0 },
{ "Fixed Width Font", KNMP(g_imagewriter_fixed_font), CFGTYPE_FILE },
{ "", 0, 0, 0, 0 },
{ "Proportional Font", KNMP(g_imagewriter_prop_font), CFGTYPE_FILE },
{ "", 0, 0, 0, 0 }, { "", 0, 0, 0, 0 },
{ "", 0, 0, 0, 0 }, { "ImageWriter Fonts", 0, 0, 0, 0 },
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU }, { "-----------------", 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }, { "", 0, 0, 0, 0 },
}; { "Fixed Width Font", KNMP(g_imagewriter_fixed_font), CFGTYPE_FILE },
#endif { "", 0, 0, 0, 0 },
{ "Proportional Font", KNMP(g_imagewriter_prop_font), CFGTYPE_FILE },
{ "", 0, 0, 0, 0 },
{ "", 0, 0, 0, 0 },
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
{ 0, 0, 0, 0, 0 },
};
#endif
Cfg_menu g_cfg_devel_menu[] = { Cfg_menu g_cfg_devel_menu[] = {
{ "Developer Options", g_cfg_devel_menu, 0, 0, CFGTYPE_MENU }, { "Developer Options", g_cfg_devel_menu, 0, 0, CFGTYPE_MENU },
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
@ -2256,9 +2258,9 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
defval = -1; defval = -1;
curstr = 0; curstr = 0;
if(type == CFGTYPE_INT) { if(type == CFGTYPE_INT) {
iptr = (int*)menuptr->ptr; // OG Added cast iptr = (int*)menuptr->ptr; // OG Added cast
curval = *iptr; curval = *iptr;
iptr = (int*)menuptr->defptr; // OG Added cast iptr = (int*)menuptr->defptr; // OG Added cast
defval = *iptr; defval = *iptr;
if(curval == defval) { if(curval == defval) {
g_cfg_opt_buf[3] = 'D'; /* checkmark */ g_cfg_opt_buf[3] = 'D'; /* checkmark */
@ -2570,10 +2572,10 @@ cfg_file_add_dirent(Cfg_listhdr *listhdrptr, const char *nameptr, int is_dir,
inc_amt = MAX(64, listhdrptr->max); inc_amt = MAX(64, listhdrptr->max);
inc_amt = MIN(inc_amt, 1024); inc_amt = MIN(inc_amt, 1024);
listhdrptr->max += inc_amt; listhdrptr->max += inc_amt;
listhdrptr->direntptr = (Cfg_dirent*)realloc(listhdrptr->direntptr, listhdrptr->direntptr = (Cfg_dirent*)realloc(listhdrptr->direntptr,
listhdrptr->max * sizeof(Cfg_dirent)); listhdrptr->max * sizeof(Cfg_dirent));
} }
ptr = (char*)malloc(namelen+1+is_dir); // OG Added cast ptr = (char*)malloc(namelen+1+is_dir); // OG Added cast
strncpy(ptr, nameptr, namelen+1); strncpy(ptr, nameptr, namelen+1);
if(is_dir) { if(is_dir) {
strcat(ptr, "/"); strcat(ptr, "/");
@ -2599,10 +2601,10 @@ cfg_dirent_sortfn(const void *obj1, const void *obj2)
/* Called by qsort to sort directory listings */ /* Called by qsort to sort directory listings */
direntptr1 = (const Cfg_dirent *)obj1; direntptr1 = (const Cfg_dirent *)obj1;
direntptr2 = (const Cfg_dirent *)obj2; direntptr2 = (const Cfg_dirent *)obj2;
#if defined(MAC) || defined(_WIN32) #if defined(MAC) || defined(_WIN32)
// OG // OG
ret = 0; ret = 0;
// ret = strcasecmp(direntptr1->name, direntptr2->name); // ret = strcasecmp(direntptr1->name, direntptr2->name);
#else #else
ret = strcmp(direntptr1->name, direntptr2->name); ret = strcmp(direntptr1->name, direntptr2->name);
#endif #endif
@ -3042,7 +3044,7 @@ cfg_file_update_ptr(char *str)
char *newstr; char *newstr;
int len; int len;
len = strlen(str) + 1; len = strlen(str) + 1;
newstr = (char*)malloc(len); newstr = (char*)malloc(len);
memcpy(newstr, str, len); memcpy(newstr, str, len);
if(g_cfg_file_strptr) { if(g_cfg_file_strptr) {
if(*g_cfg_file_strptr) { if(*g_cfg_file_strptr) {
@ -3415,12 +3417,12 @@ config_control_panel()
g_full_refresh_needed = -1; g_full_refresh_needed = -1;
g_a2_screen_buffer_changed = -1; g_a2_screen_buffer_changed = -1;
} }
void x_clk_setup_bram_version() void x_clk_setup_bram_version()
{ {
if(g_rom_version < 3) { if(g_rom_version < 3) {
g_bram_ptr = (&g_bram[0][0]); // ROM 01 g_bram_ptr = (&g_bram[0][0]); // ROM 01
} else { } else {
g_bram_ptr = (&g_bram[1][0]); // ROM 03 g_bram_ptr = (&g_bram[1][0]); // ROM 03
} }
} }

View File

@ -1,7 +1,9 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@ -21,15 +23,15 @@
#include "defcomm.h" #include "defcomm.h"
// OG redirect printf to console // OG redirect printf to console
#ifdef ACTIVEGS #ifdef ACTIVEGS
#include <stdio.h> #include <stdio.h>
extern "C" int outputInfo(const char* format,...); extern "C" int outputInfo(const char* format,...);
extern "C" int fOutputInfo(FILE*,const char* format,...); extern "C" int fOutputInfo(FILE*,const char* format,...);
#define printf outputInfo #define printf outputInfo
#define fprintf fOutputInfo #define fprintf fOutputInfo
#endif #endif
#define STRUCT(a) typedef struct _ ## a a; struct _ ## a #define STRUCT(a) typedef struct _ ## a a; struct _ ## a
typedef unsigned char byte; typedef unsigned char byte;
@ -83,45 +85,45 @@ void U_STACK_TRACE();
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#ifndef UNDER_CE // OG CE SPecific #ifndef UNDER_CE // OG CE SPecific
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
// OG Adding support for open // OG Adding support for open
#ifdef WIN32 #ifdef WIN32
#include <io.h> #include <io.h>
#endif #endif
#else #else
extern int errno; extern int errno;
extern int open(const char* name,int,...); extern int open(const char* name,int,...);
extern int read(int,char*,int); extern int read(int,char*,int);
extern int close(int); extern int close(int);
extern int write( int fd, const void *buffer, unsigned int count ); extern int write( int fd, const void *buffer, unsigned int count );
extern int lseek(int,int,int); extern int lseek(int,int,int);
struct stat { int st_size; }; struct stat { int st_size; };
extern int stat(const char* name, struct stat*); extern int stat(const char* name, struct stat*);
extern int fstat(int, struct stat*); extern int fstat(int, struct stat*);
#define O_RDWR 1 #define O_RDWR 1
#define O_BINARY 2 #define O_BINARY 2
#define O_RDONLY 4 #define O_RDONLY 4
#define O_WRONLY 8 #define O_WRONLY 8
#define O_CREAT 16 #define O_CREAT 16
#define O_TRUNC 32 #define O_TRUNC 32
#define EAGAIN 11 #define EAGAIN 11
#define EINTR 4 #define EINTR 4
#endif #endif
#ifdef HPUX #ifdef HPUX
# include <machine/inline.h> /* for GET_ITIMER */ # include <machine/inline.h> /* for GET_ITIMER */
#endif #endif
@ -361,10 +363,10 @@ STRUCT(Emustate_word32list) {
#include "iwm.h" #include "iwm.h"
#include "protos.h" #include "protos.h"
// OG Added define for joystick // OG Added define for joystick
#define JOYSTICK_TYPE_KEYPAD 0 #define JOYSTICK_TYPE_KEYPAD 0
#define JOYSTICK_TYPE_MOUSE 1 #define JOYSTICK_TYPE_MOUSE 1
#define JOYSTICK_TYPE_NATIVE_1 2 #define JOYSTICK_TYPE_NATIVE_1 2
#define JOYSTICK_TYPE_NATIVE_2 3 #define JOYSTICK_TYPE_NATIVE_2 3
#define JOYSTICK_TYPE_NONE 4 // OG Added Joystick None #define JOYSTICK_TYPE_NONE 4 // OG Added Joystick None
#define NB_JOYSTICK_TYPE 5 #define NB_JOYSTICK_TYPE 5

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@ -35,8 +37,8 @@
#define HALT_EVENT 0x10 #define HALT_EVENT 0x10
#define HALT_WANTTOQUIT 0x20 // OG : added WANTTOQUIT event #define HALT_WANTTOQUIT 0x20 // OG : added WANTTOQUIT event
#define HALT_WANTTOBRK 0x40 // OG : added WANTTOBRK event #define HALT_WANTTOBRK 0x40 // OG : added WANTTOBRK event
#define MAX_BREAK_POINTS 0x20 #define MAX_BREAK_POINTS 0x20
@ -148,11 +150,11 @@
#define BORDER_WIDTH 32 #define BORDER_WIDTH 32
//#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560)) //#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560))
// OG Eff_border_widht == border side in A2 mode
#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560)/2)
// OG Eff_border_widht == border side in A2 mode
#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560)/2)
/* BASE_MARGIN_BOTTOM+MARGIN_TOP must equal 62. There are 262 scan lines */ /* BASE_MARGIN_BOTTOM+MARGIN_TOP must equal 62. There are 262 scan lines */
/* at 60Hz (15.7KHz line rate) and so we just make 62 border lines */ /* at 60Hz (15.7KHz line rate) and so we just make 62 border lines */
#define BASE_MARGIN_TOP 32 #define BASE_MARGIN_TOP 32

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@ -61,8 +63,8 @@ char *line_ptr;
int mode,old_mode; int mode,old_mode;
int got_num; int got_num;
// OG replaced by HALT_WANTTOQUIT // OG replaced by HALT_WANTTOQUIT
//int g_quit_sim_now = 0; //int g_quit_sim_now = 0;
int int
get_num() get_num()
@ -177,9 +179,9 @@ do_debug_intfc()
g_fullscreen = 0; g_fullscreen = 0;
x_full_screen(0); x_full_screen(0);
// OG use HALT_WANTTOQUIT instead of g_quit_sim_now // OG use HALT_WANTTOQUIT instead of g_quit_sim_now
if (halt_sim&HALT_WANTTOQUIT) if (halt_sim&HALT_WANTTOQUIT)
{ {
printf("Exiting immediately\n"); printf("Exiting immediately\n");
return; return;
} }
@ -863,15 +865,15 @@ do_debug_unix()
} }
if(load) { if(load) {
if(a1bank >= 0xe0 && a1bank < 0xe2) { if(a1bank >= 0xe0 && a1bank < 0xe2) {
ret = read(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len); ret = read(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
} else { } else {
ret = read(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len); ret = read(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
} }
} else { } else {
if(a1bank >= 0xe0 && a1bank < 0xe2) { if(a1bank >= 0xe0 && a1bank < 0xe2) {
ret = write(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len); ret = write(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
} else { } else {
ret = write(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len); ret = write(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
} }
} }
printf("Read/write: addr %06x for %04x bytes, ret: %x bytes\n", printf("Read/write: addr %06x for %04x bytes, ret: %x bytes\n",

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@ -583,8 +585,8 @@ get_memory16_c(word32 addr, int cycs)
double fcycs; double fcycs;
fcycs = 0; fcycs = 0;
return get_memory_c(addr, (int)fcycs) + return get_memory_c(addr, (int)fcycs) +
(get_memory_c(addr+1, (int)fcycs) << 8); (get_memory_c(addr+1, (int)fcycs) << 8);
} }
word32 word32
@ -593,9 +595,9 @@ get_memory24_c(word32 addr, int cycs)
double fcycs; double fcycs;
fcycs = 0; fcycs = 0;
return get_memory_c(addr, (int)fcycs) + return get_memory_c(addr, (int)fcycs) +
(get_memory_c(addr+1, (int)fcycs) << 8) + (get_memory_c(addr+1, (int)fcycs) << 8) +
(get_memory_c(addr+2, (int)fcycs) << 16); (get_memory_c(addr+2, (int)fcycs) << 16);
} }
void void
@ -748,11 +750,11 @@ fixed_memory_ptrs_init()
/* set g_slow_memory_ptr, g_rom_fc_ff_ptr, g_dummy_memory1_ptr, */ /* set g_slow_memory_ptr, g_rom_fc_ff_ptr, g_dummy_memory1_ptr, */
/* and rom_cards_ptr */ /* and rom_cards_ptr */
// OG Filled allocated ptr parameter to free the memory // OG Filled allocated ptr parameter to free the memory
g_slow_memory_ptr = memalloc_align(128*1024, 0, (void**)&g_slow_memory_ptr_allocated); g_slow_memory_ptr = memalloc_align(128*1024, 0, (void**)&g_slow_memory_ptr_allocated);
g_dummy_memory1_ptr = memalloc_align(256, 1024, (void**)&g_dummy_memory1_ptr_allocated); g_dummy_memory1_ptr = memalloc_align(256, 1024, (void**)&g_dummy_memory1_ptr_allocated);
g_rom_fc_ff_ptr = memalloc_align(256*1024, 512, (void**)&g_rom_fc_ff_ptr_allocated); g_rom_fc_ff_ptr = memalloc_align(256*1024, 512, (void**)&g_rom_fc_ff_ptr_allocated);
g_rom_cards_ptr = memalloc_align(16*256, 256, (void**)&g_rom_cards_ptr_allocated); g_rom_cards_ptr = memalloc_align(16*256, 256, (void**)&g_rom_cards_ptr_allocated);
#if 0 #if 0
printf("g_memory_ptr: %08x, dummy_mem: %08x, slow_mem_ptr: %08x\n", printf("g_memory_ptr: %08x, dummy_mem: %08x, slow_mem_ptr: %08x\n",
@ -766,22 +768,22 @@ fixed_memory_ptrs_init()
#endif #endif
} }
// OG added fixed_memory_ptrs_shut // OG added fixed_memory_ptrs_shut
void fixed_memory_ptrs_shut() void fixed_memory_ptrs_shut()
{ {
free(g_slow_memory_ptr_allocated); free(g_slow_memory_ptr_allocated);
free(g_dummy_memory1_ptr_allocated); free(g_dummy_memory1_ptr_allocated);
free(g_rom_fc_ff_ptr_allocated); free(g_rom_fc_ff_ptr_allocated);
free(g_rom_cards_ptr_allocated); free(g_rom_cards_ptr_allocated);
g_slow_memory_ptr=g_slow_memory_ptr_allocated= NULL; g_slow_memory_ptr=g_slow_memory_ptr_allocated= NULL;
g_dummy_memory1_ptr = g_dummy_memory1_ptr_allocated = NULL; g_dummy_memory1_ptr = g_dummy_memory1_ptr_allocated = NULL;
g_rom_fc_ff_ptr = g_rom_fc_ff_ptr_allocated = NULL; g_rom_fc_ff_ptr = g_rom_fc_ff_ptr_allocated = NULL;
// g_rom_cards_ptr = g_rom_cards_ptr = NULL; // a mistake? // g_rom_cards_ptr = g_rom_cards_ptr = NULL; // a mistake?
g_rom_cards_ptr = NULL; g_rom_cards_ptr = NULL;
} }
word32 word32
get_itimer() get_itimer()
{ {
@ -909,7 +911,7 @@ get_remaining_operands(word32 addr, word32 opcode, word32 psr, Fplus *fplus_ptr)
if((addr & 0xfffff0) == 0x00c700) { \ if((addr & 0xfffff0) == 0x00c700) { \
if(addr == 0xc700) { \ if(addr == 0xc700) { \
FINISH(RET_C700, 0); \ FINISH(RET_C700, 0); \
} else if(addr == 0xc70a) { \ } else if(addr == 0xc70a) { \
FINISH(RET_C70A, 0); \ FINISH(RET_C70A, 0); \
} else if(addr == 0xc70d) { \ } else if(addr == 0xc70d) { \
FINISH(RET_C70D, 0); \ FINISH(RET_C70D, 0); \

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,36 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop # Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsport", "gsport.vcxproj", "{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsport", "gsport.vcxproj", "{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B} = {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B} {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B} = {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}
{E810477A-E004-4308-A58A-21393213EF89} = {E810477A-E004-4308-A58A-21393213EF89} {E810477A-E004-4308-A58A-21393213EF89} = {E810477A-E004-4308-A58A-21393213EF89}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tfe", "tfe\tfe.vcxproj", "{E810477A-E004-4308-A58A-21393213EF89}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tfe", "tfe\tfe.vcxproj", "{E810477A-E004-4308-A58A-21393213EF89}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atbridge", "atbridge\atbridge.vcxproj", "{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atbridge", "atbridge\atbridge.vcxproj", "{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.ActiveCfg = Debug|Win32 {0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.ActiveCfg = Debug|Win32
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.Build.0 = Debug|Win32 {0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.Build.0 = Debug|Win32
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.ActiveCfg = Release|Win32 {0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.ActiveCfg = Release|Win32
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.Build.0 = Release|Win32 {0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.Build.0 = Release|Win32
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.ActiveCfg = Debug|Win32 {E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.ActiveCfg = Debug|Win32
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.Build.0 = Debug|Win32 {E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.Build.0 = Debug|Win32
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.ActiveCfg = Release|Win32 {E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.ActiveCfg = Release|Win32
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.Build.0 = Release|Win32 {E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.Build.0 = Release|Win32
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.ActiveCfg = Debug|Win32 {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.ActiveCfg = Debug|Win32
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.Build.0 = Debug|Win32 {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.Build.0 = Debug|Win32
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.ActiveCfg = Release|Win32 {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.ActiveCfg = Release|Win32
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.Build.0 = Release|Win32 {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,203 +1,203 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}</ProjectGuid> <ProjectGuid>{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>gsport</RootNamespace> <RootNamespace>gsport</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_TFE;HAVE_ATBRIDGE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_TFE;HAVE_ATBRIDGE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<BufferSecurityCheck>true</BufferSecurityCheck> <BufferSecurityCheck>true</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<ErrorReporting>Prompt</ErrorReporting> <ErrorReporting>Prompt</ErrorReporting>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_ATBRIDGE;HAVE_TFE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_ATBRIDGE;HAVE_TFE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<ErrorReporting>Prompt</ErrorReporting> <ErrorReporting>Prompt</ErrorReporting>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="16inst_c.h" /> <ClInclude Include="16inst_c.h" />
<ClInclude Include="8inst_c.h" /> <ClInclude Include="8inst_c.h" />
<ClInclude Include="adb.h" /> <ClInclude Include="adb.h" />
<ClInclude Include="config.h" /> <ClInclude Include="config.h" />
<ClInclude Include="defc.h" /> <ClInclude Include="defc.h" />
<ClInclude Include="defcomm.h" /> <ClInclude Include="defcomm.h" />
<ClInclude Include="defs.h" /> <ClInclude Include="defs.h" />
<ClInclude Include="defs_instr.h" /> <ClInclude Include="defs_instr.h" />
<ClInclude Include="disas.h" /> <ClInclude Include="disas.h" />
<ClInclude Include="gsportfont.h" /> <ClInclude Include="gsportfont.h" />
<CustomBuild Include="instable.h"> <CustomBuild Include="instable.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_inst c 8 instable.h &gt; 8inst_c.h <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_inst c 8 instable.h &gt; 8inst_c.h
perl make_inst c 16 instable.h &gt; 16inst_c.h perl make_inst c 16 instable.h &gt; 16inst_c.h
perl make_inst s 8 instable.h &gt; 8inst_s.h perl make_inst s 8 instable.h &gt; 8inst_s.h
perl make_inst s 16 instable.h &gt; 16inst_s.h</Command> perl make_inst s 16 instable.h &gt; 16inst_s.h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects> <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_inst c 8 instable.h &gt; 8inst_c.h <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_inst c 8 instable.h &gt; 8inst_c.h
perl make_inst c 16 instable.h &gt; 16inst_c.h perl make_inst c 16 instable.h &gt; 16inst_c.h
perl make_inst s 8 instable.h &gt; 8inst_s.h perl make_inst s 8 instable.h &gt; 8inst_s.h
perl make_inst s 16 instable.h &gt; 16inst_s.h</Command> perl make_inst s 16 instable.h &gt; 16inst_s.h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects> <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
</CustomBuild> </CustomBuild>
<ClInclude Include="scc_llap.h" /> <ClInclude Include="scc_llap.h" />
<ClInclude Include="win_keymap.h" /> <ClInclude Include="win_keymap.h" />
<ClInclude Include="iwm.h" /> <ClInclude Include="iwm.h" />
<ClInclude Include="iwm_35_525.h" /> <ClInclude Include="iwm_35_525.h" />
<ClInclude Include="op_routs.h" /> <ClInclude Include="op_routs.h" />
<ClInclude Include="printer.h" /> <ClInclude Include="printer.h" />
<ClInclude Include="printer_charmaps.h" /> <ClInclude Include="printer_charmaps.h" />
<ClInclude Include="imagewriter.h" /> <ClInclude Include="imagewriter.h" />
<ClInclude Include="iw_charmaps.h" /> <ClInclude Include="iw_charmaps.h" />
<ClInclude Include="prodos.h" /> <ClInclude Include="prodos.h" />
<ClInclude Include="prodos_protos.h" /> <ClInclude Include="prodos_protos.h" />
<ClInclude Include="protos.h" /> <ClInclude Include="protos.h" />
<ClInclude Include="protos_engine_c.h" /> <ClInclude Include="protos_engine_c.h" />
<ClInclude Include="protos_macdriver.h" /> <ClInclude Include="protos_macdriver.h" />
<ClInclude Include="protos_macsnd_driver.h" /> <ClInclude Include="protos_macsnd_driver.h" />
<ClInclude Include="protos_windriver.h" /> <ClInclude Include="protos_windriver.h" />
<ClInclude Include="protos_xdriver.h" /> <ClInclude Include="protos_xdriver.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="scc.h" /> <ClInclude Include="scc.h" />
<ClInclude Include="size_c.h" /> <ClInclude Include="size_c.h" />
<CustomBuild Include="size_tab.h"> <CustomBuild Include="size_tab.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_size c size_tab.h &gt; size_c.h <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_size c size_tab.h &gt; size_c.h
perl make_size s size_tab.h &gt; size_s.h perl make_size s size_tab.h &gt; size_s.h
perl make_size 8 size_tab.h &gt; 8size_s.h perl make_size 8 size_tab.h &gt; 8size_s.h
perl make_size 16 size_tab.h &gt; 16size_s.h perl make_size 16 size_tab.h &gt; 16size_s.h
perl make_size c size_tab.h &gt; size_c.h</Command> perl make_size c size_tab.h &gt; size_c.h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects> <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_size c size_tab.h &gt; size_c.h <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_size c size_tab.h &gt; size_c.h
perl make_size s size_tab.h &gt; size_s.h perl make_size s size_tab.h &gt; size_s.h
perl make_size 8 size_tab.h &gt; 8size_s.h perl make_size 8 size_tab.h &gt; 8size_s.h
perl make_size 16 size_tab.h &gt; 16size_s.h perl make_size 16 size_tab.h &gt; 16size_s.h
perl make_size c size_tab.h &gt; size_c.h</Command> perl make_size c size_tab.h &gt; size_c.h</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects> <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
</CustomBuild> </CustomBuild>
<ClInclude Include="sound.h" /> <ClInclude Include="sound.h" />
<ClInclude Include="superhires.h" /> <ClInclude Include="superhires.h" />
<ClInclude Include="support.h" /> <ClInclude Include="support.h" />
<ClInclude Include="tfe\protos_tfe.h" /> <ClInclude Include="tfe\protos_tfe.h" />
<ClInclude Include="winresource.h" /> <ClInclude Include="winresource.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="adb.c" /> <ClCompile Include="adb.c" />
<ClCompile Include="clock.c" /> <ClCompile Include="clock.c" />
<ClCompile Include="compile_time.c" /> <ClCompile Include="compile_time.c" />
<ClCompile Include="config.c" /> <ClCompile Include="config.c" />
<ClCompile Include="dis.c" /> <ClCompile Include="dis.c" />
<ClCompile Include="engine_c.c" /> <ClCompile Include="engine_c.c" />
<ClCompile Include="iwm.c" /> <ClCompile Include="iwm.c" />
<ClCompile Include="joystick_driver.c" /> <ClCompile Include="joystick_driver.c" />
<ClCompile Include="moremem.c" /> <ClCompile Include="moremem.c" />
<ClCompile Include="paddles.c" /> <ClCompile Include="paddles.c" />
<ClCompile Include="parallel.c" /> <ClCompile Include="parallel.c" />
<ClCompile Include="printer.cpp"> <ClCompile Include="printer.cpp">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
</ClCompile> </ClCompile>
<ClCompile Include="scc_imagewriter.c" /> <ClCompile Include="scc_imagewriter.c" />
<ClCompile Include="imagewriter.cpp"> <ClCompile Include="imagewriter.cpp">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs> <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
</ClCompile> </ClCompile>
<ClCompile Include="scc.c" /> <ClCompile Include="scc.c" />
<ClCompile Include="scc_llap.c" /> <ClCompile Include="scc_llap.c" />
<ClCompile Include="scc_socket_driver.c" /> <ClCompile Include="scc_socket_driver.c" />
<ClCompile Include="scc_windriver.c" /> <ClCompile Include="scc_windriver.c" />
<ClCompile Include="sim65816.c" /> <ClCompile Include="sim65816.c" />
<ClCompile Include="smartport.c" /> <ClCompile Include="smartport.c" />
<ClCompile Include="sound.c" /> <ClCompile Include="sound.c" />
<ClCompile Include="sound_driver.c" /> <ClCompile Include="sound_driver.c" />
<ClCompile Include="video.c" /> <ClCompile Include="video.c" />
<ClCompile Include="win32snd_driver.c" /> <ClCompile Include="win32snd_driver.c" />
<ClCompile Include="win_console.c" /> <ClCompile Include="win_console.c" />
<ClCompile Include="win_generic.c" /> <ClCompile Include="win_generic.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="win32.rc" /> <ResourceCompile Include="win32.rc" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,217 +1,217 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Resource Files"> <Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="16inst_c.h"> <ClInclude Include="16inst_c.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="8inst_c.h"> <ClInclude Include="8inst_c.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="adb.h"> <ClInclude Include="adb.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="config.h"> <ClInclude Include="config.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="defc.h"> <ClInclude Include="defc.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="defcomm.h"> <ClInclude Include="defcomm.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="defs.h"> <ClInclude Include="defs.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="defs_instr.h"> <ClInclude Include="defs_instr.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="disas.h"> <ClInclude Include="disas.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="gsportfont.h"> <ClInclude Include="gsportfont.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="iwm.h"> <ClInclude Include="iwm.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="iwm_35_525.h"> <ClInclude Include="iwm_35_525.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="op_routs.h"> <ClInclude Include="op_routs.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="printer.h"> <ClInclude Include="printer.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="printer_charmaps.h"> <ClInclude Include="printer_charmaps.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="imagewriter.h"> <ClInclude Include="imagewriter.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="iw_charmaps.h"> <ClInclude Include="iw_charmaps.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="prodos.h"> <ClInclude Include="prodos.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="prodos_protos.h"> <ClInclude Include="prodos_protos.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos.h"> <ClInclude Include="protos.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos_engine_c.h"> <ClInclude Include="protos_engine_c.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos_macdriver.h"> <ClInclude Include="protos_macdriver.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos_macsnd_driver.h"> <ClInclude Include="protos_macsnd_driver.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos_windriver.h"> <ClInclude Include="protos_windriver.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="protos_xdriver.h"> <ClInclude Include="protos_xdriver.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="scc.h"> <ClInclude Include="scc.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="size_c.h"> <ClInclude Include="size_c.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="sound.h"> <ClInclude Include="sound.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="superhires.h"> <ClInclude Include="superhires.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="support.h"> <ClInclude Include="support.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="winresource.h"> <ClInclude Include="winresource.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="tfe\protos_tfe.h"> <ClInclude Include="tfe\protos_tfe.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="win_keymap.h"> <ClInclude Include="win_keymap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="scc_llap.h"> <ClInclude Include="scc_llap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="adb.c"> <ClCompile Include="adb.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="clock.c"> <ClCompile Include="clock.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="compile_time.c"> <ClCompile Include="compile_time.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="config.c"> <ClCompile Include="config.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dis.c"> <ClCompile Include="dis.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="engine_c.c"> <ClCompile Include="engine_c.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="iwm.c"> <ClCompile Include="iwm.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="joystick_driver.c"> <ClCompile Include="joystick_driver.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="moremem.c"> <ClCompile Include="moremem.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="paddles.c"> <ClCompile Include="paddles.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="scc.c"> <ClCompile Include="scc.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="scc_socket_driver.c"> <ClCompile Include="scc_socket_driver.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="scc_windriver.c"> <ClCompile Include="scc_windriver.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="sim65816.c"> <ClCompile Include="sim65816.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="smartport.c"> <ClCompile Include="smartport.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="sound.c"> <ClCompile Include="sound.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="sound_driver.c"> <ClCompile Include="sound_driver.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="video.c"> <ClCompile Include="video.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="win32snd_driver.c"> <ClCompile Include="win32snd_driver.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="win_console.c"> <ClCompile Include="win_console.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="win_generic.c"> <ClCompile Include="win_generic.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="parallel.c"> <ClCompile Include="parallel.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="printer.cpp"> <ClCompile Include="printer.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="scc_imagewriter.c"> <ClCompile Include="scc_imagewriter.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="imagewriter.cpp"> <ClCompile Include="imagewriter.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="scc_llap.c"> <ClCompile Include="scc_llap.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="size_tab.h"> <CustomBuild Include="size_tab.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="instable.h"> <CustomBuild Include="instable.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</CustomBuild> </CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="win32.rc"> <ResourceCompile Include="win32.rc">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,209 +1,209 @@
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource." #include "resource."
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include "afxres.h" #include "afxres.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32 #ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32 #endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Menu // Menu
// //
IDC_GSPORT32 MENU IDC_GSPORT32 MENU
BEGIN BEGIN
POPUP "&Emulator" POPUP "&Emulator"
BEGIN BEGIN
MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK
MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET
MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Flush Printer", ID_FILE_FLUSHPRINTER MENUITEM "Flush Printer", ID_FILE_FLUSHPRINTER
MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK
MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
MENUITEM "Key Commands", ID_HELP_KEY MENUITEM "Key Commands", ID_HELP_KEY
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&About", ID_HELP_ABOUT MENUITEM "&About", ID_HELP_ABOUT
END END
END END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Bitmap // Bitmap
// //
IDC_GSPORT32 BITMAP "wintoolbar.bmp" IDC_GSPORT32 BITMAP "wintoolbar.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Accelerator // Accelerator
// //
IDR_ACCEL ACCELERATORS IDR_ACCEL ACCELERATORS
BEGIN BEGIN
VK_F1, ID_FILE_DISK, VIRTKEY, ALT, NOINVERT VK_F1, ID_FILE_DISK, VIRTKEY, ALT, NOINVERT
VK_F4, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT VK_F4, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
END END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Icon // Icon
// //
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDC_GSPORT32 ICON "gsport32.ico" IDC_GSPORT32 ICON "gsport32.ico"
GSPORT32_ICON ICON "gsport32.ico" GSPORT32_ICON ICON "gsport32.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog
// //
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 207, 82 IDD_ABOUT_DIALOG DIALOGEX 0, 0, 207, 82
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About" CAPTION "About"
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,78,61,50,14 DEFPUSHBUTTON "OK",IDOK,78,61,50,14
LTEXT "GSport: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is free for non-commercial use.",IDC_STATIC,38,7,162,45,NOT WS_GROUP LTEXT "GSport: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is free for non-commercial use.",IDC_STATIC,38,7,162,45,NOT WS_GROUP
ICON "GSPORT32_ICON",IDC_STATIC,7,7,20,20 ICON "GSPORT32_ICON",IDC_STATIC,7,7,20,20
END END
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182 IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Disk Configuration" CAPTION "Disk Configuration"
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,150,161,50,14 DEFPUSHBUTTON "OK",IDOK,150,161,50,14
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14 PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
LTEXT "S5D1",IDC_STATIC,19,46,19,8 LTEXT "S5D1",IDC_STATIC,19,46,19,8
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14 PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
LTEXT "S5D2",IDC_STATIC,19,62,19,8 LTEXT "S5D2",IDC_STATIC,19,62,19,8
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14 PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
LTEXT "S6D1",IDC_STATIC,19,80,19,8 LTEXT "S6D1",IDC_STATIC,19,80,19,8
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14 PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
LTEXT "S6D2",IDC_STATIC,19,98,19,8 LTEXT "S6D2",IDC_STATIC,19,98,19,8
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14 PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
LTEXT "S7D1",IDC_STATIC,19,118,19,8 LTEXT "S7D1",IDC_STATIC,19,118,19,8
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14 PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
LTEXT "S7D2",IDC_STATIC,19,137,19,8 LTEXT "S7D2",IDC_STATIC,19,137,19,8
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14 PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
GROUPBOX "Disk settings",IDC_STATIC,7,7,254,148 GROUPBOX "Disk settings",IDC_STATIC,7,7,254,148
LTEXT "Configure your disk images for each drive. Disk image formats supported\nare *.2MG,*.PO and *.DSK. ",IDC_STATIC,19,20,234,16 LTEXT "Configure your disk images for each drive. Disk image formats supported\nare *.2MG,*.PO and *.DSK. ",IDC_STATIC,19,20,234,16
END END
IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129 IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Speed Control" CAPTION "Speed Control"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
CONTROL "1 MHz",IDC_SLOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,41,51,13 CONTROL "1 MHz",IDC_SLOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,41,51,13
CONTROL "2.5 MHz",IDC_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,55,43,13 CONTROL "2.5 MHz",IDC_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,55,43,13
CONTROL "As fast as possible",IDC_FASTEST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,69,74,13 CONTROL "As fast as possible",IDC_FASTEST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,69,74,13
CONTROL "Custom (MHz)",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,83,69,13 CONTROL "Custom (MHz)",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,83,69,13
EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,133,107,50,15 DEFPUSHBUTTON "OK",IDOK,133,107,50,15
PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15 PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15
GROUPBOX "Speed Control",IDC_STATIC,7,7,226,96,WS_GROUP GROUPBOX "Speed Control",IDC_STATIC,7,7,226,96,WS_GROUP
LTEXT "Adjust the speed of your emulator by selecting the appropriate speed control",IDC_STATIC,46,19,181,19,NOT WS_GROUP LTEXT "Adjust the speed of your emulator by selecting the appropriate speed control",IDC_STATIC,46,19,181,19,NOT WS_GROUP
ICON IDC_GSPORT32,IDC_STATIC,14,19,21,20 ICON IDC_GSPORT32,IDC_STATIC,14,19,21,20
END END
IDD_GSPORT32_KEY DIALOGEX 0, 0, 186, 172 IDD_GSPORT32_KEY DIALOGEX 0, 0, 186, 172
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Help About Key Commands" CAPTION "Help About Key Commands"
FONT 8, "MS Sans Serif", 0, 0, 0x0 FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,65,151,50,14 DEFPUSHBUTTON "OK",IDOK,65,151,50,14
LTEXT "GSport Key Commands",IDC_STATIC,7,7,82,10 LTEXT "GSport Key Commands",IDC_STATIC,7,7,82,10
LTEXT "Alt/F1\t\tOpen-Apple\nF2\t\tClose-Apple\nF7\t\tToggle Fast Disk Emulation\nF8\t\tToggle Mouse Pointer\n\t\tDisplay\n",IDC_STATIC,21,25,151,42 LTEXT "Alt/F1\t\tOpen-Apple\nF2\t\tClose-Apple\nF7\t\tToggle Fast Disk Emulation\nF8\t\tToggle Mouse Pointer\n\t\tDisplay\n",IDC_STATIC,21,25,151,42
LTEXT "F11\t\tToggle Fullscreen Display\nF12\t\tReset\nCtrl-Alt-Break\tReboot Emulator\nCtrl-Alt-Esc\tControl-Panel\nCtrl-Break\tReset Emulator",IDC_STATIC,21,66,141,50 LTEXT "F11\t\tToggle Fullscreen Display\nF12\t\tReset\nCtrl-Alt-Break\tReboot Emulator\nCtrl-Alt-Esc\tControl-Panel\nCtrl-Break\tReset Emulator",IDC_STATIC,21,66,141,50
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | WS_DISABLED | WS_BORDER,7,17,172,1 CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | WS_DISABLED | WS_BORDER,7,17,172,1
LTEXT "For more information, please consult the readme.gsport file",IDC_STATIC,21,124,144,19 LTEXT "For more information, please consult the readme.gsport file",IDC_STATIC,21,124,144,19
END END
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE 1 TEXTINCLUDE
BEGIN BEGIN
"resource.\0" "resource.\0"
END END
3 TEXTINCLUDE 3 TEXTINCLUDE
BEGIN BEGIN
"\r\0" "\r\0"
END END
2 TEXTINCLUDE 2 TEXTINCLUDE
BEGIN BEGIN
"#include ""afxres.h""\r\0" "#include ""afxres.h""\r\0"
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// String Table // String Table
// //
STRINGTABLE STRINGTABLE
BEGIN BEGIN
ID_FILE_DISK "Disk Configuration" ID_FILE_DISK "Disk Configuration"
END END
STRINGTABLE STRINGTABLE
BEGIN BEGIN
ID_SPEED_1MHZ "Set Speed to 1 Mhz" ID_SPEED_1MHZ "Set Speed to 1 Mhz"
ID_SPEED_2MHZ "Set Speed to 2.5 Mhz" ID_SPEED_2MHZ "Set Speed to 2.5 Mhz"
ID_SPEED_FMHZ "Set Speed to as fast as possible" ID_SPEED_FMHZ "Set Speed to as fast as possible"
END END
#endif // English (U.S.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

File diff suppressed because it is too large Load Diff

View File

@ -1,316 +1,318 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2010 - 2011 by GSport contributors Copyright (C) 2010 - 2011 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Copyright (C) 2010 by GSport contributors
This program is free software; you can redistribute it and/or modify it Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* */
* Copyright (C) 2002-2004 The DOSBox Team
* /*
* This program is free software; you can redistribute it and/or modify * Copyright (C) 2002-2004 The DOSBox Team
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * This program is free software; you can redistribute it and/or modify
* (at your option) any later version. * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation; either version 2 of the License, or
* This program is distributed in the hope that it will be useful, * (at your option) any later version.
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * This program is distributed in the hope that it will be useful,
* GNU Library General Public License for more details. * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* You should have received a copy of the GNU General Public License * GNU Library General Public License for more details.
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * You should have received a copy of the GNU General Public License
*/ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* */
Modified for the GSport emulator by Christopher G. Mason 02/2014
Extensively rewritten to provide full emulation of the Apple ImageWriter II /*
printer. Modified for the GSport emulator by Christopher G. Mason 02/2014
Extensively rewritten to provide full emulation of the Apple ImageWriter II
Information used to write this emulator was provided by printer.
Apple's "ImageWriter II Technical Reference Manual"
ISBN# 0-201-17766-8 Information used to write this emulator was provided by
Apple's "ImageWriter II Technical Reference Manual"
Apple's "ImageWriter LQ Reference Manual" ISBN# 0-201-17766-8
ISBN# 0-201-17751-X
*/ Apple's "ImageWriter LQ Reference Manual"
ISBN# 0-201-17751-X
#if !defined __IMAGEWRITER_H */
#define __IMAGEWRITER_H
#ifdef __cplusplus #if !defined __IMAGEWRITER_H
#ifdef C_LIBPNG #define __IMAGEWRITER_H
#include <png.h> #ifdef __cplusplus
#endif #ifdef C_LIBPNG
#include <png.h>
#include <stdio.h> #endif
#ifdef HAVE_SDL #include <stdio.h>
#include "SDL.h"
#ifdef HAVE_SDL
#include <ft2build.h> #include "SDL.h"
#include FT_FREETYPE_H
#endif // HAVE_SDL #include <ft2build.h>
#include FT_FREETYPE_H
#if defined (WIN32) #endif // HAVE_SDL
#include <windows.h>
#include <winspool.h> #if defined (WIN32)
#endif #include <windows.h>
#include <winspool.h>
#define STYLE_PROP 0x01 #endif
#define STYLE_CONDENSED 0x02
#define STYLE_BOLD 0x04 #define STYLE_PROP 0x01
#define STYLE_DOUBLESTRIKE 0x08 #define STYLE_CONDENSED 0x02
#define STYLE_DOUBLEWIDTH 0x10 #define STYLE_BOLD 0x04
#define STYLE_ITALICS 0x20 #define STYLE_DOUBLESTRIKE 0x08
#define STYLE_UNDERLINE 0x40 #define STYLE_DOUBLEWIDTH 0x10
#define STYLE_SUPERSCRIPT 0x80 #define STYLE_ITALICS 0x20
#define STYLE_SUBSCRIPT 0x100 #define STYLE_UNDERLINE 0x40
#define STYLE_HALFHEIGHT 0x200 #define STYLE_SUPERSCRIPT 0x80
#define STYLE_SUBSCRIPT 0x100
#define SCORE_NONE 0x00 #define STYLE_HALFHEIGHT 0x200
#define SCORE_SINGLE 0x01
#define SCORE_DOUBLE 0x02 #define SCORE_NONE 0x00
#define SCORE_SINGLEBROKEN 0x05 #define SCORE_SINGLE 0x01
#define SCORE_DOUBLEBROKEN 0x06 #define SCORE_DOUBLE 0x02
#define SCORE_SINGLEBROKEN 0x05
#define QUALITY_DRAFT 0x01 #define SCORE_DOUBLEBROKEN 0x06
#define QUALITY_LQ 0x02
#define QUALITY_DRAFT 0x01
#define COLOR_BLACK 7<<5 #define QUALITY_LQ 0x02
typedef unsigned Bitu;
typedef signed Bits; #define COLOR_BLACK 7<<5
typedef unsigned char Bit8u; typedef unsigned Bitu;
typedef signed char Bit8s; typedef signed Bits;
typedef unsigned short Bit16u; typedef unsigned char Bit8u;
typedef signed short Bit16s; typedef signed char Bit8s;
typedef unsigned long Bit32u; typedef unsigned short Bit16u;
typedef signed long Bit32s; typedef signed short Bit16s;
typedef double Real64; typedef unsigned long Bit32u;
#if defined(_MSC_VER) typedef signed long Bit32s;
typedef unsigned __int64 Bit64u; typedef double Real64;
typedef signed __int64 Bit64s; #if defined(_MSC_VER)
#else typedef unsigned __int64 Bit64u;
typedef unsigned long long int Bit64u; typedef signed __int64 Bit64s;
typedef signed long long int Bit64s; #else
#endif typedef unsigned long long int Bit64u;
enum IWTypeface typedef signed long long int Bit64s;
{ #endif
fixed = 0, enum IWTypeface
prop = 1 {
}; fixed = 0,
prop = 1
typedef struct { };
Bitu codepage;
const Bit16u* map; typedef struct {
} IWCHARMAP; Bitu codepage;
const Bit16u* map;
} IWCHARMAP;
class Imagewriter {
public:
class Imagewriter {
Imagewriter (Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char* output, bool multipageOutput); public:
virtual ~Imagewriter();
Imagewriter (Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char* output, bool multipageOutput);
// Process one character sent to virtual printer virtual ~Imagewriter();
void printChar(Bit8u ch);
// Process one character sent to virtual printer
// Hard Reset (like switching printer off and on) void printChar(Bit8u ch);
void resetPrinterHard();
// Hard Reset (like switching printer off and on)
// Set Autofeed value void resetPrinterHard();
void setAutofeed(bool feed);
// Set Autofeed value
// Get Autofeed value void setAutofeed(bool feed);
bool getAutofeed();
// Get Autofeed value
// True if printer is unable to process more data right now (do not use printChar) bool getAutofeed();
bool isBusy();
// True if printer is unable to process more data right now (do not use printChar)
// True if the last sent character was received bool isBusy();
bool ack();
// True if the last sent character was received
// Manual formfeed bool ack();
void formFeed();
// Manual formfeed
#ifdef HAVE_SDL void formFeed();
// Returns true if the current page is blank
bool isBlank(); #ifdef HAVE_SDL
#endif // HAVE_SDL // Returns true if the current page is blank
bool isBlank();
private: #endif // HAVE_SDL
// Resets the printer to the factory settings private:
void resetPrinter();
// Resets the printer to the factory settings
// Clears page. If save is true, saves the current page to a bitmap void resetPrinter();
void newPage(bool save, bool resetx);
// Clears page. If save is true, saves the current page to a bitmap
// Closes a multipage document void newPage(bool save, bool resetx);
void finishMultipage();
// Closes a multipage document
// Output current page void finishMultipage();
void outputPage();
// Output current page
#ifdef HAVE_SDL void outputPage();
// used to fill the color "sub-pallettes"
void FillPalette(Bit8u redmax, Bit8u greenmax, Bit8u bluemax, Bit8u colorID, #ifdef HAVE_SDL
SDL_Palette* pal); // used to fill the color "sub-pallettes"
void FillPalette(Bit8u redmax, Bit8u greenmax, Bit8u bluemax, Bit8u colorID,
// Checks if given char belongs to a command and process it. If false, the character SDL_Palette* pal);
// should be printed
bool processCommandChar(Bit8u ch); // Checks if given char belongs to a command and process it. If false, the character
// should be printed
// Reload font. Must be called after changing dpi, style or cpi bool processCommandChar(Bit8u ch);
void updateFont();
// Reload font. Must be called after changing dpi, style or cpi
// Reconfigures printer parameters after changing soft-switches with ESC Z and ESC D void updateFont();
void updateSwitch();
// Reconfigures printer parameters after changing soft-switches with ESC Z and ESC D
// Overprints a slash over zero if softswitch B-1 is set void updateSwitch();
void slashzero(Bit16u penX, Bit16u penY);
// Overprints a slash over zero if softswitch B-1 is set
// Blits the given glyph on the page surface. If add is true, the values of bitmap are void slashzero(Bit16u penX, Bit16u penY);
// added to the values of the pixels in the page
void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool add); // Blits the given glyph on the page surface. If add is true, the values of bitmap are
// added to the values of the pixels in the page
// Draws an anti-aliased line from (fromx, y) to (tox, y). If broken is true, gaps are included void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool add);
void drawLine(Bitu fromx, Bitu tox, Bitu y, bool broken);
// Draws an anti-aliased line from (fromx, y) to (tox, y). If broken is true, gaps are included
// Setup the bitGraph structure void drawLine(Bitu fromx, Bitu tox, Bitu y, bool broken);
void setupBitImage(Bit8u dens, Bit16u numCols);
// Setup the bitGraph structure
// Process a character that is part of bit image. Must be called iff bitGraph.remBytes > 0. void setupBitImage(Bit8u dens, Bit16u numCols);
void printBitGraph(Bit8u ch);
// Process a character that is part of bit image. Must be called iff bitGraph.remBytes > 0.
// Copies the codepage mapping from the constant array to CurMap void printBitGraph(Bit8u ch);
void selectCodepage(Bit16u cp);
// Copies the codepage mapping from the constant array to CurMap
// Prints out a byte using ASCII85 encoding (only outputs something every four bytes). When b>255, closes the ASCII85 string void selectCodepage(Bit16u cp);
void fprintASCII85(FILE* f, Bit16u b);
// Prints out a byte using ASCII85 encoding (only outputs something every four bytes). When b>255, closes the ASCII85 string
// Returns value of the num-th pixel (couting left-right, top-down) in a safe way void fprintASCII85(FILE* f, Bit16u b);
Bit8u getPixel(Bit32u num);
Bit8u getxyPixel(Bit32u x,Bit32u y); // Returns value of the num-th pixel (couting left-right, top-down) in a safe way
Bit8u getPixel(Bit32u num);
FT_Library FTlib; // FreeType2 library used to render the characters Bit8u getxyPixel(Bit32u x,Bit32u y);
SDL_Surface* page; // Surface representing the current page FT_Library FTlib; // FreeType2 library used to render the characters
FT_Face curFont; // The font currently used to render characters
Bit8u color; SDL_Surface* page; // Surface representing the current page
Bit8u switcha; //Imagewriter softswitch A FT_Face curFont; // The font currently used to render characters
Bit8u switchb; //Imagewriter softswitch B Bit8u color;
Bit8u switcha; //Imagewriter softswitch A
Real64 curX, curY; // Position of the print head (in inch) Bit8u switchb; //Imagewriter softswitch B
Bit16u dpi; // dpi of the page Real64 curX, curY; // Position of the print head (in inch)
Bit16u ESCCmd; // ESC-command that is currently processed
bool ESCSeen; // True if last read character was an ESC (0x1B) Bit16u dpi; // dpi of the page
bool FSSeen; // True if last read character was an FS (0x1C) (IBM commands) Bit16u ESCCmd; // ESC-command that is currently processed
Bit8u numParam, neededParam; // Numbers of parameters already read/needed to process command bool ESCSeen; // True if last read character was an ESC (0x1B)
bool FSSeen; // True if last read character was an FS (0x1C) (IBM commands)
Bit8u params[20]; // Buffer for the read params Bit8u numParam, neededParam; // Numbers of parameters already read/needed to process command
Bit16u style; // Style of font (see STYLE_* constants)
Real64 cpi, actcpi; // CPI value set by program and the actual one (taking in account font types) Bit8u params[20]; // Buffer for the read params
Bit8u score; // Score for lines (see SCORE_* constants) Bit16u style; // Style of font (see STYLE_* constants)
Bit8u verticalDot; // Vertical dot shift for Imagewriter LQ modes Real64 cpi, actcpi; // CPI value set by program and the actual one (taking in account font types)
Bit8u score; // Score for lines (see SCORE_* constants)
Real64 topMargin, bottomMargin, rightMargin, leftMargin; // Margins of the page (in inch) Bit8u verticalDot; // Vertical dot shift for Imagewriter LQ modes
Real64 pageWidth, pageHeight; // Size of page (in inch)
Real64 defaultPageWidth, defaultPageHeight; // Default size of page (in inch) Real64 topMargin, bottomMargin, rightMargin, leftMargin; // Margins of the page (in inch)
Real64 lineSpacing; // Size of one line (in inch) Real64 pageWidth, pageHeight; // Size of page (in inch)
Real64 defaultPageWidth, defaultPageHeight; // Default size of page (in inch)
Real64 horiztabs[32]; // Stores the set horizontal tabs (in inch) Real64 lineSpacing; // Size of one line (in inch)
Bit8u numHorizTabs; // Number of configured tabs
Real64 horiztabs[32]; // Stores the set horizontal tabs (in inch)
Real64 verttabs[16]; // Stores the set vertical tabs (in inch) Bit8u numHorizTabs; // Number of configured tabs
Bit8u numVertTabs; // Number of configured tabs
Real64 verttabs[16]; // Stores the set vertical tabs (in inch)
Bit8u curCharTable; // Currently used char table und charset Bit8u numVertTabs; // Number of configured tabs
Bit8u printQuality; // Print quality (see QUALITY_* constants)
Bit8u printRes; // Graphics resolution Bit8u curCharTable; // Currently used char table und charset
IWTypeface LQtypeFace; // Typeface used in LQ printing mode Bit8u printQuality; // Print quality (see QUALITY_* constants)
Bit8u printRes; // Graphics resolution
Real64 extraIntraSpace; // Extra space between two characters (set by program, in inch) IWTypeface LQtypeFace; // Typeface used in LQ printing mode
bool charRead; // True if a character was read since the printer was last initialized Real64 extraIntraSpace; // Extra space between two characters (set by program, in inch)
bool autoFeed; // True if a LF should automatically added after a CR
bool printUpperContr; // True if the upper command characters should be printed bool charRead; // True if a character was read since the printer was last initialized
bool autoFeed; // True if a LF should automatically added after a CR
struct bitGraphicParams // Holds information about printing bit images bool printUpperContr; // True if the upper command characters should be printed
{
Bit16u horizDens, vertDens; // Density of image to print (in dpi) struct bitGraphicParams // Holds information about printing bit images
bool adjacent; // Print adjacent pixels? (ignored) {
Bit8u bytesColumn; // Bytes per column Bit16u horizDens, vertDens; // Density of image to print (in dpi)
Bit16u remBytes; // Bytes left to read before image is done bool adjacent; // Print adjacent pixels? (ignored)
Bit8u column[6]; // Bytes of the current and last column Bit8u bytesColumn; // Bytes per column
Bit8u readBytesColumn; // Bytes read so far for the current column Bit16u remBytes; // Bytes left to read before image is done
} bitGraph; Bit8u column[6]; // Bytes of the current and last column
Bit8u readBytesColumn; // Bytes read so far for the current column
Bit8u densk, densl, densy, densz; // Image density modes used in ESC K/L/Y/Z commands } bitGraph;
Bit16u curMap[256]; // Currently used ASCII => Unicode mapping Bit8u densk, densl, densy, densz; // Image density modes used in ESC K/L/Y/Z commands
Bit16u charTables[4]; // Charactertables
Bit16u curMap[256]; // Currently used ASCII => Unicode mapping
Real64 definedUnit; // Unit used by some ESC/P2 commands (negative => use default) Bit16u charTables[4]; // Charactertables
bool multipoint; // If multipoint mode is enabled Real64 definedUnit; // Unit used by some ESC/P2 commands (negative => use default)
Real64 multiPointSize; // Point size of font in multipoint mode
Real64 multicpi; // CPI used in multipoint mode bool multipoint; // If multipoint mode is enabled
Real64 multiPointSize; // Point size of font in multipoint mode
Real64 hmi; // Horizontal motion index (in inch; overrides CPI settings) Real64 multicpi; // CPI used in multipoint mode
Bit16u numPrintAsChar; // Number of bytes to print as characters (even when normally control codes) Real64 hmi; // Horizontal motion index (in inch; overrides CPI settings)
#if defined (WIN32) Bit16u numPrintAsChar; // Number of bytes to print as characters (even when normally control codes)
HDC printerDC; // Win32 printer device
#endif #if defined (WIN32)
int port; // SCC Port HDC printerDC; // Win32 printer device
#endif
#endif // HAVE_SDL int port; // SCC Port
Bit8u msb; // MSB mode
#endif // HAVE_SDL
char* output; // Output method selected by user Bit8u msb; // MSB mode
void* outputHandle; // If not null, additional pages will be appended to the given handle
bool multipageOutput; // If true, all pages are combined to one file/print job etc. until the "eject page" button is pressed char* output; // Output method selected by user
Bit16u multiPageCounter; // Current page (when printing multipages) void* outputHandle; // If not null, additional pages will be appended to the given handle
bool multipageOutput; // If true, all pages are combined to one file/print job etc. until the "eject page" button is pressed
Bit8u ASCII85Buffer[4]; // Buffer used in ASCII85 encoding Bit16u multiPageCounter; // Current page (when printing multipages)
Bit8u ASCII85BufferPos; // Position in ASCII85 encode buffer
Bit8u ASCII85CurCol; // Columns printed so far in the current lines Bit8u ASCII85Buffer[4]; // Buffer used in ASCII85 encoding
}; Bit8u ASCII85BufferPos; // Position in ASCII85 encode buffer
Bit8u ASCII85CurCol; // Columns printed so far in the current lines
#endif };
//Interfaces to C code #endif
#ifdef __cplusplus
extern "C" //Interfaces to C code
{ #ifdef __cplusplus
extern "C"
{
#else #else
#include <stdbool.h> #include <stdbool.h>
typedef unsigned char Bit8u; typedef unsigned char Bit8u;
#endif #endif
void imagewriter_init(int pdpi, int ppaper, int banner, char* poutput, bool mpage); void imagewriter_init(int pdpi, int ppaper, int banner, char* poutput, bool mpage);
void imagewriter_loop(Bit8u pchar); void imagewriter_loop(Bit8u pchar);
void imagewriter_close(); void imagewriter_close();
void imagewriter_feed(); void imagewriter_feed();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

118
src/iwm.c
View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -22,7 +24,7 @@
#include "defc.h" #include "defc.h"
extern int Verbose; extern int Verbose;
extern word32 g_vbl_count; // OG change int to word32 extern word32 g_vbl_count; // OG change int to word32
extern int g_c036_val_speed; extern int g_c036_val_speed;
const byte phys_to_dos_sec[] = { const byte phys_to_dos_sec[] = {
@ -175,24 +177,24 @@ iwm_init()
iwm_reset(); iwm_reset();
} }
// OG Added shut function to IWM // OG Added shut function to IWM
// Free the memory, and more important free the open handle onto the disk // Free the memory, and more important free the open handle onto the disk
void void
iwm_shut() iwm_shut()
{ {
int i; int i;
for(i = 0; i < 2; i++) { for(i = 0; i < 2; i++) {
eject_disk(&iwm.drive525[i]); eject_disk(&iwm.drive525[i]);
eject_disk(&iwm.drive35[i]); eject_disk(&iwm.drive35[i]);
} }
for(i = 0; i < MAX_C7_DISKS; i++) { for(i = 0; i < MAX_C7_DISKS; i++) {
eject_disk(&iwm.smartport[i]); eject_disk(&iwm.smartport[i]);
} }
from_disk_byte_valid = 0; from_disk_byte_valid = 0;
} }
void void
iwm_reset() iwm_reset()
{ {
@ -235,19 +237,19 @@ draw_iwm_status(int line, char *buf)
flag[apple35_sel][iwm.drive_select] = "*"; flag[apple35_sel][iwm.drive_select] = "*";
} }
#ifdef ACTIVEGS // OG Pass monitoring info #ifdef ACTIVEGS // OG Pass monitoring info
{ {
extern void ki_loading(int _motorOn,int _slot,int _drive, int _curtrack); extern void ki_loading(int _motorOn,int _slot,int _drive, int _curtrack);
int curtrack=0; int curtrack=0;
if (apple35_sel) if (apple35_sel)
curtrack = iwm.drive35[iwm.drive_select].cur_qtr_track ; curtrack = iwm.drive35[iwm.drive_select].cur_qtr_track ;
else else
curtrack = iwm.drive525[iwm.drive_select].cur_qtr_track >> 2 ; curtrack = iwm.drive525[iwm.drive_select].cur_qtr_track >> 2 ;
ki_loading(g_iwm_motor_on,apple35_sel?5:6,iwm.drive_select+1,curtrack); ki_loading(g_iwm_motor_on,apple35_sel?5:6,iwm.drive_select+1,curtrack);
} }
#endif #endif
sprintf(buf, "s6d1:%2d%s s6d2:%2d%s s5d1:%2d/%d%s " sprintf(buf, "s6d1:%2d%s s6d2:%2d%s s5d1:%2d/%d%s "
"s5d2:%2d/%d%s fast_disk_emul:%d,%d c036:%02x", "s5d2:%2d/%d%s fast_disk_emul:%d,%d c036:%02x",
iwm.drive525[0].cur_qtr_track >> 2, flag[0][0], iwm.drive525[0].cur_qtr_track >> 2, flag[0][0],
@ -347,7 +349,7 @@ iwm_vbl_update(int doit_3_persec)
int i; int i;
if(iwm.motor_on && iwm.motor_off) { if(iwm.motor_on && iwm.motor_off) {
if((word32)iwm.motor_off_vbl_count <= g_vbl_count) { if((word32)iwm.motor_off_vbl_count <= g_vbl_count) {
printf("Disk timer expired, drive off: %08x\n", printf("Disk timer expired, drive off: %08x\n",
g_vbl_count); g_vbl_count);
iwm.motor_on = 0; iwm.motor_on = 0;
@ -581,9 +583,9 @@ iwm525_phase_change(int drive, int phase)
int half_track = qtr_track >> 1; int half_track = qtr_track >> 1;
delta = 0; delta = 0;
if (iwm.iwm_phase[(half_track + 1) & 3]) if (iwm.iwm_phase[(half_track + 1) & 3])
delta += 2; delta += 2;
if (iwm.iwm_phase[(half_track + 3) & 3]) if (iwm.iwm_phase[(half_track + 3) & 3])
delta -= 2; delta -= 2;
qtr_track += delta; qtr_track += delta;
@ -754,12 +756,12 @@ iwm_do_action35(double dcycs)
break; break;
case 0x0d: /* eject disk */ case 0x0d: /* eject disk */
eject_disk(dsk); eject_disk(dsk);
#ifdef ACTIVEGS // OG : pass eject info to the Control (ActiveX specific) #ifdef ACTIVEGS // OG : pass eject info to the Control (ActiveX specific)
{ {
extern void ejectDisk(int slot,int disk); extern void ejectDisk(int slot,int disk);
ejectDisk(dsk->disk_525?6:5,dsk->drive+1); ejectDisk(dsk->disk_525?6:5,dsk->drive+1);
} }
#endif #endif
break; break;
case 0x02: case 0x02:
case 0x07: case 0x07:
@ -1669,24 +1671,24 @@ disk_track_to_unix(Disk *dsk, int qtr_track, byte *outbuf)
return -1; return -1;
} }
if(disk_525) if(disk_525)
{ {
// OG // OG
// Add support for .nib file // Add support for .nib file
if (dsk->image_type!=DSK_TYPE_NIB) if (dsk->image_type!=DSK_TYPE_NIB)
return iwm_denib_track525(dsk, trk, qtr_track, outbuf); return iwm_denib_track525(dsk, trk, qtr_track, outbuf);
else else
{ {
int len = trk->track_len; int len = trk->track_len;
byte* trk_ptr = trk->nib_area+1; byte* trk_ptr = trk->nib_area+1;
byte* nib_ptr = outbuf; byte* nib_ptr = outbuf;
for(i = 0; i < len; i += 2) for(i = 0; i < len; i += 2)
{ {
*nib_ptr++ = *trk_ptr; *nib_ptr++ = *trk_ptr;
trk_ptr+=2; trk_ptr+=2;
} }
return 1; return 1;
} }
} else { } else {
return iwm_denib_track35(dsk, trk, qtr_track, outbuf); return iwm_denib_track35(dsk, trk, qtr_track, outbuf);
} }

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSport - an Apple //gs Emulator GSport - an Apple //gs Emulator
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2013 by GSport contributors Copyright (C) 2010 - 2013 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2014 by GSport contributors Copyright (C) 2010 - 2014 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2010 - 2014 by GSport contributors Copyright (C) 2010 - 2014 by GSport contributors
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,58 +1,58 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by gsport32.rc // Used by gsport32.rc
// //
#define IDD_ABOUT_DIALOG 101 #define IDD_ABOUT_DIALOG 101
#define IDC_GSPORT32 102 #define IDC_GSPORT32 102
#define IDR_TOOLBAR 103 #define IDR_TOOLBAR 103
#define IDD_DLG_DISKCONF 104 #define IDD_DLG_DISKCONF 104
#define IDR_ACCEL 105 #define IDR_ACCEL 105
#define IDD_GSPORT32_KEY 106 #define IDD_GSPORT32_KEY 106
#define IDD_SPEEDDIALOG 117 #define IDD_SPEEDDIALOG 117
#define IDC_SLOW 1007 #define IDC_SLOW 1007
#define IDC_CUSTOM 1008 #define IDC_CUSTOM 1008
#define IDC_EDITCUSTOM 1009 #define IDC_EDITCUSTOM 1009
#define IDC_NORMAL 1010 #define IDC_NORMAL 1010
#define IDC_FASTEST 1011 #define IDC_FASTEST 1011
#define ID_TOOLBAR 5000 #define ID_TOOLBAR 5000
#define ID_STATUSBAR 5001 #define ID_STATUSBAR 5001
#define IDC_EDIT_S5D1 10051 #define IDC_EDIT_S5D1 10051
#define IDC_EDIT_S5D2 10052 #define IDC_EDIT_S5D2 10052
#define IDC_EDIT_S6D1 10061 #define IDC_EDIT_S6D1 10061
#define IDC_EDIT_S6D2 10062 #define IDC_EDIT_S6D2 10062
#define IDC_EDIT_S7D1 10071 #define IDC_EDIT_S7D1 10071
#define IDC_EDIT_S7D2 10072 #define IDC_EDIT_S7D2 10072
#define IDC_BTN_S5D1 11051 #define IDC_BTN_S5D1 11051
#define IDC_BTN_S5D2 11052 #define IDC_BTN_S5D2 11052
#define IDC_BTN_S6D1 11061 #define IDC_BTN_S6D1 11061
#define IDC_BTN_S6D2 11062 #define IDC_BTN_S6D2 11062
#define IDC_BTN_S7D1 11071 #define IDC_BTN_S7D1 11071
#define IDC_BTN_S7D2 11072 #define IDC_BTN_S7D2 11072
#define ID_HELP_ABOUT 40001 #define ID_HELP_ABOUT 40001
#define ID_FILE_EXIT 40002 #define ID_FILE_EXIT 40002
#define ID_FILE_DISK 40003 #define ID_FILE_DISK 40003
#define ID_FILE_SENDRESET 40004 #define ID_FILE_SENDRESET 40004
#define ID_FILE_JOYSTICK 40005 #define ID_FILE_JOYSTICK 40005
#define ID_FILE_DEBUGSTAT 40006 #define ID_FILE_DEBUGSTAT 40006
#define ID_FILE_SENDREBOOT 40007 #define ID_FILE_SENDREBOOT 40007
#define ID_FILE_FULLSCREEN 40012 #define ID_FILE_FULLSCREEN 40012
#define ID_FILE_SPEED 40013 #define ID_FILE_SPEED 40013
#define ID_HELP_KEY 40014 #define ID_HELP_KEY 40014
#define ID_FILE_SEND_REBOOT 40014 #define ID_FILE_SEND_REBOOT 40014
#define ID_Menu 40015 #define ID_Menu 40015
#define ID_EMULATOR_FLUSHPRINTER 40016 #define ID_EMULATOR_FLUSHPRINTER 40016
#define ID_FILE_FLUSHPRINTER 40017 #define ID_FILE_FLUSHPRINTER 40017
#define ID_SPEED_1MHZ 50001 #define ID_SPEED_1MHZ 50001
#define ID_SPEED_2MHZ 50002 #define ID_SPEED_2MHZ 50002
#define ID_SPEED_FMHZ 50003 #define ID_SPEED_FMHZ 50003
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 116 #define _APS_NEXT_RESOURCE_VALUE 116
#define _APS_NEXT_COMMAND_VALUE 40018 #define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1003 #define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -1,57 +1,57 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by gsport32.rc // Used by gsport32.rc
// //
#define IDD_ABOUT_DIALOG 101 #define IDD_ABOUT_DIALOG 101
#define IDC_GSPORT32 102 #define IDC_GSPORT32 102
#define IDR_TOOLBAR 103 #define IDR_TOOLBAR 103
#define IDD_DLG_DISKCONF 104 #define IDD_DLG_DISKCONF 104
#define IDR_ACCEL 105 #define IDR_ACCEL 105
#define IDD_GSPORT32_KEY 106 #define IDD_GSPORT32_KEY 106
#define ID_TOOLBAR 5000 #define ID_TOOLBAR 5000
#define ID_STATUSBAR 5001 #define ID_STATUSBAR 5001
#define IDC_EDIT_S5D1 10051 #define IDC_EDIT_S5D1 10051
#define IDC_EDIT_S5D2 10052 #define IDC_EDIT_S5D2 10052
#define IDC_EDIT_S6D1 10061 #define IDC_EDIT_S6D1 10061
#define IDC_EDIT_S6D2 10062 #define IDC_EDIT_S6D2 10062
#define IDC_EDIT_S7D1 10071 #define IDC_EDIT_S7D1 10071
#define IDC_EDIT_S7D2 10072 #define IDC_EDIT_S7D2 10072
#define IDC_BTN_S5D1 11051 #define IDC_BTN_S5D1 11051
#define IDC_BTN_S5D2 11052 #define IDC_BTN_S5D2 11052
#define IDC_BTN_S6D1 11061 #define IDC_BTN_S6D1 11061
#define IDC_BTN_S6D2 11062 #define IDC_BTN_S6D2 11062
#define IDC_BTN_S7D1 11071 #define IDC_BTN_S7D1 11071
#define IDC_BTN_S7D2 11072 #define IDC_BTN_S7D2 11072
#define ID_HELP_ABOUT 40001 #define ID_HELP_ABOUT 40001
#define ID_FILE_EXIT 40002 #define ID_FILE_EXIT 40002
#define ID_FILE_DISK 40003 #define ID_FILE_DISK 40003
#define ID_FILE_SENDRESET 40004 #define ID_FILE_SENDRESET 40004
#define ID_FILE_JOYSTICK 40005 #define ID_FILE_JOYSTICK 40005
#define ID_FILE_DEBUGSTAT 40006 #define ID_FILE_DEBUGSTAT 40006
#define ID_FILE_SENDREBOOT 40007 #define ID_FILE_SENDREBOOT 40007
#define ID_FILE_FULLSCREEN 40012 #define ID_FILE_FULLSCREEN 40012
#define ID_FILE_SPEED 40013 #define ID_FILE_SPEED 40013
#define ID_HELP_KEY 40014 #define ID_HELP_KEY 40014
#define ID_SPEED_1MHZ 50001 #define ID_SPEED_1MHZ 50001
#define ID_SPEED_2MHZ 50002 #define ID_SPEED_2MHZ 50002
#define ID_SPEED_FMHZ 50003 #define ID_SPEED_FMHZ 50003
#define IDD_SPEEDDIALOG 117 #define IDD_SPEEDDIALOG 117
#define IDC_SLOW 1007 #define IDC_SLOW 1007
#define IDC_CUSTOM 1008 #define IDC_CUSTOM 1008
#define IDC_EDITCUSTOM 1009 #define IDC_EDITCUSTOM 1009
#define IDC_NORMAL 1010 #define IDC_NORMAL 1010
#define IDC_FASTEST 1011 #define IDC_FASTEST 1011
#define IDC_STATIC -1 #define IDC_STATIC -1
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 111 #define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40013 #define _APS_NEXT_COMMAND_VALUE 40013
#define _APS_NEXT_CONTROL_VALUE 1003 #define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

108
src/scc.c
View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2014 by GSport contributors Copyright (C) 2010 - 2014 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -54,7 +56,7 @@ extern int g_appletalk_turbo;
Scc scc_stat[2]; Scc scc_stat[2];
int g_baud_table[] = { int g_baud_table[] = {
110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
}; };
static char* wr_names[] = { static char* wr_names[] = {
@ -114,7 +116,7 @@ scc_init()
scc_ptr->rx_event_pending = 0; scc_ptr->rx_event_pending = 0;
scc_ptr->tx_event_pending = 0; scc_ptr->tx_event_pending = 0;
scc_ptr->char_size = 8; scc_ptr->char_size = 8;
scc_ptr->baud_rate = 115200; scc_ptr->baud_rate = 115200;
scc_ptr->telnet_mode = 0; scc_ptr->telnet_mode = 0;
scc_ptr->telnet_iac = 0; scc_ptr->telnet_iac = 0;
scc_ptr->out_char_dcycs = 0.0; scc_ptr->out_char_dcycs = 0.0;
@ -367,37 +369,37 @@ scc_regen_clocks(int port)
scc_ptr->tx_dcycs = tx_dcycs * tx_char_size; scc_ptr->tx_dcycs = tx_dcycs * tx_char_size;
scc_ptr->rx_dcycs = rx_dcycs * rx_char_size; scc_ptr->rx_dcycs = rx_dcycs * rx_char_size;
switch (scc_ptr->state) { switch (scc_ptr->state) {
case 1: /* socket */ case 1: /* socket */
scc_socket_change_params(port); scc_socket_change_params(port);
break; break;
case 2: /* real serial ports */ case 2: /* real serial ports */
#ifdef MAC #ifdef MAC
scc_serial_mac_change_params(port); scc_serial_mac_change_params(port);
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
scc_serial_win_change_params(port); scc_serial_win_change_params(port);
#endif #endif
break; break;
case 3: /* localtalk */ case 3: /* localtalk */
if (g_appletalk_turbo) if (g_appletalk_turbo)
{ {
// If the user has selected AppleTalk "turbo" mode, increase the baud // If the user has selected AppleTalk "turbo" mode, increase the baud
// rate to be as fast as possible, limited primarily by the ability of // rate to be as fast as possible, limited primarily by the ability of
// the emulated GS to handle data. // the emulated GS to handle data.
scc_ptr->baud_rate = 0; scc_ptr->baud_rate = 0;
scc_ptr->br_dcycs = 1; scc_ptr->br_dcycs = 1;
scc_ptr->tx_dcycs = 1; scc_ptr->tx_dcycs = 1;
scc_ptr->rx_dcycs = 1; scc_ptr->rx_dcycs = 1;
} }
break; break;
case 4: /* Imagewriter */ case 4: /* Imagewriter */
scc_ptr->baud_rate = 0; scc_ptr->baud_rate = 0;
scc_ptr->tx_dcycs = tx_dcycs * 1.2; //Somehow this speeds up serial transfer without overrunning the buffer scc_ptr->tx_dcycs = tx_dcycs * 1.2; //Somehow this speeds up serial transfer without overrunning the buffer
scc_ptr->rx_dcycs = rx_dcycs * 1.2; scc_ptr->rx_dcycs = rx_dcycs * 1.2;
break; break;
} }
} }
void void
@ -416,9 +418,9 @@ scc_port_init(int port)
state = scc_serial_win_init(port); state = scc_serial_win_init(port);
#endif #endif
break; break;
case 2: case 2:
state = scc_imagewriter_init(port); state = scc_imagewriter_init(port);
break; break;
default: default:
break; break;
} }
@ -455,15 +457,15 @@ scc_try_to_empty_writebuf(int port, double dcycs)
case 1: case 1:
scc_socket_empty_writebuf(port, dcycs); scc_socket_empty_writebuf(port, dcycs);
break; break;
case 3: case 3:
// When we're doing LocalTalk, the write buffer gets emptied at the end of the frame and does not use this function. // When we're doing LocalTalk, the write buffer gets emptied at the end of the frame and does not use this function.
break; break;
case 4: case 4:
scc_imagewriter_empty_writebuf(port, dcycs); scc_imagewriter_empty_writebuf(port, dcycs);
break; break;
} }
} }
@ -509,21 +511,21 @@ scc_try_fill_readbuf(int port, double dcycs)
case 1: case 1:
scc_socket_fill_readbuf(port, space_left, dcycs); scc_socket_fill_readbuf(port, space_left, dcycs);
break; break;
case 3: case 3:
// LLAP deals with packets, and we only allow one packet in the read buffer at a time. // LLAP deals with packets, and we only allow one packet in the read buffer at a time.
// If the buffer is empty, try to fill it with another packet. // If the buffer is empty, try to fill it with another packet.
if (g_appletalk_bridging && (space_used_before_rx == 0) && (scc_ptr->rx_queue_depth == 0) && !(scc_ptr->sdlc_eof)) if (g_appletalk_bridging && (space_used_before_rx == 0) && (scc_ptr->rx_queue_depth == 0) && !(scc_ptr->sdlc_eof))
{ {
scc_llap_fill_readbuf(port, space_left, dcycs); scc_llap_fill_readbuf(port, space_left, dcycs);
//scc_maybe_rx_event(port, dcycs); //scc_maybe_rx_event(port, dcycs);
scc_ptr->sdlc_eof = 0; scc_ptr->sdlc_eof = 0;
break; break;
case 4: case 4:
scc_imagewriter_fill_readbuf(port, space_left, dcycs); scc_imagewriter_fill_readbuf(port, space_left, dcycs);
break; break;
} }
break; break;
} }

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,159 +1,161 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2013 - 2014 by GSport contributors Copyright (C) 2016 - Dagen Brock
Originally authored by Christopher Mason
Copyright (C) 2013 - 2014 by GSport contributors
This program is free software; you can redistribute it and/or modify it Originally authored by Christopher Mason
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* This is an interface between the SCC emulation and the Virtual Imagewriter. */ */
#include "defc.h" /* This is an interface between the SCC emulation and the Virtual Imagewriter. */
#include "scc.h"
#include "imagewriter.h" #include "defc.h"
extern Scc scc_stat[2]; #include "scc.h"
extern word32 g_vbl_count; #include "imagewriter.h"
extern Scc scc_stat[2];
extern int g_imagewriter; extern word32 g_vbl_count;
extern int g_imagewriter_dpi;
extern char* g_imagewriter_output; extern int g_imagewriter;
extern int g_imagewriter_multipage; extern int g_imagewriter_dpi;
extern int g_imagewriter_timeout; extern char* g_imagewriter_output;
extern int g_imagewriter_paper; extern int g_imagewriter_multipage;
extern int g_imagewriter_banner; extern int g_imagewriter_timeout;
extern int g_imagewriter_paper;
word32 imagewriter_vbl_count = 0; extern int g_imagewriter_banner;
int imagewriter_port_block = 0;
int iw_scc_write = 0; word32 imagewriter_vbl_count = 0;
int imagewriter_port_block = 0;
int scc_imagewriter_init(int port) int iw_scc_write = 0;
{
Scc *scc_ptr; int scc_imagewriter_init(int port)
scc_ptr = &(scc_stat[port]); {
imagewriter_init(g_imagewriter_dpi,g_imagewriter_paper,g_imagewriter_banner,g_imagewriter_output,g_imagewriter_multipage); Scc *scc_ptr;
scc_ptr->state = 4; scc_ptr = &(scc_stat[port]);
return 4; imagewriter_init(g_imagewriter_dpi,g_imagewriter_paper,g_imagewriter_banner,g_imagewriter_output,g_imagewriter_multipage);
} scc_ptr->state = 4;
return 4;
/** Transfer data from Imagewriter to the SCC **/ }
void scc_imagewriter_fill_readbuf(int port, int space_left, double dcycs)
{ /** Transfer data from Imagewriter to the SCC **/
if (iw_scc_write) void scc_imagewriter_fill_readbuf(int port, int space_left, double dcycs)
{ {
size_t bytes_read; if (iw_scc_write)
size_t i; {
byte data[9]; size_t bytes_read;
if (g_imagewriter == 1) size_t i;
{ byte data[9];
//Imagewriter LQ self ID string. Tell machine we have a color ribbon and sheet feeder installed. if (g_imagewriter == 1)
data[0] = 0; //Start bit {
data[1] ='L'; //Printer type is Imagewriter LQ //Imagewriter LQ self ID string. Tell machine we have a color ribbon and sheet feeder installed.
data[2] ='Q'; //(cont) data[0] = 0; //Start bit
data[3] ='1'; //15 inch carriage width data[1] ='L'; //Printer type is Imagewriter LQ
data[4] ='C'; //Color ribbon installed data[2] ='Q'; //(cont)
data[5] ='F'; //Sheet feeder installed, no envelope attachment data[3] ='1'; //15 inch carriage width
data[6] ='1'; //Number of sheet feeder bins data[4] ='C'; //Color ribbon installed
data[7] = 0x0D; //CR terminates string data[5] ='F'; //Sheet feeder installed, no envelope attachment
data[8] = 0; //Stop bit data[6] ='1'; //Number of sheet feeder bins
bytes_read = 9; data[7] = 0x0D; //CR terminates string
} data[8] = 0; //Stop bit
else bytes_read = 9;
{ }
//Imagewriter II self ID string. Tell machine we have a color ribbon and sheet feeder installed. else
data[0] = 0; //Start bit {
data[1] ='I'; //Printer type is Imagewriter II //Imagewriter II self ID string. Tell machine we have a color ribbon and sheet feeder installed.
data[2] ='W'; //(cont) data[0] = 0; //Start bit
data[3] ='1'; //10 inch carriage width data[1] ='I'; //Printer type is Imagewriter II
data[4] ='0'; //(cont) data[2] ='W'; //(cont)
data[5] ='C'; //Color ribbon installed data[3] ='1'; //10 inch carriage width
data[6] ='F'; //Sheet feeder installed data[4] ='0'; //(cont)
data[7] = 0; //Stop bit data[5] ='C'; //Color ribbon installed
bytes_read = 8; data[6] ='F'; //Sheet feeder installed
} data[7] = 0; //Stop bit
for(i = 0; i < bytes_read; i++) { bytes_read = 8;
scc_add_to_readbuf(port, data[i], dcycs); }
} for(i = 0; i < bytes_read; i++) {
iw_scc_write = 0; scc_add_to_readbuf(port, data[i], dcycs);
} }
} iw_scc_write = 0;
}
/** Transfer data from the SCC to the Imagewriter. **/ }
void scc_imagewriter_empty_writebuf(int port, double dcycs)
{ /** Transfer data from the SCC to the Imagewriter. **/
Scc* scc_ptr; void scc_imagewriter_empty_writebuf(int port, double dcycs)
{
int rdptr; Scc* scc_ptr;
int wrptr;
int len; int rdptr;
int done; int wrptr;
//int ret; int len;
unsigned long bytes_written; int done;
//int ret;
scc_ptr = &(scc_stat[port]); unsigned long bytes_written;
done = 0;
while(!done) { scc_ptr = &(scc_stat[port]);
rdptr = scc_ptr->out_rdptr; done = 0;
wrptr = scc_ptr->out_wrptr; while(!done) {
if(rdptr == wrptr) { rdptr = scc_ptr->out_rdptr;
//printf("...rdptr == wrptr\n"); wrptr = scc_ptr->out_wrptr;
done = 1; if(rdptr == wrptr) {
break; //printf("...rdptr == wrptr\n");
} done = 1;
len = wrptr - rdptr; break;
if(len < 0) { }
len = SCC_OUTBUF_SIZE - rdptr; len = wrptr - rdptr;
} if(len < 0) {
if(len > 32) { len = SCC_OUTBUF_SIZE - rdptr;
len = 32; }
} if(len > 32) {
if(len <= 0) { len = 32;
done = 1; }
break; if(len <= 0) {
} done = 1;
bytes_written = 1; break;
imagewriter_port_block = 1; }
imagewriter_loop(scc_ptr->out_buf[rdptr]); bytes_written = 1;
imagewriter_vbl_count = g_vbl_count+(g_imagewriter_timeout*60); imagewriter_port_block = 1;
imagewriter_port_block = 0; imagewriter_loop(scc_ptr->out_buf[rdptr]);
//printf("Write Imagewriter ret: %d, bytes_written:%d, len:%d\n", ret, imagewriter_vbl_count = g_vbl_count+(g_imagewriter_timeout*60);
//(int)bytes_written, len); imagewriter_port_block = 0;
//printf("Write Imagewriter ret: %d, bytes_written:%d, len:%d\n", ret,
if (bytes_written == 0) { //(int)bytes_written, len);
done = 1;
break; if (bytes_written == 0) {
} else { done = 1;
rdptr = rdptr + bytes_written; break;
if(rdptr >= SCC_OUTBUF_SIZE) { } else {
rdptr = rdptr - SCC_OUTBUF_SIZE; rdptr = rdptr + bytes_written;
} if(rdptr >= SCC_OUTBUF_SIZE) {
scc_ptr->out_rdptr = rdptr; rdptr = rdptr - SCC_OUTBUF_SIZE;
} }
} scc_ptr->out_rdptr = rdptr;
} }
}
//This function handles the automatic timeout of the virtual printer if an }
//application doesn't send a form feed at the end of the page. It also
//allows multipage mode Postscript and native printer documents to //This function handles the automatic timeout of the virtual printer if an
//print somewhat how a regular application would. //application doesn't send a form feed at the end of the page. It also
void imagewriter_update() //allows multipage mode Postscript and native printer documents to
{ //print somewhat how a regular application would.
if (imagewriter_port_block != 1 && imagewriter_vbl_count != 0 && g_vbl_count >= imagewriter_vbl_count) void imagewriter_update()
{ {
printf("Calling imagewriter_update and flushing!\n"); if (imagewriter_port_block != 1 && imagewriter_vbl_count != 0 && g_vbl_count >= imagewriter_vbl_count)
imagewriter_feed(); {
imagewriter_vbl_count = 0; printf("Calling imagewriter_update and flushing!\n");
} imagewriter_feed();
return; imagewriter_vbl_count = 0;
} }
return;
}

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2013 - 2014 by GSport contributors Copyright (C) 2013 - 2014 by GSport contributors
Originally authored by Peter Neubauer Originally authored by Peter Neubauer
@ -162,4 +164,4 @@ void scc_llap_fill_readbuf(int port, int space_left, double dcycs)
void scc_llap_empty_writebuf(int port, double dcycs) void scc_llap_empty_writebuf(int port, double dcycs)
{ {
} }
#endif #endif

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2013 by GSport contributors Copyright (C) 2013 by GSport contributors
Originally authored by Peter Neubauer Originally authored by Peter Neubauer
@ -23,4 +25,4 @@ void scc_llap_shutdown();
void scc_llap_update(); void scc_llap_update();
void scc_llap_fill_readbuf(int port, int space_left, double dcycs); void scc_llap_fill_readbuf(int port, int space_left, double dcycs);
void scc_llap_empty_writebuf(int port, double dcycs); void scc_llap_empty_writebuf(int port, double dcycs);
void scc_llap_set_node(byte val); void scc_llap_set_node(byte val);

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -27,10 +29,10 @@
#include <stdlib.h> #include <stdlib.h>
#ifndef UNDER_CE //OG #ifndef UNDER_CE //OG
#include <signal.h> #include <signal.h>
#endif #endif
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <Windows.h> #include <Windows.h>
#endif #endif
extern Scc scc_stat[2]; extern Scc scc_stat[2];
extern int g_serial_modem[]; extern int g_serial_modem[];

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@ -25,7 +27,7 @@
#include "scc.h" #include "scc.h"
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <Windows.h> #include <Windows.h>
#include <NspAPI.h> #include <NspAPI.h>
#endif #endif

View File

@ -1,6 +1,8 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -34,7 +36,7 @@ void check_wave_error(int res, char *str);
#define NUM_WAVE_HEADERS 8 #define NUM_WAVE_HEADERS 8
//HWAVEOUT g_wave_handle = NULL; // OG Default value must be set //HWAVEOUT g_wave_handle = NULL; // OG Default value must be set
//WAVEHDR g_wavehdr[NUM_WAVE_HEADERS]; //WAVEHDR g_wavehdr[NUM_WAVE_HEADERS];
extern int g_audio_enable; extern int g_audio_enable;
@ -93,123 +95,123 @@ win32snd_init(word32 *shmaddr)
return; return;
} }
void sdl_send_audio(word32 *ptr, int size, int real_samps) { void sdl_send_audio(word32 *ptr, int size, int real_samps) {
/* code */ /* code */
//printf(" sdl_s_a %d\t 0x%08x ",size, &ptr); //printf(" sdl_s_a %d\t 0x%08x ",size, &ptr);
int i; int i;
for (i=0; i<size; i++) { for (i=0; i<size; i++) {
if (real_samps) { if (real_samps) {
bptr[g_sdlsnd_write_idx++] = ptr[i]; bptr[g_sdlsnd_write_idx++] = ptr[i];
} else { } else {
bptr[g_sdlsnd_write_idx++] = 0; bptr[g_sdlsnd_write_idx++] = 0;
} }
if (g_sdlsnd_write_idx>g_sdlsnd_buflen) { if (g_sdlsnd_write_idx>g_sdlsnd_buflen) {
g_sdlsnd_write_idx=0; g_sdlsnd_write_idx=0;
} }
} }
g_playbuf_buffered += size; g_playbuf_buffered += size;
} }
void handle_sdl_snd(void *userdata, Uint8 *stream, int len) { void handle_sdl_snd(void *userdata, Uint8 *stream, int len) {
/* Only play if we have data left */ /* Only play if we have data left */
/* if ( g_playbuf_buffered == 0) { /* if ( g_playbuf_buffered == 0) {
return; return;
} }
*/ */
for(int i = 0; i < len; ++i) { for(int i = 0; i < len; ++i) {
if(g_playbuf_buffered <= 0) { if(g_playbuf_buffered <= 0) {
stream[i] = 0; stream[i] = 0;
} else { } else {
stream[i] = bptr[g_sdlsnd_read_idx++]; stream[i] = bptr[g_sdlsnd_read_idx++];
if(g_sdlsnd_read_idx == g_sdlsnd_buflen) if(g_sdlsnd_read_idx == g_sdlsnd_buflen)
g_sdlsnd_read_idx = 0; g_sdlsnd_read_idx = 0;
g_playbuf_buffered--; g_playbuf_buffered--;
} }
} }
return; return;
/* Mix as much data as possible */ /* Mix as much data as possible */
len = ( len > g_playbuf_buffered ? g_playbuf_buffered : len ); len = ( len > g_playbuf_buffered ? g_playbuf_buffered : len );
//len = ( g_sdlsnd_read_idx+len < g_sdlsnd_buflen ? len : g_sdlsnd_read_idx+len); //len = ( g_sdlsnd_read_idx+len < g_sdlsnd_buflen ? len : g_sdlsnd_read_idx+len);
SDL_memset(stream, 0, len); SDL_memset(stream, 0, len);
if (g_sdlsnd_read_idx+len < g_sdlsnd_buflen) { if (g_sdlsnd_read_idx+len < g_sdlsnd_buflen) {
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], len); SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], len);
g_sdlsnd_read_idx += len; g_sdlsnd_read_idx += len;
g_playbuf_buffered -= len; g_playbuf_buffered -= len;
} else { } else {
/* /*
int top_len = 0; int top_len = 0;
top_len = g_sdlsnd_buflen - g_sdlsnd_read_idx; top_len = g_sdlsnd_buflen - g_sdlsnd_read_idx;
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], top_len); SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], top_len);
g_sdlsnd_read_idx = 0; g_sdlsnd_read_idx = 0;
g_playbuf_buffered -= top_len; g_playbuf_buffered -= top_len;
// SDL_memcpy (stream+top_len, bptr[g_sdlsnd_read_idx], len-top_len); // SDL_memcpy (stream+top_len, bptr[g_sdlsnd_read_idx], len-top_len);
g_sdlsnd_read_idx += len-top_len; g_sdlsnd_read_idx += len-top_len;
g_playbuf_buffered -= len-top_len; g_playbuf_buffered -= len-top_len;
*/ */
} }
//SDL_MixAudio(stream, pointer, len, SDL_MIX_MAXVOLUME); //SDL_MixAudio(stream, pointer, len, SDL_MIX_MAXVOLUME);
} }
void void
child_sound_init_sdl() child_sound_init_sdl()
{ {
printf("child_sound_init_sdl"); printf("child_sound_init_sdl");
SDL_memset(&want, 0, sizeof(want)); // or SDL_zero(want) SDL_memset(&want, 0, sizeof(want)); // or SDL_zero(want)
want.freq = g_preferred_rate; // 48000 ? want.freq = g_preferred_rate; // 48000 ?
want.format = AUDIO_S16SYS; // AUDIO_F32 want.format = AUDIO_S16SYS; // AUDIO_F32
want.channels = NUM_CHANNELS; //2 want.channels = NUM_CHANNELS; //2
want.samples = 512; //4096 want.samples = 512; //4096
want.callback = handle_sdl_snd; // you wrote this function elsewhere. want.callback = handle_sdl_snd; // you wrote this function elsewhere.
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, SDL_AUDIO_ALLOW_FORMAT_CHANGE); dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, SDL_AUDIO_ALLOW_FORMAT_CHANGE);
if (dev == 0) { if (dev == 0) {
printf("Failed to open audio: %s\n", SDL_GetError()); printf("Failed to open audio: %s\n", SDL_GetError());
} else { } else {
if (have.format != want.format) { // we let this one thing change. if (have.format != want.format) { // we let this one thing change.
printf("We didn't get Float32 audio format.\n"); printf("We didn't get Float32 audio format.\n");
} }
} }
// super experimental unknown // super experimental unknown
g_playbuf_buffered = 0; // init buffered state g_playbuf_buffered = 0; // init buffered state
int blen; int blen;
blen = (SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE * 2); // *2 unnecessary? blen = (SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE * 2); // *2 unnecessary?
g_sdlsnd_buflen = blen; g_sdlsnd_buflen = blen;
bptr = (byte*)malloc(blen); bptr = (byte*)malloc(blen);
if(bptr == NULL) { if(bptr == NULL) {
printf("Unabled to allocate sound buffer\n"); printf("Unabled to allocate sound buffer\n");
exit(1); exit(1);
} }
memset(bptr, 0, SOUND_SHM_SAMP_SIZE*SAMPLE_CHAN_SIZE *2); // zero out the buffer memset(bptr, 0, SOUND_SHM_SAMP_SIZE*SAMPLE_CHAN_SIZE *2); // zero out the buffer
g_sdlsnd_write_idx = 0; // initialize g_sdlsnd_write_idx = 0; // initialize
g_sdlsnd_read_idx = 0; g_sdlsnd_read_idx = 0;
SDL_PauseAudioDevice(dev, 0); // start audio playing. SDL_PauseAudioDevice(dev, 0); // start audio playing.
g_audio_rate = have.freq; g_audio_rate = have.freq;
printf("g_audio_rate: %d\n", g_audio_rate); printf("g_audio_rate: %d\n", g_audio_rate);
set_audio_rate(g_audio_rate); // let kegs simulator know the rate set_audio_rate(g_audio_rate); // let kegs simulator know the rate
} }
void void
sdlsnd_shutdown() { sdlsnd_shutdown() {
//SDL_Delay(5000); // let the audio callback play some sound for 5 seconds. //SDL_Delay(5000); // let the audio callback play some sound for 5 seconds.
SDL_CloseAudioDevice(dev); SDL_CloseAudioDevice(dev);
printf("sdlsnd_shutdown"); printf("sdlsnd_shutdown");
} }

View File

@ -1,3 +1,22 @@
/*
GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "SDL.h" #include "SDL.h"
#include "defc.h" #include "defc.h"

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2014 by GSport contributors Copyright (C) 2010 - 2014 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
@ -27,7 +29,7 @@
#include "tfe/protos_tfe.h" #include "tfe/protos_tfe.h"
#endif #endif
#include "printer.h" #include "printer.h"
#include "imagewriter.h" #include "imagewriter.h"
#ifdef UNDER_CE #ifdef UNDER_CE
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
@ -43,9 +45,9 @@ extern void get_cwd(LPTSTR buffer, int size);
#define PC_LOG_LEN (8*1024) #define PC_LOG_LEN (8*1024)
int g_speed_fast ; // OG Expose fast parameter int g_speed_fast ; // OG Expose fast parameter
int g_initialized = 0; // OG To know if the emulator has finalized its initialization int g_initialized = 0; // OG To know if the emulator has finalized its initialization
int g_accept_events = 0; // OG To know if the emulator is ready to accept external events int g_accept_events = 0; // OG To know if the emulator is ready to accept external events
char g_argv0_path[256] = "./"; char g_argv0_path[256] = "./";
@ -151,10 +153,10 @@ char* g_imagewriter_output = "bmp";
int g_imagewriter_multipage = 0; int g_imagewriter_multipage = 0;
int g_imagewriter_timeout = 2; int g_imagewriter_timeout = 2;
char* g_imagewriter_fixed_font = "lib/letgothl.ttf"; char* g_imagewriter_fixed_font = "lib/letgothl.ttf";
char* g_imagewriter_prop_font = "lib/letgothl.ttf"; char* g_imagewriter_prop_font = "lib/letgothl.ttf";
int g_imagewriter_paper = 0; int g_imagewriter_paper = 0;
int g_imagewriter_banner = 0; int g_imagewriter_banner = 0;
int g_config_iwm_vbl_count = 0; int g_config_iwm_vbl_count = 0;
extern const char g_gsport_version_str[] = "0.31"; extern const char g_gsport_version_str[] = "0.31";
int g_pause=0; // OG Added pause int g_pause=0; // OG Added pause
@ -214,13 +216,13 @@ byte *g_dummy_memory1_ptr = 0;
byte *g_rom_fc_ff_ptr = 0; byte *g_rom_fc_ff_ptr = 0;
byte *g_rom_cards_ptr = 0; byte *g_rom_cards_ptr = 0;
// OG Added allocated pointers // OG Added allocated pointers
byte *g_slow_memory_ptr_allocated = 0; byte *g_slow_memory_ptr_allocated = 0;
byte *g_memory_ptr_allocated = 0; byte *g_memory_ptr_allocated = 0;
byte *g_dummy_memory1_ptr_allocated = 0; byte *g_dummy_memory1_ptr_allocated = 0;
byte *g_rom_fc_ff_ptr_allocated = 0; byte *g_rom_fc_ff_ptr_allocated = 0;
byte *g_rom_cards_ptr_allocated = 0; byte *g_rom_cards_ptr_allocated = 0;
void *g_memory_alloc_ptr = 0; /* for freeing memory area */ void *g_memory_alloc_ptr = 0; /* for freeing memory area */
Page_info page_info_rd_wr[2*65536 + PAGE_INFO_PAD_SIZE]; Page_info page_info_rd_wr[2*65536 + PAGE_INFO_PAD_SIZE];
@ -236,69 +238,69 @@ Data_log *g_log_data_ptr = &(g_data_log_array[0]);
Data_log *g_log_data_start_ptr = &(g_data_log_array[0]); Data_log *g_log_data_start_ptr = &(g_data_log_array[0]);
Data_log *g_log_data_end_ptr = &(g_data_log_array[PC_LOG_LEN]); Data_log *g_log_data_end_ptr = &(g_data_log_array[PC_LOG_LEN]);
// OG Added sim65816_initglobals() // OG Added sim65816_initglobals()
void sim65816_initglobals() void sim65816_initglobals()
{ {
g_fcycles_stop = 0.0;
halt_sim = 0;
enter_debug = 0;
g_rom_version = -1;
g_user_halt_bad = 0;
g_halt_on_bad_read = 0;
g_ignore_bad_acc = 1;
g_ignore_halts = 1;
g_code_red = 0;
g_code_yellow = 0;
g_use_alib = 0;
g_iw2_emul = 0;
g_serial_out_masking = 0;
//g_serial_modem[2] = { 0, 1 };
g_config_iwm_vbl_count = 0;
g_pause=0;
g_last_vbl_dcycs = START_DCYCS;
g_cur_dcycs = START_DCYCS;
g_last_vbl_dadjcycs = 0.0;
g_dadjcycs = 0.0;
g_wait_pending = 0;
g_stp_pending = 0;
g_num_irq = 0;
g_num_brk = 0;
g_num_cop = 0;
g_num_enter_engine = 0;
g_io_amt = 0;
g_engine_action = 0;
g_engine_halt_event = 0;
g_engine_scan_int = 0;
g_engine_doc_int = 0;
g_testing = 0;
g_testing_enabled = 0;
g_debug_file_fd = -1;
g_fatal_log = -1;
g_25sec_cntr = 0;
g_1sec_cntr = 0;
g_dnatcycs_1sec = 0.0;
g_natcycs_lastvbl = 0;
Verbose = 0;
Halt_on = 0;
g_mem_size_base = 256*1024; /* size of motherboard memory */
g_mem_size_exp = 8*1024*1024; /* size of expansion RAM card */
g_mem_size_total = 256*1024; /* Total contiguous RAM from 0 */
}
g_fcycles_stop = 0.0;
halt_sim = 0;
enter_debug = 0;
g_rom_version = -1;
g_user_halt_bad = 0;
g_halt_on_bad_read = 0;
g_ignore_bad_acc = 1;
g_ignore_halts = 1;
g_code_red = 0;
g_code_yellow = 0;
g_use_alib = 0;
g_iw2_emul = 0;
g_serial_out_masking = 0;
//g_serial_modem[2] = { 0, 1 };
g_config_iwm_vbl_count = 0;
g_pause=0;
g_last_vbl_dcycs = START_DCYCS;
g_cur_dcycs = START_DCYCS;
g_last_vbl_dadjcycs = 0.0;
g_dadjcycs = 0.0;
g_wait_pending = 0;
g_stp_pending = 0;
g_num_irq = 0;
g_num_brk = 0;
g_num_cop = 0;
g_num_enter_engine = 0;
g_io_amt = 0;
g_engine_action = 0;
g_engine_halt_event = 0;
g_engine_scan_int = 0;
g_engine_doc_int = 0;
g_testing = 0;
g_testing_enabled = 0;
g_debug_file_fd = -1;
g_fatal_log = -1;
g_25sec_cntr = 0;
g_1sec_cntr = 0;
g_dnatcycs_1sec = 0.0;
g_natcycs_lastvbl = 0;
Verbose = 0;
Halt_on = 0;
g_mem_size_base = 256*1024; /* size of motherboard memory */
g_mem_size_exp = 8*1024*1024; /* size of expansion RAM card */
g_mem_size_total = 256*1024; /* Total contiguous RAM from 0 */
}
void void
show_pc_log() show_pc_log()
{ {
@ -427,7 +429,7 @@ toolbox_debug_c(word32 xreg, word32 stack, double *cyc_ptr)
pos = g_toolbox_log_pos; pos = g_toolbox_log_pos;
stack += 9; stack += 9;
g_toolbox_log_array[pos][0] = (word32)(g_last_vbl_dcycs + *cyc_ptr); g_toolbox_log_array[pos][0] = (word32)(g_last_vbl_dcycs + *cyc_ptr);
g_toolbox_log_array[pos][1] = stack+1; g_toolbox_log_array[pos][1] = stack+1;
g_toolbox_log_array[pos][2] = xreg; g_toolbox_log_array[pos][2] = xreg;
g_toolbox_log_array[pos][3] = toolbox_debug_4byte(stack+1); g_toolbox_log_array[pos][3] = toolbox_debug_4byte(stack+1);
@ -718,30 +720,30 @@ show_regs()
show_regs_act(&engine); show_regs_act(&engine);
} }
//OG for regular exit, use quitEmulator() //OG for regular exit, use quitEmulator()
void quitEmulator() void quitEmulator()
{ {
printf("set_halt(HALT_WANTTOQUIT)\n"); printf("set_halt(HALT_WANTTOQUIT)\n");
set_halt(HALT_WANTTOQUIT); set_halt(HALT_WANTTOQUIT);
} }
//OG change exit to fatal_exit() //OG change exit to fatal_exit()
#ifndef ACTIVEGS #ifndef ACTIVEGS
// use standard exit function // use standard exit function
#define fatalExit exit #define fatalExit exit
#else #else
extern void fatalExit(int); extern void fatalExit(int);
#endif #endif
void my_exit(int ret) void my_exit(int ret)
{ {
end_screen(); end_screen();
imagewriter_close(); imagewriter_close();
printer_close(); printer_close();
printf("exiting (ret=%d)\n",ret); printf("exiting (ret=%d)\n",ret);
fatalExit(ret); fatalExit(ret);
} }
@ -786,9 +788,9 @@ do_reset()
g_stepping = 0; g_stepping = 0;
if (g_irq_pending) if (g_irq_pending)
halt_printf("*** irq remainings...\n"); halt_printf("*** irq remainings...\n");
} }
#define CHECK(start, var, value, var1, var2) \ #define CHECK(start, var, value, var1, var2) \
@ -851,7 +853,7 @@ memalloc_align(int size, int skip_amt, void **alloc_ptr)
word32 offset; word32 offset;
skip_amt = MAX(256, skip_amt); skip_amt = MAX(256, skip_amt);
bptr = (byte*)calloc(size + skip_amt + 256, 1); // OG Added cast bptr = (byte*)calloc(size + skip_amt + 256, 1); // OG Added cast
if(alloc_ptr) { if(alloc_ptr) {
/* Save allocation address */ /* Save allocation address */
*alloc_ptr = bptr; *alloc_ptr = bptr;
@ -876,34 +878,34 @@ memory_ptr_init()
/* changes this will be called */ /* changes this will be called */
mem_size = MIN(0xdf0000, g_mem_size_base + g_mem_size_exp); mem_size = MIN(0xdf0000, g_mem_size_base + g_mem_size_exp);
g_mem_size_total = mem_size; g_mem_size_total = mem_size;
// OG using memory_ptr_shut() instead // OG using memory_ptr_shut() instead
memory_ptr_shut(); memory_ptr_shut();
/* /*
if(g_memory_alloc_ptr) { if(g_memory_alloc_ptr) {
free(g_memory_alloc_ptr); free(g_memory_alloc_ptr);
g_memory_alloc_ptr = 0; g_memory_alloc_ptr = 0;
} }
*/ */
g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr); g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr);
printf("RAM size is 0 - %06x (%.2fMB)\n", mem_size, printf("RAM size is 0 - %06x (%.2fMB)\n", mem_size,
(double)mem_size/(1024.0*1024.0)); (double)mem_size/(1024.0*1024.0));
} }
// OG Added memory_ptr_shut // OG Added memory_ptr_shut
void void
memory_ptr_shut() memory_ptr_shut()
{ {
if(g_memory_alloc_ptr) if(g_memory_alloc_ptr)
{ {
free(g_memory_alloc_ptr); free(g_memory_alloc_ptr);
g_memory_alloc_ptr = 0; g_memory_alloc_ptr = 0;
} }
g_memory_ptr = 0; g_memory_ptr = 0;
} }
extern int g_screen_redraw_skip_amt; extern int g_screen_redraw_skip_amt;
extern int g_use_shmem; extern int g_use_shmem;
extern int g_use_dhr140; extern int g_use_dhr140;
@ -922,16 +924,16 @@ gsportmain(int argc, char **argv)
int tmp1; int tmp1;
int i; int i;
char *final_arg = 0; char *final_arg = 0;
// OG Restoring globals // OG Restoring globals
sim65816_initglobals(); sim65816_initglobals();
moremem_init(); moremem_init();
//OG Disabling argument parsing //OG Disabling argument parsing
#ifndef ACTIVEGS #ifndef ACTIVEGS
/* parse args */ /* parse args */
for(i = 1; i < argc; i++) { for(i = 1; i < argc; i++) {
if(!strcmp("-badrd", argv[i])) { if(!strcmp("-badrd", argv[i])) {
printf("Halting on bad reads\n"); printf("Halting on bad reads\n");
g_halt_on_bad_read = 2; g_halt_on_bad_read = 2;
@ -1043,7 +1045,7 @@ gsportmain(int argc, char **argv)
exit(3); exit(3);
} }
} }
} }
#endif #endif
check_engine_asm_defines(); check_engine_asm_defines();
fixed_memory_ptrs_init(); fixed_memory_ptrs_init();
@ -1133,33 +1135,33 @@ gsportmain(int argc, char **argv)
do_reset(); do_reset();
g_stepping = 0; g_stepping = 0;
// OG Notify emulator has been initialized and ready to accept external events // OG Notify emulator has been initialized and ready to accept external events
g_initialized = 1; g_initialized = 1;
g_accept_events = 1; g_accept_events = 1;
do_go(); do_go();
/* If we get here, we hit a breakpoint, call debug intfc */ /* If we get here, we hit a breakpoint, call debug intfc */
do_debug_intfc(); do_debug_intfc();
// OG Notify emulator is being closed, and cannot accept events anymore // OG Notify emulator is being closed, and cannot accept events anymore
g_accept_events = 0; g_accept_events = 0;
sound_shutdown(); sound_shutdown();
// OG Cleaning up // OG Cleaning up
adb_shut(); adb_shut();
iwm_shut(); iwm_shut();
fixed_memory_ptrs_shut(); fixed_memory_ptrs_shut();
load_roms_shut_memory(); load_roms_shut_memory();
clear_fatal_logs(); clear_fatal_logs();
// OG Not needed anymore : the emulator will quit gently // OG Not needed anymore : the emulator will quit gently
//my_exit(0); //my_exit(0);
end_screen(); end_screen();
return 0; return 0;
} }
@ -1184,14 +1186,14 @@ load_roms_init_memory()
set_memory16_c(0xe115fe, 0, 0); set_memory16_c(0xe115fe, 0, 0);
} }
// OG Added load_roms_shut_memory // OG Added load_roms_shut_memory
void load_roms_shut_memory() void load_roms_shut_memory()
{ {
memory_ptr_shut(); memory_ptr_shut();
} }
#ifndef ACTIVEGS #ifndef ACTIVEGS
void void
gsport_expand_path(char *out_ptr, const char *in_ptr, int maxlen) gsport_expand_path(char *out_ptr, const char *in_ptr, int maxlen)
{ {
@ -1341,8 +1343,8 @@ setup_gsport_file(char *outname, int maxlen, int ok_if_missing,
my_exit(2); my_exit(2);
} }
#endif #endif
Event g_event_list[MAX_EVENTS]; Event g_event_list[MAX_EVENTS];
Event g_event_free; Event g_event_free;
Event g_event_start; Event g_event_start;
@ -1675,13 +1677,13 @@ run_prog()
while(1) { while(1) {
fflush(stdout); fflush(stdout);
// OG Disabling control panel // OG Disabling control panel
#ifndef ACTIVEGS #ifndef ACTIVEGS
if(g_config_control_panel) { if(g_config_control_panel) {
config_control_panel(); config_control_panel();
} }
#endif #endif
if(g_irq_pending && !(engine.psr & 0x4)) { if(g_irq_pending && !(engine.psr & 0x4)) {
irq_printf("taking an irq!\n"); irq_printf("taking an irq!\n");
take_irq(0); take_irq(0);
@ -1695,8 +1697,8 @@ run_prog()
zip_follow_cps = ((g_zipgs_reg_c059 & 0x8) != 0); zip_follow_cps = ((g_zipgs_reg_c059 & 0x8) != 0);
zip_speed_0tof_new = g_zipgs_reg_c05a & 0xf0; zip_speed_0tof_new = g_zipgs_reg_c05a & 0xf0;
fast = (g_c036_val_speed & 0x80) || (zip_en && !zip_follow_cps); fast = (g_c036_val_speed & 0x80) || (zip_en && !zip_follow_cps);
// OG Make fast parameter public // OG Make fast parameter public
g_speed_fast = fast; g_speed_fast = fast;
if(zip_speed_0tof_new != zip_speed_0tof) { if(zip_speed_0tof_new != zip_speed_0tof) {
zip_speed_0tof = zip_speed_0tof_new; zip_speed_0tof = zip_speed_0tof_new;
setup_zip_speeds(); setup_zip_speeds();
@ -1711,11 +1713,11 @@ run_prog()
zip_speed = faster_than_28 && zip_speed = faster_than_28 &&
((zip_speed_0tof != 0) || (limit_speed == 3) || ((zip_speed_0tof != 0) || (limit_speed == 3) ||
(g_zipgs_unlock >= 4) ); (g_zipgs_unlock >= 4) );
// OG unlimited speed should not be affected by zip. // OG unlimited speed should not be affected by zip.
// unl_speed = faster_than_28 && !zip_speed; // unl_speed = faster_than_28 && !zip_speed;
unl_speed = (limit_speed == 0) && faster_than_28; unl_speed = (limit_speed == 0) && faster_than_28;
if(unl_speed) { if(unl_speed) {
/* use unlimited speed */ /* use unlimited speed */
fspeed_mult = g_projected_pmhz; fspeed_mult = g_projected_pmhz;
@ -2125,13 +2127,13 @@ update_60hz(double dcycs, double dtime_now)
default: sp_str = "Unlimited"; break; default: sp_str = "Unlimited"; break;
} }
// OG Pass speed info to the control (ActiveX specific) // OG Pass speed info to the control (ActiveX specific)
#ifdef ACTIVEGS #ifdef ACTIVEGS
{ {
extern void updateInfo(const char* target,const char *speed); extern void updateInfo(const char* target,const char *speed);
updateInfo(sp_str,total_mhz_ptr); updateInfo(sp_str,total_mhz_ptr);
} }
#endif #endif
sprintf(status_buf, "dcycs:%9.1f sim MHz:%s " sprintf(status_buf, "dcycs:%9.1f sim MHz:%s "
"Eff MHz:%s, sec:%1.3f vol:%02x pal:%x, Limit:%s", "Eff MHz:%s, sec:%1.3f vol:%02x pal:%x, Limit:%s",
dcycs/(1000.0*1000.0), sim_mhz_ptr, total_mhz_ptr, dcycs/(1000.0*1000.0), sim_mhz_ptr, total_mhz_ptr,
@ -2360,17 +2362,17 @@ update_60hz(double dcycs, double dtime_now)
} }
iwm_vbl_update(doit_3_persec); iwm_vbl_update(doit_3_persec);
// OG Disabling config update // OG Disabling config update
#ifndef ACTIVEGS #ifndef ACTIVEGS
config_vbl_update(doit_3_persec); config_vbl_update(doit_3_persec);
#else #else
// OG Added disk update // OG Added disk update
{ {
extern void checkImages(); extern void checkImages();
checkImages(); checkImages();
} }
#endif #endif
video_update(); video_update();
sound_update(dcycs); sound_update(dcycs);
@ -2384,7 +2386,7 @@ update_60hz(double dcycs, double dtime_now)
if (g_imagewriter_timeout) if (g_imagewriter_timeout)
{ {
imagewriter_update(); imagewriter_update();
} }
paddle_update_buttons(); paddle_update_buttons();
} }
@ -2465,7 +2467,7 @@ check_scan_line_int(double dcycs, int cur_video_line)
} }
if(g_slow_memory_ptr[0x19d00+i] & 0x40) { if(g_slow_memory_ptr[0x19d00+i] & 0x40) {
irq_printf("Adding scan_int for line %d\n", i); irq_printf("Adding scan_int for line %d\n", i);
delay = (int)( (DCYCS_IN_16MS/262.0) * ((double)line) ); delay = (int)( (DCYCS_IN_16MS/262.0) * ((double)line) );
add_event_entry(g_last_vbl_dcycs + delay, EV_SCAN_INT + add_event_entry(g_last_vbl_dcycs + delay, EV_SCAN_INT +
(line << 8)); (line << 8));
g_scan_int_events = 1; g_scan_int_events = 1;
@ -2681,15 +2683,15 @@ gsport_vprintf(const char *fmt, va_list ap)
int len; int len;
int ret; int ret;
bufptr = (char*)malloc(4096); // OG Added Cast bufptr = (char*)malloc(4096); // OG Added Cast
ret = vsnprintf(bufptr, 4090, fmt, ap); ret = vsnprintf(bufptr, 4090, fmt, ap);
// OG Display warning // OG Display warning
printf("Warning:%s",bufptr); printf("Warning:%s",bufptr);
len = strlen(bufptr); len = strlen(bufptr);
if(g_fatal_log >= 0 && g_fatal_log < MAX_FATAL_LOGS) { if(g_fatal_log >= 0 && g_fatal_log < MAX_FATAL_LOGS) {
buf2ptr = (char*)malloc(len+1); // OG Added Cast buf2ptr = (char*)malloc(len+1); // OG Added Cast
memcpy(buf2ptr, bufptr, len+1); memcpy(buf2ptr, bufptr, len+1);
g_fatal_log_strs[g_fatal_log++] = buf2ptr; g_fatal_log_strs[g_fatal_log++] = buf2ptr;
} }
@ -2740,7 +2742,7 @@ gsport_malloc_str(char *in_str)
int len; int len;
len = strlen(in_str) + 1; len = strlen(in_str) + 1;
str = (char*)malloc(len); // OG Added cast str = (char*)malloc(len); // OG Added cast
memcpy(str, in_str, len); memcpy(str, in_str, len);
return str; return str;

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,7 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,435 +1,437 @@
/* /*
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2010 - 2012 by GSport contributors Copyright (C) 2016 - Dagen Brock
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Copyright (C) 2010 - 2012 by GSport contributors
This program is free software; you can redistribute it and/or modify it Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your This program is free software; you can redistribute it and/or modify it
option) any later version. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
This program is distributed in the hope that it will be useful, but option) any later version.
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License This program is distributed in the hope that it will be useful, but
for more details. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
You should have received a copy of the GNU General Public License along for more details.
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You should have received a copy of the GNU General Public License along
*/ with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "defc.h" */
#include "sound.h"
#include "defc.h"
#ifdef HPUX #include "sound.h"
# include <sys/audio.h>
#endif #ifdef HPUX
#ifdef HAVE_SDL # include <sys/audio.h>
# include "SDL.h" #endif
long sound_init_device_sdl(); #ifdef HAVE_SDL
#endif # include "SDL.h"
long sound_init_device_sdl();
#if defined(__linux__) || defined(OSS) #endif
# include <sys/soundcard.h>
#endif #if defined(__linux__) || defined(OSS)
# include <sys/soundcard.h>
#ifndef WIN_SOUND /* Workaround - gcc in cygwin wasn't defining _WIN32 */ #endif
# include <sys/socket.h>
# include <netinet/in.h> #ifndef WIN_SOUND /* Workaround - gcc in cygwin wasn't defining _WIN32 */
#endif # include <sys/socket.h>
#ifndef UNDER_CE # include <netinet/in.h>
#include <errno.h> #endif
#endif #ifndef UNDER_CE
#include <errno.h>
#endif
extern int Verbose;
extern int g_audio_rate; extern int Verbose;
int g_preferred_rate = 48000; extern int g_audio_rate;
int g_audio_socket = -1;
int g_bytes_written = 0; int g_preferred_rate = 48000;
int g_audio_socket = -1;
#define ZERO_BUF_SIZE 2048 int g_bytes_written = 0;
word32 g_snd_zero_buf[ZERO_BUF_SIZE]; #define ZERO_BUF_SIZE 2048
#define ZERO_PAUSE_SAFETY_SAMPS (g_audio_rate >> 5) word32 g_snd_zero_buf[ZERO_BUF_SIZE];
#define ZERO_PAUSE_NUM_SAMPS (4*g_audio_rate)
#define ZERO_PAUSE_SAFETY_SAMPS (g_audio_rate >> 5)
int g_zeroes_buffered = 0; #define ZERO_PAUSE_NUM_SAMPS (4*g_audio_rate)
int g_zeroes_seen = 0;
int g_sound_paused = 0; int g_zeroes_buffered = 0;
int g_childsnd_vbl = 0; int g_zeroes_seen = 0;
int g_childsnd_pos = 0; int g_sound_paused = 0;
word32 *g_childsnd_shm_addr = 0; int g_childsnd_vbl = 0;
int g_childsnd_pos = 0;
void child_sound_init_linux(); word32 *g_childsnd_shm_addr = 0;
void child_sound_init_hpdev();
void child_sound_initWIN_SOUND(); void child_sound_init_linux();
void child_sound_init_mac(); void child_sound_init_hpdev();
void child_sound_init_sdl(); void child_sound_initWIN_SOUND();
long sound_init_device_sdl(); void child_sound_init_mac();
void child_sound_init_sdl();
void long sound_init_device_sdl();
reliable_buf_write(word32 *shm_addr, int pos, int size)
{ void
byte *ptr; reliable_buf_write(word32 *shm_addr, int pos, int size)
int ret; {
byte *ptr;
if(size < 1 || pos < 0 || pos > SOUND_SHM_SAMP_SIZE || int ret;
size > SOUND_SHM_SAMP_SIZE ||
(pos + size) > SOUND_SHM_SAMP_SIZE) { if(size < 1 || pos < 0 || pos > SOUND_SHM_SAMP_SIZE ||
printf("reliable_buf_write: pos: %04x, size: %04x\n", pos, size); size > SOUND_SHM_SAMP_SIZE ||
exit(1); (pos + size) > SOUND_SHM_SAMP_SIZE) {
} printf("reliable_buf_write: pos: %04x, size: %04x\n", pos, size);
exit(1);
ptr = (byte *)&(shm_addr[pos]); }
size = size * 4;
ptr = (byte *)&(shm_addr[pos]);
while(size > 0) { size = size * 4;
#if defined(HAVE_SDL)
//ret = sdl_send_audio(ptr, size); while(size > 0) {
#if defined(HAVE_SDL)
#elif defined(WIN_SOUND) //ret = sdl_send_audio(ptr, size);
ret = win32_send_audio(ptr, size);
#elif defined(MAC) && !defined(HAVE_SDL) #elif defined(WIN_SOUND)
ret = mac_send_audio(ptr, size); ret = win32_send_audio(ptr, size);
#else #elif defined(MAC) && !defined(HAVE_SDL)
ret = write(g_audio_socket, ptr, size); ret = mac_send_audio(ptr, size);
#endif #else
ret = write(g_audio_socket, ptr, size);
if(ret < 0) { #endif
printf("audio write, errno: %d\n", errno);
exit(1); if(ret < 0) {
} printf("audio write, errno: %d\n", errno);
size = size - ret; exit(1);
ptr += ret; }
g_bytes_written += ret; size = size - ret;
} ptr += ret;
g_bytes_written += ret;
} }
void }
reliable_zero_write(int amt)
{ void
int len; reliable_zero_write(int amt)
{
while(amt > 0) { int len;
len = MIN(amt, ZERO_BUF_SIZE);
reliable_buf_write(g_snd_zero_buf, 0, len); while(amt > 0) {
amt -= len; len = MIN(amt, ZERO_BUF_SIZE);
} reliable_buf_write(g_snd_zero_buf, 0, len);
} amt -= len;
}
}
void
child_sound_loop(int read_fd, int write_fd, word32 *shm_addr)
{ void
word32 tmp; child_sound_loop(int read_fd, int write_fd, word32 *shm_addr)
int ret; {
word32 tmp;
g_audio_rate = g_preferred_rate; int ret;
g_zeroes_buffered = 0; g_audio_rate = g_preferred_rate;
g_zeroes_seen = 0;
g_sound_paused = 0; g_zeroes_buffered = 0;
g_zeroes_seen = 0;
g_childsnd_pos = 0; g_sound_paused = 0;
g_childsnd_vbl = 0;
g_childsnd_shm_addr = shm_addr; g_childsnd_pos = 0;
g_childsnd_vbl = 0;
#if defined(HAVE_SDL) g_childsnd_shm_addr = shm_addr;
//child_sound_init_sdl();
long rate = sound_init_device_sdl(); #if defined(HAVE_SDL)
return; //child_sound_init_sdl();
#elif defined(__linux__) || defined(OSS) long rate = sound_init_device_sdl();
child_sound_init_linux(); return;
#elif HPUX #elif defined(__linux__) || defined(OSS)
child_sound_init_hpdev(); child_sound_init_linux();
#elif WIN_SOUND #elif HPUX
child_sound_init_win32(); child_sound_init_hpdev();
return; #elif WIN_SOUND
#elif defined(MAC) && !defined(HAVE_SDL) child_sound_init_win32();
child_sound_init_mac(); return;
return; #elif defined(MAC) && !defined(HAVE_SDL)
#endif child_sound_init_mac();
return;
doc_printf("Child pipe fd: %d\n", read_fd); #endif
tmp = g_audio_rate; doc_printf("Child pipe fd: %d\n", read_fd);
ret = write(write_fd, &tmp, 4);
if(ret != 4) { tmp = g_audio_rate;
printf("Unable to send back audio rate to parent\n"); ret = write(write_fd, &tmp, 4);
printf("ret: %d fd: %d, errno: %d\n", ret, write_fd, errno); if(ret != 4) {
exit(1); printf("Unable to send back audio rate to parent\n");
} printf("ret: %d fd: %d, errno: %d\n", ret, write_fd, errno);
printf("Wrote to fd %d the audio rate\n", write_fd); exit(1);
}
close(write_fd); printf("Wrote to fd %d the audio rate\n", write_fd);
while(1) { close(write_fd);
errno = 0;
ret = read(read_fd, (char*)&tmp, 4); while(1) {
if(ret <= 0) { errno = 0;
printf("child dying from ret: %d, errno: %d\n", ret = read(read_fd, (char*)&tmp, 4);
ret, errno); if(ret <= 0) {
break; printf("child dying from ret: %d, errno: %d\n",
} ret, errno);
break;
child_sound_playit(tmp); }
}
child_sound_playit(tmp);
#ifdef HPUX }
ioctl(g_audio_socket, AUDIO_DRAIN, 0);
#endif #ifdef HPUX
close(g_audio_socket); ioctl(g_audio_socket, AUDIO_DRAIN, 0);
#endif
exit(0); close(g_audio_socket);
}
exit(0);
// called by sound.c:send_sound() }
void
child_sound_playit(word32 tmp) // called by sound.c:send_sound()
{ void
int size; child_sound_playit(word32 tmp)
{
size = tmp & 0xffffff; int size;
printf("SIze: %d ",size);
if((tmp >> 24) == 0xa2) { size = tmp & 0xffffff;
/* play sound here */ printf("SIze: %d ",size);
if((tmp >> 24) == 0xa2) {
/* play sound here */
#if 0
g_childsnd_pos += g_zeroes_buffered;
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) { #if 0
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE; g_childsnd_pos += g_zeroes_buffered;
} while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
#endif g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
}
if(g_zeroes_buffered) { #endif
reliable_zero_write(g_zeroes_buffered);
} if(g_zeroes_buffered) {
reliable_zero_write(g_zeroes_buffered);
g_zeroes_buffered = 0; }
g_zeroes_seen = 0;
g_zeroes_buffered = 0;
// only write up to end of buffer g_zeroes_seen = 0;
if((size + g_childsnd_pos) > SOUND_SHM_SAMP_SIZE) {
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, // only write up to end of buffer
SOUND_SHM_SAMP_SIZE - g_childsnd_pos); if((size + g_childsnd_pos) > SOUND_SHM_SAMP_SIZE) {
size = (g_childsnd_pos + size) - SOUND_SHM_SAMP_SIZE; reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos,
g_childsnd_pos = 0; SOUND_SHM_SAMP_SIZE - g_childsnd_pos);
} size = (g_childsnd_pos + size) - SOUND_SHM_SAMP_SIZE;
g_childsnd_pos = 0;
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, size); }
if(g_sound_paused) { reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, size);
printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
g_sound_paused = 0; if(g_sound_paused) {
} printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
g_sound_paused = 0;
} else if((tmp >> 24) == 0xa1) { }
if(g_sound_paused) {
if(g_zeroes_buffered < ZERO_PAUSE_SAFETY_SAMPS) { } else if((tmp >> 24) == 0xa1) {
g_zeroes_buffered += size; if(g_sound_paused) {
} if(g_zeroes_buffered < ZERO_PAUSE_SAFETY_SAMPS) {
} else { g_zeroes_buffered += size;
/* not paused, send it through */ }
g_zeroes_seen += size; } else {
/* not paused, send it through */
reliable_zero_write(size); g_zeroes_seen += size;
if(g_zeroes_seen >= ZERO_PAUSE_NUM_SAMPS) { reliable_zero_write(size);
printf("Pausing sound\n");
g_sound_paused = 1; if(g_zeroes_seen >= ZERO_PAUSE_NUM_SAMPS) {
} printf("Pausing sound\n");
} g_sound_paused = 1;
} else { }
printf("tmp received bad: %08x\n", tmp); }
exit(3); } else {
} printf("tmp received bad: %08x\n", tmp);
exit(3);
g_childsnd_pos += size; }
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE; g_childsnd_pos += size;
} while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
g_childsnd_vbl++; }
if(g_childsnd_vbl >= 60) {
g_childsnd_vbl = 0; g_childsnd_vbl++;
g_bytes_written = 0; if(g_childsnd_vbl >= 60) {
} g_childsnd_vbl = 0;
} g_bytes_written = 0;
}
}
#ifdef HPUX
void
child_sound_init_hpdev() #ifdef HPUX
{ void
struct audio_describe audio_descr; child_sound_init_hpdev()
int output_channel; {
char *str; struct audio_describe audio_descr;
int speaker; int output_channel;
int ret; char *str;
int i; int speaker;
int ret;
g_audio_socket = open("/dev/audio", O_WRONLY, 0); int i;
if(g_audio_socket < 0) {
printf("open /dev/audio failed, ret: %d, errno:%d\n", g_audio_socket = open("/dev/audio", O_WRONLY, 0);
g_audio_socket, errno); if(g_audio_socket < 0) {
exit(1); printf("open /dev/audio failed, ret: %d, errno:%d\n",
} g_audio_socket, errno);
exit(1);
ret = ioctl(g_audio_socket, AUDIO_DESCRIBE, &audio_descr); }
if(ret < 0) {
printf("ioctl AUDIO_DESCRIBE failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_DESCRIBE, &audio_descr);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_DESCRIBE failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
for(i = 0; i < audio_descr.nrates; i++) { }
printf("Audio rate[%d] = %d\n", i,
audio_descr.sample_rate[i]); for(i = 0; i < audio_descr.nrates; i++) {
} printf("Audio rate[%d] = %d\n", i,
audio_descr.sample_rate[i]);
ret = ioctl(g_audio_socket, AUDIO_SET_DATA_FORMAT, }
AUDIO_FORMAT_LINEAR16BIT);
if(ret < 0) { ret = ioctl(g_audio_socket, AUDIO_SET_DATA_FORMAT,
printf("ioctl AUDIO_SET_DATA_FORMAT failed, ret:%d, errno:%d\n", AUDIO_FORMAT_LINEAR16BIT);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_SET_DATA_FORMAT failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
ret = ioctl(g_audio_socket, AUDIO_SET_CHANNELS, NUM_CHANNELS); }
if(ret < 0) {
printf("ioctl AUDIO_SET_CHANNELS failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_SET_CHANNELS, NUM_CHANNELS);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_SET_CHANNELS failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
ret = ioctl(g_audio_socket, AUDIO_SET_TXBUFSIZE, 16*1024); }
if(ret < 0) {
printf("ioctl AUDIO_SET_TXBUFSIZE failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_SET_TXBUFSIZE, 16*1024);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_SET_TXBUFSIZE failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
ret = ioctl(g_audio_socket, AUDIO_SET_SAMPLE_RATE, g_audio_rate); }
if(ret < 0) {
printf("ioctl AUDIO_SET_SAMPLE_RATE failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_SET_SAMPLE_RATE, g_audio_rate);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_SET_SAMPLE_RATE failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
ret = ioctl(g_audio_socket, AUDIO_GET_OUTPUT, &output_channel); }
if(ret < 0) {
printf("ioctl AUDIO_GET_OUTPUT failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_GET_OUTPUT, &output_channel);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_GET_OUTPUT failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
}
speaker = 1;
str = getenv("SPEAKER");
if(str) { speaker = 1;
if(str[0] != 'i' && str[0] != 'I') { str = getenv("SPEAKER");
speaker = 0; if(str) {
} if(str[0] != 'i' && str[0] != 'I') {
} speaker = 0;
}
if(speaker) { }
printf("Sending sound to internal speaker\n");
output_channel |= AUDIO_OUT_SPEAKER; if(speaker) {
} else { printf("Sending sound to internal speaker\n");
printf("Sending sound to external jack\n"); output_channel |= AUDIO_OUT_SPEAKER;
output_channel &= (~AUDIO_OUT_SPEAKER); } else {
output_channel |= AUDIO_OUT_HEADPHONE; printf("Sending sound to external jack\n");
} output_channel &= (~AUDIO_OUT_SPEAKER);
output_channel |= AUDIO_OUT_HEADPHONE;
ret = ioctl(g_audio_socket, AUDIO_SET_OUTPUT, output_channel); }
if(ret < 0) {
printf("ioctl AUDIO_SET_OUTPUT failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, AUDIO_SET_OUTPUT, output_channel);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl AUDIO_SET_OUTPUT failed, ret:%d, errno:%d\n",
} ret, errno);
} exit(1);
#endif /* HPUX */ }
}
#if defined(__linux__) || defined(OSS) #endif /* HPUX */
void
child_sound_init_linux() #if defined(__linux__) || defined(OSS)
{ void
int stereo; child_sound_init_linux()
int sample_size; {
int rate; int stereo;
int fragment; int sample_size;
int fmt; int rate;
int ret; int fragment;
int fmt;
g_audio_socket = open("/dev/dsp", O_WRONLY, 0); int ret;
if(g_audio_socket < 0) {
printf("open /dev/dsp failed, ret: %d, errno:%d\n", g_audio_socket = open("/dev/dsp", O_WRONLY, 0);
g_audio_socket, errno); if(g_audio_socket < 0) {
exit(1); printf("open /dev/dsp failed, ret: %d, errno:%d\n",
} g_audio_socket, errno);
exit(1);
fragment = 0x00200009; }
#if 0
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFRAGMENT, &fragment); fragment = 0x00200009;
if(ret < 0) { #if 0
printf("ioctl SETFRAGEMNT failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFRAGMENT, &fragment);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl SETFRAGEMNT failed, ret:%d, errno:%d\n",
} ret, errno);
#endif exit(1);
}
sample_size = 16; #endif
ret = ioctl(g_audio_socket, SNDCTL_DSP_SAMPLESIZE, &sample_size);
if(ret < 0) { sample_size = 16;
printf("ioctl SNDCTL_DSP_SAMPLESIZE failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, SNDCTL_DSP_SAMPLESIZE, &sample_size);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl SNDCTL_DSP_SAMPLESIZE failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command }
fmt = AFMT_S16_LE;
#else #if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
fmt = AFMT_S16_BE; fmt = AFMT_S16_LE;
#endif #else
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFMT, &fmt); fmt = AFMT_S16_BE;
if(ret < 0) { #endif
printf("ioctl SNDCTL_DSP_SETFMT failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFMT, &fmt);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl SNDCTL_DSP_SETFMT failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
stereo = 1; }
ret = ioctl(g_audio_socket, SNDCTL_DSP_STEREO, &stereo);
if(ret < 0) { stereo = 1;
printf("ioctl SNDCTL_DSP_STEREO failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, SNDCTL_DSP_STEREO, &stereo);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl SNDCTL_DSP_STEREO failed, ret:%d, errno:%d\n",
} ret, errno);
exit(1);
rate = g_audio_rate; }
ret = ioctl(g_audio_socket, SNDCTL_DSP_SPEED, &rate);
if(ret < 0) { rate = g_audio_rate;
printf("ioctl SNDCTL_DSP_SPEED failed, ret:%d, errno:%d\n", ret = ioctl(g_audio_socket, SNDCTL_DSP_SPEED, &rate);
ret, errno); if(ret < 0) {
exit(1); printf("ioctl SNDCTL_DSP_SPEED failed, ret:%d, errno:%d\n",
} ret, errno);
if(ret > 0) { exit(1);
rate = ret; /* rate is returned value */ }
} if(ret > 0) {
if(rate < 8000) { rate = ret; /* rate is returned value */
printf("Audio rate of %d which is < 8000!\n", rate); }
exit(1); if(rate < 8000) {
} printf("Audio rate of %d which is < 8000!\n", rate);
exit(1);
g_audio_rate = rate; }
printf("Sound initialized\n"); g_audio_rate = rate;
}
#endif printf("Sound initialized\n");
}
#endif

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,108 +1,108 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{E810477A-E004-4308-A58A-21393213EF89}</ProjectGuid> <ProjectGuid>{E810477A-E004-4308-A58A-21393213EF89}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>tfe</RootNamespace> <RootNamespace>tfe</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\arch\win32\bittypes.h" /> <ClInclude Include="..\arch\win32\bittypes.h" />
<ClInclude Include="..\arch\win32\bpf.h" /> <ClInclude Include="..\arch\win32\bpf.h" />
<ClInclude Include="..\arch\win32\dirent-win32.h" /> <ClInclude Include="..\arch\win32\dirent-win32.h" />
<ClInclude Include="..\arch\win32\ip6_misc.h" /> <ClInclude Include="..\arch\win32\ip6_misc.h" />
<ClInclude Include="..\arch\win32\pcap-stdinc.h" /> <ClInclude Include="..\arch\win32\pcap-stdinc.h" />
<ClInclude Include="..\arch\win32\pcap.h" /> <ClInclude Include="..\arch\win32\pcap.h" />
<ClInclude Include="tfesupp.h" /> <ClInclude Include="tfesupp.h" />
<ClInclude Include="types.h" /> <ClInclude Include="types.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="tfe.c" /> <ClCompile Include="tfe.c" />
<ClCompile Include="tfearch.c" /> <ClCompile Include="tfearch.c" />
<ClCompile Include="tfesupp.c" /> <ClCompile Include="tfesupp.c" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,54 +1,54 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Resource Files"> <Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="tfesupp.h"> <ClInclude Include="tfesupp.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="types.h"> <ClInclude Include="types.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\bittypes.h"> <ClInclude Include="..\arch\win32\bittypes.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\bpf.h"> <ClInclude Include="..\arch\win32\bpf.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\dirent-win32.h"> <ClInclude Include="..\arch\win32\dirent-win32.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\ip6_misc.h"> <ClInclude Include="..\arch\win32\ip6_misc.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\pcap.h"> <ClInclude Include="..\arch\win32\pcap.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\arch\win32\pcap-stdinc.h"> <ClInclude Include="..\arch\win32\pcap-stdinc.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="tfe.c"> <ClCompile Include="tfe.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="tfesupp.c"> <ClCompile Include="tfesupp.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="tfearch.c"> <ClCompile Include="tfearch.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,6 +2,8 @@
GSPLUS - Advanced Apple IIGS Emulator Environment GSPLUS - Advanced Apple IIGS Emulator Environment
Copyright (C) 2016 - Dagen Brock Copyright (C) 2016 - Dagen Brock
Copyright (C) 2010 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,18 +1,18 @@
TARGET = gsportfb TARGET = gsportfb
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) fbdriver.o OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) fbdriver.o
CC = gcc CC = gcc
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -march=armv6 CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -march=armv6
OPTS = -DGSPORT_LITTLE_ENDIAN -DHAVE_TFE -DHAVE_ATBRIDGE OPTS = -DGSPORT_LITTLE_ENDIAN -DHAVE_TFE -DHAVE_ATBRIDGE
SUFFIX = SUFFIX =
NAME = gsportfb NAME = gsportfb
LDFLAGS = LDFLAGS =
LDOPTS = LDOPTS =
LD = g++ LD = g++
EXTRA_LIBS = -ldl EXTRA_LIBS = -ldl
EXTRA_SPECIALS = EXTRA_SPECIALS =
AS = cc AS = cc
PERL = perl PERL = perl
XOPTS = -I/usr/X11R6/include XOPTS = -I/usr/X11R6/include

View File

@ -1,31 +1,31 @@
TARGET = gsplus TARGET = gsplus
NAME = gsplus NAME = gsplus
PERL = perl PERL = perl
CC = clang CC = clang
LD = clang++ LD = clang++
AS = cc AS = cc
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) osxdriver.o sdlsnd_driver2.o OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) osxdriver.o sdlsnd_driver2.o
ARCHS = ppc, i386, ppc64, x86_64 ARCHS = ppc, i386, ppc64, x86_64
# OPTIONS FOR COMPILING C SOURCE # OPTIONS FOR COMPILING C SOURCE
CCOPTS = $(MACSUX) -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2 CCOPTS = $(MACSUX) -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2
# OPTIONS FOR COMPILING C++ SOURCE # OPTIONS FOR COMPILING C++ SOURCE
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2 $(MACSUX) CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2 $(MACSUX)
#SDK = -isysroot /Developer/SDKs/MacOSX10.5.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.7.sdk -isysroot /Developer/SDKs/MacOSX10.9.sdk -isysroot /Developer/SDKs/MacOSX10.10.sdk -isysroot /Developer/SDKs/MacOSX10.11.sdk #SDK = -isysroot /Developer/SDKs/MacOSX10.5.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.7.sdk -isysroot /Developer/SDKs/MacOSX10.9.sdk -isysroot /Developer/SDKs/MacOSX10.10.sdk -isysroot /Developer/SDKs/MacOSX10.11.sdk
#INCLUDE = -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -I/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Developer/SDKs/MacOSX10.10.sdk/usr/include -I/Developer/SDKs/MacOSX10.11.sdk/usr/include #INCLUDE = -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -I/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Developer/SDKs/MacOSX10.10.sdk/usr/include -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
#SDK = -isysroot /Developer/SDKs/MacOSX10.11.sdk #SDK = -isysroot /Developer/SDKs/MacOSX10.11.sdk
#INCLUDE = -I/Developer/SDKs/MacOSX10.11.sdk/usr/include #INCLUDE = -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
MACSUX = $(SDK) $(INCLUDE) -mmacosx-version-min=10.11 MACSUX = $(SDK) $(INCLUDE) -mmacosx-version-min=10.11
EXTRA_LIBS = -lSDL2 -lfreetype EXTRA_LIBS = -lSDL2 -lfreetype
OPTS = -DGSPORT_LITTLE_ENDIAN OPTS = -DGSPORT_LITTLE_ENDIAN
SUFFIX = SUFFIX =
LDFLAGS = LDFLAGS =
LDOPTS = -I. LDOPTS = -I.
EXTRA_SPECIALS = EXTRA_SPECIALS =

View File

@ -1,21 +1,21 @@
TARGET = gsportx TARGET = gsportx
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) xdriver.o OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) xdriver.o
CC = clang CC = clang
#CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -arch=i686 -DHAVE_SDL -DHAVE_TFE -DHAVE_ATBRIDGE -DTOGGLE_STATUS -I/usr/include/SDL -I/usr/include/freetype2 #CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -arch=i686 -DHAVE_SDL -DHAVE_TFE -DHAVE_ATBRIDGE -DTOGGLE_STATUS -I/usr/include/SDL -I/usr/include/freetype2
#CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -DHAVE_ATBRIDGE -I/usr/include/freetype2 -I/usr/include/SDL2 #CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -DHAVE_ATBRIDGE -I/usr/include/freetype2 -I/usr/include/SDL2
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2 -I/usr/local/include/freetype2 -L/usr/X11/lib CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2 -I/usr/local/include/freetype2 -L/usr/X11/lib
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2 CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2
OPTS = -DGSPORT_LITTLE_ENDIAN OPTS = -DGSPORT_LITTLE_ENDIAN
SUFFIX = SUFFIX =
NAME = gsportx NAME = gsportx
LDFLAGS = LDFLAGS =
LDOPTS = LDOPTS =
LD = g++ LD = g++
EXTRA_LIBS = -lX11 -lfreetype -lSDL2 -lpcap -lXext EXTRA_LIBS = -lX11 -lfreetype -lSDL2 -lpcap -lXext
EXTRA_SPECIALS = EXTRA_SPECIALS =
AS = cc AS = cc
PERL = perl PERL = perl
XOPTS = -I/usr/X11/include XOPTS = -I/usr/X11/include

Some files were not shown because too many files have changed in this diff Show More