mirror of
https://github.com/david-schmidt/gsport.git
synced 2025-01-15 15:34:02 +00:00
Initially merge Christopher Mason's changes in (build not working yet)
This commit is contained in:
parent
9969c4a416
commit
d4f8d4d606
254
src/Makefile
254
src/Makefile
@ -1,128 +1,126 @@
|
||||
# $Id: release_makefile_base,v 1.15 2003/11/21 20:00:42 kentd Exp kentd $
|
||||
|
||||
OBJECTS1 = adb.o clock.o config.o dis.o engine_c.o scc.o iwm.o \
|
||||
joystick_driver.o moremem.o paddles.o sim65816.o smartport.o \
|
||||
sound.o sound_driver.o video.o scc_socket_driver.o scc_windriver.o \
|
||||
scc_macdriver.o
|
||||
|
||||
include vars
|
||||
|
||||
.SUFFIXES: .dep .proto
|
||||
|
||||
AS = $(CC)
|
||||
|
||||
XLIBS = -L/usr/X11R6/lib
|
||||
PERL = perl
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
specials: 8inst_s 16inst_s 8size 16size 8inst_c 16inst_c size_c size_s
|
||||
|
||||
specials_clean:
|
||||
rm -f 8inst_s 16inst_s 8size 16size 8inst_c 16inst_c size_c size_s
|
||||
|
||||
|
||||
# Mac builds:
|
||||
gsportmac: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) -arch ppc $(OBJECTS) compile_time.o $(LDFLAGS) -o gsport $(EXTRA_LIBS) -prebind -framework Carbon -framework Quicktime
|
||||
mkdir -p ../GSPORT.app/Contents/Resources/English.lproj/main.nib
|
||||
mkdir -p ../GSPORT.app/Contents/MacOS
|
||||
mv gsport ../GSPORT.app/Contents/MacOS/GSPORTMAC
|
||||
echo "APPL????" > ../GSPORT.app/Contents/PkgInfo
|
||||
cp -f Info.plist ../GSPORT.app/Contents/
|
||||
cp -f info.nib ../GSPORT.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f classes.nib ../GSPORT.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f objects.xib ../GSPORT.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f kegsicon.icns ../GSPORT.app/Contents/Resources/
|
||||
cp -f 525.icns ../GSPORT.app/Contents/Resources/
|
||||
cp -f 2mg.icns ../GSPORT.app/Contents/Resources/
|
||||
touch '../GSPORT.app/Icon?'
|
||||
cp -f ../config.template ../config.txt
|
||||
|
||||
# Linux for X builds:
|
||||
gsportx: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(XLIBS) $(EXTRA_LIBS) -lX11
|
||||
mv gsportx ..
|
||||
cp -f ../config.template ../config.txt
|
||||
|
||||
# Cygwin for X builds:
|
||||
gsport.exe: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(XLIBS) $(EXTRA_LIBS) -lXext -lX11 -lm
|
||||
mv gsport.exe ..
|
||||
cp -f ../config.template ../config.txt
|
||||
|
||||
# Mingw32 (native windows) builds:
|
||||
gsportwin.exe: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(EXTRA_LIBS) -lwinmm -lgdi32 -ldsound -lcomctl32 -lws2_32
|
||||
mv $(NAME)$(SUFFIX) ..
|
||||
cp -f ../config.template ../config.txt
|
||||
|
||||
|
||||
8inst_c.h: instable.h
|
||||
$(PERL) make_inst c 8 instable.h > 8inst_c.h
|
||||
|
||||
16inst_c.h: instable.h
|
||||
$(PERL) make_inst c 16 instable.h > 16inst_c.h
|
||||
|
||||
size_c.h: size_tab.h
|
||||
$(PERL) make_size c size_tab.h > size_c.h
|
||||
|
||||
engine_c.o: 8inst_c.h 16inst_c.h size_c.h
|
||||
|
||||
8inst_s.h: instable.h
|
||||
$(PERL) make_inst s 8 instable.h > 8inst_s.h
|
||||
|
||||
16inst_s.h: instable.h
|
||||
$(PERL) make_inst s 16 instable.h > 16inst_s.h
|
||||
|
||||
size_s.h: size_tab.h
|
||||
$(PERL) make_size s size_tab.h > size_s.h
|
||||
|
||||
8size_s.h: size_tab.h
|
||||
$(PERL) make_size 8 size_tab.h > 8size_s.h
|
||||
|
||||
16size_s.h: size_tab.h
|
||||
$(PERL) make_size 16 size_tab.h > 16size_s.h
|
||||
|
||||
engine_s.o: 8inst_s.h 16inst_s.h 8size_s.h 16size_s.h size_s.h
|
||||
|
||||
.s.o:
|
||||
$(AS) -c $(OPTS) -I. $*.s
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CCOPTS) $(XOPTS) -c $(OPTS) -I. $*.c
|
||||
|
||||
partls: partls.c
|
||||
cc $(CCOPTS) $(XOPTS) $(OPTS) -o partls partls.c
|
||||
|
||||
to_pro: prodos.h prodos_protos.h to_pro.c
|
||||
cc $(CCOPTS) $(XOPTS) $(OPTS) -o to_pro to_pro.c
|
||||
|
||||
|
||||
compile_time.o: $(OBJECTS)
|
||||
|
||||
|
||||
# dependency stuff
|
||||
adb.o: adb.c adb.h defc.h defcomm.h iwm.h protos.h
|
||||
engine_c.o: 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.o: clock.c defc.h defcomm.h iwm.h protos.h
|
||||
compile_time.o: compile_time.c
|
||||
config.o: config.c defc.h defcomm.h iwm.h protos.h config.h
|
||||
dis.o: dis.c defc.h defcomm.h iwm.h protos.h disas.h
|
||||
scc.o: scc.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_socket_driver.o: scc_socket_driver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_windriver.o: scc_windriver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_macdriver.o: scc_macdriver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
iwm.o: iwm.c defc.h defcomm.h iwm.h protos.h iwm_35_525.h
|
||||
joystick_driver.o: joystick_driver.c defc.h defcomm.h iwm.h protos.h
|
||||
moremem.o: moremem.c defc.h defcomm.h iwm.h protos.h
|
||||
paddles.o: paddles.c defc.h defcomm.h iwm.h protos.h
|
||||
sim65816.o: sim65816.c defc.h defcomm.h iwm.h protos.h
|
||||
smartport.o: smartport.c defc.h defcomm.h iwm.h protos.h
|
||||
sound.o: sound.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
sound_driver.o: sound_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
video.o: video.c defc.h defcomm.h iwm.h protos.h superhires.h kegsfont.h
|
||||
macdriver.o: macdriver.c defc.h defcomm.h iwm.h protos.h protos_macdriver.h
|
||||
macsnd_driver.o: macsnd_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
windriver.o: windriver.c defc.h defcomm.h iwm.h protos.h protos_windriver.h winresource.h
|
||||
win32snd_driver.o: win32snd_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
# $Id: release_makefile_base,v 1.15 2003/11/21 20:00:42 kentd Exp kentd $
|
||||
|
||||
OBJECTS1 = adb.o clock.o config.o dis.o engine_c.o scc.o iwm.o \
|
||||
joystick_driver.o moremem.o paddles.o sim65816.o smartport.o \
|
||||
sound.o sound_driver.o video.o scc_socket_driver.o scc_windriver.o \
|
||||
scc_macdriver.o
|
||||
|
||||
include vars
|
||||
|
||||
.SUFFIXES: .dep .proto
|
||||
|
||||
AS = $(CC)
|
||||
|
||||
XLIBS = -L/usr/X11R6/lib
|
||||
PERL = perl
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
specials: 8inst_s 16inst_s 8size 16size 8inst_c 16inst_c size_c size_s
|
||||
|
||||
specials_clean:
|
||||
rm -f 8inst_s 16inst_s 8size 16size 8inst_c 16inst_c size_c size_s
|
||||
|
||||
|
||||
# Mac builds:
|
||||
kegsmac: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) -arch ppc $(OBJECTS) compile_time.o $(LDFLAGS) -o kegsmac $(EXTRA_LIBS) -prebind -framework Carbon -framework Quicktime
|
||||
mkdir -p ../KEGSMAC.app/Contents/Resources/English.lproj/main.nib
|
||||
mkdir -p ../KEGSMAC.app/Contents/MacOS
|
||||
mv kegsmac ../KEGSMAC.app/Contents/MacOS/KEGSMAC
|
||||
echo "APPL????" > ../KEGSMAC.app/Contents/PkgInfo
|
||||
cp -f Info.plist ../KEGSMAC.app/Contents/
|
||||
cp -f info.nib ../KEGSMAC.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f classes.nib ../KEGSMAC.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f objects.xib ../KEGSMAC.app/Contents/Resources/English.lproj/main.nib
|
||||
cp -f kegsicon.icns ../KEGSMAC.app/Contents/Resources/
|
||||
cp -f 525.icns ../KEGSMAC.app/Contents/Resources/
|
||||
cp -f 2mg.icns ../KEGSMAC.app/Contents/Resources/
|
||||
touch '../KEGSMAC.app/Icon?'
|
||||
|
||||
# Linux for X builds:
|
||||
xkegs: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(XLIBS) $(EXTRA_LIBS) -lX11
|
||||
mv xkegs ..
|
||||
|
||||
# Cygwin for X builds:
|
||||
kegs.exe: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(XLIBS) $(EXTRA_LIBS) -lXext -lX11 -lm
|
||||
mv kegs.exe ..
|
||||
|
||||
# Mingw32 (native windows) builds:
|
||||
kegswin.exe: $(OBJECTS) compile_time.o
|
||||
$(CC) $(CCOPTS) $(LDOPTS) $(OBJECTS) compile_time.o $(LDFLAGS) -o $(NAME)$(SUFFIX) $(EXTRA_LIBS) -lwinmm -lgdi32 -ldsound -lcomctl32 -lcomdlg32 -lws2_32
|
||||
mv $(NAME)$(SUFFIX) ..
|
||||
|
||||
|
||||
8inst_c.h: instable.h
|
||||
$(PERL) make_inst c 8 instable.h > 8inst_c.h
|
||||
|
||||
16inst_c.h: instable.h
|
||||
$(PERL) make_inst c 16 instable.h > 16inst_c.h
|
||||
|
||||
size_c.h: size_tab.h
|
||||
$(PERL) make_size c size_tab.h > size_c.h
|
||||
|
||||
engine_c.o: 8inst_c.h 16inst_c.h size_c.h
|
||||
|
||||
8inst_s.h: instable.h
|
||||
$(PERL) make_inst s 8 instable.h > 8inst_s.h
|
||||
|
||||
16inst_s.h: instable.h
|
||||
$(PERL) make_inst s 16 instable.h > 16inst_s.h
|
||||
|
||||
size_s.h: size_tab.h
|
||||
$(PERL) make_size s size_tab.h > size_s.h
|
||||
|
||||
8size_s.h: size_tab.h
|
||||
$(PERL) make_size 8 size_tab.h > 8size_s.h
|
||||
|
||||
16size_s.h: size_tab.h
|
||||
$(PERL) make_size 16 size_tab.h > 16size_s.h
|
||||
|
||||
engine_s.o: 8inst_s.h 16inst_s.h 8size_s.h 16size_s.h size_s.h
|
||||
|
||||
.s.o:
|
||||
$(AS) -c $(OPTS) -I. $*.s
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CCOPTS) $(XOPTS) -c $(OPTS) -I. $*.c
|
||||
|
||||
partls: partls.c
|
||||
cc $(CCOPTS) $(XOPTS) $(OPTS) -o partls partls.c
|
||||
|
||||
to_pro: prodos.h prodos_protos.h to_pro.c
|
||||
cc $(CCOPTS) $(XOPTS) $(OPTS) -o to_pro to_pro.c
|
||||
|
||||
kegs32.o: win32.rc winresource.h
|
||||
windres win32.rc -o kegs32.o
|
||||
|
||||
compile_time.o: $(OBJECTS)
|
||||
|
||||
|
||||
# dependency stuff
|
||||
adb.o: adb.c adb.h defc.h defcomm.h iwm.h protos.h
|
||||
engine_c.o: 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.o: clock.c defc.h defcomm.h iwm.h protos.h
|
||||
compile_time.o: compile_time.c
|
||||
config.o: config.c defc.h defcomm.h iwm.h protos.h config.h
|
||||
dis.o: dis.c defc.h defcomm.h iwm.h protos.h disas.h
|
||||
scc.o: scc.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_socket_driver.o: scc_socket_driver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_windriver.o: scc_windriver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
scc_macdriver.o: scc_macdriver.c defc.h defcomm.h iwm.h protos.h scc.h
|
||||
iwm.o: iwm.c defc.h defcomm.h iwm.h protos.h iwm_35_525.h
|
||||
joystick_driver.o: joystick_driver.c defc.h defcomm.h iwm.h protos.h
|
||||
moremem.o: moremem.c defc.h defcomm.h iwm.h protos.h
|
||||
paddles.o: paddles.c defc.h defcomm.h iwm.h protos.h
|
||||
sim65816.o: sim65816.c defc.h defcomm.h iwm.h protos.h
|
||||
smartport.o: smartport.c defc.h defcomm.h iwm.h protos.h
|
||||
sound.o: sound.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
sound_driver.o: sound_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
video.o: video.c defc.h defcomm.h iwm.h protos.h superhires.h kegsfont.h
|
||||
macdriver.o: macdriver.c defc.h defcomm.h iwm.h protos.h protos_macdriver.h
|
||||
macsnd_driver.o: macsnd_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
windriver.o: windriver.c defc.h defcomm.h iwm.h protos.h protos_windriver.h winresource.h kegs32.o
|
||||
win32snd_driver.o: win32snd_driver.c defc.h defcomm.h iwm.h protos.h sound.h
|
||||
|
74
src/README.ethernet.txt
Normal file
74
src/README.ethernet.txt
Normal file
@ -0,0 +1,74 @@
|
||||
Ethernet support HOW-TO
|
||||
-----------------------
|
||||
|
||||
Acknowledgment:
|
||||
---------------
|
||||
|
||||
Uthernet (TFE) support in KEGS was made possible by implementing the GPL source written by Spiro Trikaliotis for the Vice emulator - http://www.viceteam.org/ This version of KEGS contains the latest code from VICE 2.1.
|
||||
|
||||
Details:
|
||||
|
||||
Right now Uthernet emulation only works under Windows. Future support for PCap under OS X and Linux is planned.
|
||||
In order to use Uthernet emulation, you must install WinPCap ( http://www.WinPcap.org/install/default.htm ) and
|
||||
have a wired ethernet connecton on the host computer.
|
||||
|
||||
|
||||
KEGS Setup:
|
||||
-----------
|
||||
|
||||
After KEGS starts, press F4 to enter the text based menu and select the "Ethernet Card Configuration" option.
|
||||
|
||||
By default, Uthernet emulation is turned off, enable it by setting "Uthernet Card in Slot 3"to "On".
|
||||
|
||||
Next, select the host interface you wish to use to communicate with the outside world. A list of available
|
||||
interfaces is provided on screen. For most the default of interface "0" is correct.
|
||||
|
||||
Return back to the main menu and save you configuration for good measure. Due to limitations, you must exit
|
||||
and restart KEGS for the changes you made to take effect. Next is configuring the Apple IIgs side of things.
|
||||
|
||||
GS/OS Setup:
|
||||
------------
|
||||
|
||||
In order to use TCP/IP connectivity under GS/OS, you have to install the latest version of Marinetti and the
|
||||
Uthernet Link Layer.
|
||||
|
||||
First download and install the latest version of Marinetti 3.0 available at:
|
||||
http://www.apple2.org/marinetti/Marinetti3.0b1.SHK
|
||||
|
||||
Then install the latest TCPIP INIT available at
|
||||
http://www.apple2.org/marinetti/TCPIP30b3.SHK
|
||||
|
||||
Just extract and copy the file to the "System.Setup" folder in your GS/OS system folder, overwriting the existing file
|
||||
|
||||
Last, install the latest Uthernet Link Layer (1.0.1b5) available at:
|
||||
http://www.wannop.info/speccie/uthernetll.bxy
|
||||
|
||||
Just extract and copy the file to the "TCPIP" folder in your GS/OS system folder.
|
||||
|
||||
After copying over all the files, reboot the emulated IIgs. Once at the desktop, bring up the graphical control
|
||||
panel available in the Apple menu and double click the "TCP/IP" icon.
|
||||
|
||||
Click on "Setup Connection..." Select the "Uthernet" link layer from the drop down and then click "Configure..."
|
||||
|
||||
Set "Lan Slot:" to "3", check off the DHCP option and then click "Save". Click "OK" to leave the setup dialog.
|
||||
|
||||
You should be able to click "Connect to network" and successfully connect to your TCP/IP netowork.
|
||||
|
||||
From this point on, you are free to run any TCP/IP aware GS/OS applications.
|
||||
|
||||
The following applications have been tested and seem to work fine:
|
||||
------------------------------------------------------------------
|
||||
|
||||
Spectrum Automated File Exchange 2.1.9 (FTP client, use passive mode)
|
||||
Telnet application included with Marinetti
|
||||
|
||||
The following applications have been tested and DO NOT work:
|
||||
------------------------------------------------------------
|
||||
|
||||
Casper web server: It will not serve web pages. This is likely a limitation of WinPCap.
|
||||
|
||||
A note about 8-bit applications:
|
||||
--------------------------------
|
||||
|
||||
Uthernet enabled versions of Contiki seem to work fine with KEGS. Other 8-bit software should work fine but
|
||||
are untested at this time.
|
BIN
src/SDL.dll
Normal file
BIN
src/SDL.dll
Normal file
Binary file not shown.
196
src/config.c
196
src/config.c
@ -24,6 +24,11 @@
|
||||
#include "config.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#if defined (WIN32) || (WIN64)
|
||||
#define snprintf _snprintf
|
||||
typedef unsigned int mode_t;
|
||||
#endif
|
||||
|
||||
extern int Verbose;
|
||||
extern word32 g_vbl_count;
|
||||
extern Iwm iwm;
|
||||
@ -59,6 +64,21 @@ extern int g_joystick_trim_amount_x;
|
||||
extern int g_joystick_trim_amount_y;
|
||||
extern int g_swap_paddles;
|
||||
extern int g_invert_paddles;
|
||||
extern int g_ethernet;
|
||||
extern int g_ethernet_interface;
|
||||
extern int g_parallel;
|
||||
extern int g_parallel_out_masking;
|
||||
extern int g_printer;
|
||||
extern int g_printer_dpi;
|
||||
extern char* g_printer_output;
|
||||
extern int g_printer_multipage;
|
||||
extern char* g_printer_font_roman;
|
||||
extern char* g_printer_font_sans;
|
||||
extern char* g_printer_font_prestige;
|
||||
extern char* g_printer_font_courier;
|
||||
extern char* g_printer_font_script;
|
||||
extern char* g_printer_font_ocra;
|
||||
extern int g_printer_timeout;
|
||||
|
||||
extern int g_screen_index[];
|
||||
extern word32 g_full_refresh_needed;
|
||||
@ -68,7 +88,6 @@ extern int g_new_a2_stat_cur_line;
|
||||
|
||||
extern int g_key_down;
|
||||
extern const char g_kegs_version_str[];
|
||||
|
||||
int g_config_control_panel = 0;
|
||||
char g_config_kegs_name[1024];
|
||||
char g_cfg_cwd_str[CFG_PATH_MAX] = { 0 };
|
||||
@ -101,6 +120,7 @@ int g_cfg_curs_mousetext = 0;
|
||||
|
||||
int g_cfg_opts_vals[CFG_MAX_OPTS];
|
||||
char g_cfg_opts_strs[CFG_MAX_OPTS][CFG_OPT_MAXSTR];
|
||||
char g_cfg_opts_strvals[CFG_MAX_OPTS][CFG_OPT_MAXSTR];
|
||||
char g_cfg_opt_buf[CFG_OPT_MAXSTR];
|
||||
|
||||
char *g_cfg_rom_path = "ROM";
|
||||
@ -142,7 +162,8 @@ Cfg_menu g_cfg_disk_menu[] = {
|
||||
Cfg_menu g_cfg_joystick_menu[] = {
|
||||
{ "Joystick Configuration", g_cfg_joystick_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Joystick Emulation,0,Keypad Joystick,1,Mouse Joystick,2,Native Joystick 1,"
|
||||
"3,Native Joystick 2", KNMP(g_joystick_type), CFGTYPE_INT },
|
||||
"3,Native Joystick 2,4,Disable Joystick",
|
||||
KNMP(g_joystick_type), CFGTYPE_INT },
|
||||
{ "Joystick Scale X,0x100,Standard,0x119,+10%,0x133,+20%,"
|
||||
"0x150,+30%,0xb0,-30%,0xcd,-20%,0xe7,-10%",
|
||||
KNMP(g_joystick_scale_factor_x), CFGTYPE_INT },
|
||||
@ -185,12 +206,64 @@ Cfg_menu g_cfg_serial_menu[] = {
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_parallel_menu[] = {
|
||||
{ "Parallel Card Configuration", g_cfg_parallel_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Parallel Card in Slot 1,0,Off,1,On",
|
||||
KNMP(g_parallel), CFGTYPE_INT },
|
||||
{ "Parallel Output,0,Send full 8-bit data,1,Mask off high bit",
|
||||
KNMP(g_parallel_out_masking), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_ethernet_menu[] = {
|
||||
{ "Ethernet Card Configuration", g_cfg_ethernet_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Uthernet Card in Slot 3,0,Off,1,On",
|
||||
KNMP(g_ethernet), CFGTYPE_INT },
|
||||
{ "Use Interface Number,0,0,1,1,2,2,3,3,4,4",
|
||||
KNMP(g_ethernet_interface), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_printer_menu[] = {
|
||||
{ "Virtual Printer Configuration", g_cfg_ethernet_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Printer Type,0,Epson LQ",
|
||||
KNMP(g_printer), CFGTYPE_INT },
|
||||
{ "Printer DPI,60,60x60 dpi,180,180x180 dpi,360,360x360 dpi",
|
||||
KNMP(g_printer_dpi), CFGTYPE_INT },
|
||||
{ "Printer Output Type,bmp,Windows Bitmap,ps,Postscript (B&W),printer,Direct to host printer",
|
||||
KNMP(g_printer_output), CFGTYPE_STR },
|
||||
{ "Multipage Files? (PS Only),0,No,1,Yes",
|
||||
KNMP(g_printer_multipage), CFGTYPE_INT },
|
||||
{ "Printer Timeout,0,Never,2,2 sec.,15,15 sec.,30,30 sec.,60, 1 min.",
|
||||
KNMP(g_printer_timeout), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Epson LQ Fonts", 0, 0, 0, 0 },
|
||||
{ "--------------", 0, 0, 0, 0 },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Roman", KNMP(g_printer_font_roman), CFGTYPE_FILE },
|
||||
{ "Sans Serif", KNMP(g_printer_font_sans), CFGTYPE_FILE },
|
||||
{ "Courier", KNMP(g_printer_font_courier), CFGTYPE_FILE },
|
||||
{ "Prestige", KNMP(g_printer_font_prestige), CFGTYPE_FILE },
|
||||
{ "Script", KNMP(g_printer_font_script), CFGTYPE_FILE },
|
||||
{ "OCR A/B", KNMP(g_printer_font_ocra), CFGTYPE_FILE },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_main_menu[] = {
|
||||
{ "GSport Configuration", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Disk Configuration", g_cfg_disk_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Joystick Configuration", g_cfg_joystick_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "ROM File Selection", g_cfg_rom_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Serial Port Configuration", g_cfg_serial_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Ethernet Card Configuration", g_cfg_ethernet_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Parallel Card Configuration", g_cfg_parallel_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Printer Configuration", g_cfg_printer_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Force X-windows display depth", KNMP(g_force_depth), CFGTYPE_INT },
|
||||
{ "Auto-update configuration file,0,Manual,1,Immediately",
|
||||
KNMP(g_config_kegs_auto_update), CFGTYPE_INT },
|
||||
@ -241,7 +314,7 @@ int g_cfg_file_pathfield = 0;
|
||||
const char *g_kegs_rom_names[] = { "ROM", "ROM", "ROM.01", "ROM.03", 0 };
|
||||
/* First entry is special--it will be overwritten by g_cfg_rom_path */
|
||||
|
||||
const char *g_kegs_c1rom_names[] = { 0 };
|
||||
const char *g_kegs_c1rom_names[] = { "parallel.rom" };
|
||||
const char *g_kegs_c2rom_names[] = { 0 };
|
||||
const char *g_kegs_c3rom_names[] = { 0 };
|
||||
const char *g_kegs_c4rom_names[] = { 0 };
|
||||
@ -331,6 +404,15 @@ config_init_menus(Cfg_menu *menuptr)
|
||||
defptr->intval = val;
|
||||
menuptr->defptr = &(defptr->intval);
|
||||
break;
|
||||
case CFGTYPE_STR:
|
||||
str_ptr = (char **)menuptr->ptr;
|
||||
str = *str_ptr;
|
||||
// We need to malloc this string since all
|
||||
// string values must be dynamically alloced
|
||||
defptr->strval = str; // this can have a copy
|
||||
*str_ptr = kegs_malloc_str(str);
|
||||
menuptr->defptr = &(defptr->strval);
|
||||
break;
|
||||
case CFGTYPE_FILE:
|
||||
str_ptr = (char **)menuptr->ptr;
|
||||
str = *str_ptr;
|
||||
@ -437,6 +519,37 @@ cfg_text_screen_dump()
|
||||
fclose(ofile);
|
||||
}
|
||||
|
||||
void
|
||||
cfg_get_tfe_name()
|
||||
{
|
||||
int i = 0;
|
||||
char *ppname = NULL;
|
||||
char *ppdes = NULL;
|
||||
cfg_htab_vtab(0,9);
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
cfg_printf("Interface List:\n---------------");
|
||||
while(tfe_enumadapter(&ppname,&ppdes))
|
||||
{
|
||||
cfg_htab_vtab(0, 11+i);
|
||||
cfg_printf("%2d: %s",i,ppdes);
|
||||
i++;
|
||||
lib_free(ppname);
|
||||
lib_free(ppdes);
|
||||
}
|
||||
tfe_enumadapter_close();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
cfg_printf("ERROR: Install/Enable WinPcap for Ethernet Support!!");
|
||||
#else
|
||||
cfg_printf("ERROR: Install/Enable LibPcap for Ethernet Support!!");
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
config_vbl_update(int doit_3_persec)
|
||||
{
|
||||
@ -523,6 +636,13 @@ config_parse_option(char *buf, int pos, int len, int line)
|
||||
iptr = (int *)menuptr->ptr;
|
||||
*iptr = val;
|
||||
break;
|
||||
case CFGTYPE_STR:
|
||||
strptr = (char **)menuptr->ptr;
|
||||
if(strptr && *strptr) {
|
||||
free(*strptr);
|
||||
}
|
||||
*strptr = kegs_malloc_str(&buf[pos]);
|
||||
break;
|
||||
case CFGTYPE_FILE:
|
||||
strptr = (char **)menuptr->ptr;
|
||||
if(strptr && *strptr) {
|
||||
@ -686,6 +806,7 @@ config_load_roms()
|
||||
continue;
|
||||
}
|
||||
close(fd);
|
||||
fd = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1062,6 +1183,14 @@ config_write_config_kegs_file()
|
||||
curval);
|
||||
}
|
||||
}
|
||||
if(type == CFGTYPE_STR) {
|
||||
curstr = *((char **)menuptr->ptr);
|
||||
defstr = *((char **)menuptr->defptr);
|
||||
if(strcmp(curstr, defstr) != 0) {
|
||||
fprintf(fconf, "%s = %s\n", menuptr->name_str,
|
||||
curstr);
|
||||
}
|
||||
}
|
||||
if(type == CFGTYPE_FILE) {
|
||||
curstr = *((char **)menuptr->ptr);
|
||||
defstr = *((char **)menuptr->defptr);
|
||||
@ -1891,6 +2020,7 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
char *curstr, *defstr;
|
||||
char *str;
|
||||
char *outstr;
|
||||
char *strval;
|
||||
int *iptr;
|
||||
int val;
|
||||
int num_opts;
|
||||
@ -1975,8 +2105,16 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
my_exit(1);
|
||||
}
|
||||
} else {
|
||||
if (type == CFGTYPE_INT)
|
||||
{
|
||||
val = strtoul(valbuf, 0, 0);
|
||||
g_cfg_opts_vals[num_opts] = val;
|
||||
}
|
||||
|
||||
if (type == CFGTYPE_STR)
|
||||
{
|
||||
strncpy(&(g_cfg_opts_strvals[num_opts][0]),&(valbuf[0]),CFG_OPT_MAXSTR);
|
||||
}
|
||||
outstr = &(g_cfg_opts_strs[num_opts][0]);
|
||||
opt_get_str = 1;
|
||||
}
|
||||
@ -2005,6 +2143,16 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
g_cfg_opt_buf[4] = '\t';
|
||||
}
|
||||
}
|
||||
if(type == CFGTYPE_STR) {
|
||||
str_ptr = (char **)menuptr->ptr;
|
||||
curstr = *str_ptr;
|
||||
str_ptr = (char **)menuptr->defptr;
|
||||
defstr = *str_ptr;
|
||||
if(strcmp(curstr,defstr) == 0) {
|
||||
g_cfg_opt_buf[3] = 'D'; /* checkmark */
|
||||
g_cfg_opt_buf[4] = '\t';
|
||||
}
|
||||
}
|
||||
if(type == CFGTYPE_FILE) {
|
||||
str_ptr = (char **)menuptr->ptr;
|
||||
curstr = *str_ptr;
|
||||
@ -2039,6 +2187,18 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(type == CFGTYPE_STR) {
|
||||
g_cfg_opt_buf[bufpos++] = ' ';
|
||||
g_cfg_opt_buf[bufpos++] = '=';
|
||||
g_cfg_opt_buf[bufpos++] = ' ';
|
||||
g_cfg_opt_buf[bufpos] = 0;
|
||||
for(i = 0; i < num_opts; i++) {
|
||||
if(!strcmp(curstr,g_cfg_opts_strvals[i])) {
|
||||
opt_num = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(change != 0) {
|
||||
if(type == CFGTYPE_INT) {
|
||||
@ -2058,6 +2218,23 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
iptr = (int *)menuptr->ptr;
|
||||
*iptr = curval;
|
||||
}
|
||||
if(type == CFGTYPE_STR) {
|
||||
if(num_opts > 0) {
|
||||
opt_num += change;
|
||||
if(opt_num >= num_opts) {
|
||||
opt_num = 0;
|
||||
}
|
||||
if(opt_num < 0) {
|
||||
opt_num = num_opts - 1;
|
||||
}
|
||||
curstr = g_cfg_opts_strvals[opt_num];
|
||||
} else {
|
||||
//curstr += change;
|
||||
/* HACK: min_val, max_val testing here */
|
||||
}
|
||||
str_ptr = (char **)menuptr->ptr;
|
||||
*str_ptr = curstr;
|
||||
}
|
||||
g_config_kegs_update_needed = 1;
|
||||
}
|
||||
|
||||
@ -2073,6 +2250,10 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
||||
if(type == CFGTYPE_INT) {
|
||||
str = &(g_cfg_opts_strs[0][0]);
|
||||
snprintf(str, CFG_OPT_MAXSTR, "%d", curval);
|
||||
} else if (type == CFGTYPE_STR) {
|
||||
str = &(g_cfg_opts_strs[0][0]);
|
||||
printf("curstr is: %s str is: %s\n", curstr,str);
|
||||
snprintf(str, CFG_OPT_MAXSTR, "%s", curstr);
|
||||
} else if (type == CFGTYPE_DISK) {
|
||||
str = &(g_cfg_opts_strs[0][0]),
|
||||
cfg_get_disk_name(str, CFG_OPT_MAXSTR, type_ext, 1);
|
||||
@ -2297,7 +2478,7 @@ cfg_dirent_sortfn(const void *obj1, const void *obj2)
|
||||
direntptr1 = (const Cfg_dirent *)obj1;
|
||||
direntptr2 = (const Cfg_dirent *)obj2;
|
||||
#if defined(MAC) || defined(_WIN32)
|
||||
ret = strcasecmp(direntptr1->name, direntptr2->name);
|
||||
ret = _stricmp(direntptr1->name, direntptr2->name);
|
||||
#else
|
||||
ret = strcmp(direntptr1->name, direntptr2->name);
|
||||
#endif
|
||||
@ -2966,6 +3147,13 @@ config_control_panel()
|
||||
if(g_cfg_slotdrive >= 0) {
|
||||
cfg_file_draw();
|
||||
}
|
||||
/*HACK eh, at least I think it is. Display the available ethernet interfaces
|
||||
when in the ethernet control panel. This is the only way one can customize a menu pane.
|
||||
Kent did it with the directory browser, so why not.*/
|
||||
if(menuptr == g_cfg_ethernet_menu)
|
||||
{
|
||||
cfg_get_tfe_name();
|
||||
}
|
||||
|
||||
key = -1;
|
||||
while(g_config_control_panel) {
|
||||
|
@ -36,6 +36,7 @@ const char rcsid_config_h[] = "@(#)$KmKId: config.h,v 1.9 2004-11-12 23:10:28-05
|
||||
#define CFGTYPE_DISK 3
|
||||
#define CFGTYPE_FUNC 4
|
||||
#define CFGTYPE_FILE 5
|
||||
#define CFGTYPE_STR 6
|
||||
/* CFGTYPE limited to just 4 bits: 0-15 */
|
||||
|
||||
/* Cfg_menu, Cfg_dirent and Cfg_listhdr are defined in defc.h */
|
||||
|
@ -53,6 +53,9 @@ extern byte *g_memory_ptr;
|
||||
extern byte *g_rom_fc_ff_ptr;
|
||||
extern byte *g_rom_cards_ptr;
|
||||
extern byte *g_dummy_memory1_ptr;
|
||||
extern int g_c068_statereg;
|
||||
unsigned char ioslotsel = 0;
|
||||
unsigned char iostrobe = 0;
|
||||
|
||||
extern int g_num_breakpoints;
|
||||
extern word32 g_breakpts[];
|
||||
@ -152,12 +155,12 @@ extern Page_info page_info_rd_wr[];
|
||||
extern word32 slow_mem_changed[];
|
||||
|
||||
#define GET_MEMORY8(addr,dest) \
|
||||
addr_latch = (addr); \
|
||||
CYCLES_PLUS_1; \
|
||||
addr_latch = (addr);\
|
||||
CYCLES_PLUS_1; \
|
||||
stat = GET_PAGE_INFO_RD(((addr) >> 8) & 0xffff); \
|
||||
wstat = PTR2WORD(stat) & 0xff; \
|
||||
ptr = stat - wstat + ((addr) & 0xff); \
|
||||
if(wstat & (1 << (31 - BANK_IO_BIT))) { \
|
||||
if(wstat & (1 << (31 - BANK_IO_BIT)) || iostrobe == 1) { \
|
||||
fcycles_tmp1 = fcycles; \
|
||||
dest = get_memory8_io_stub((addr), stat, \
|
||||
&fcycles_tmp1, fplus_x_m1); \
|
||||
@ -374,13 +377,13 @@ get_memory8_io_stub(word32 addr, byte *stat, double *fcycs_ptr,
|
||||
double fcycles;
|
||||
word32 wstat;
|
||||
byte *ptr;
|
||||
|
||||
wstat = PTR2WORD(stat) & 0xff;
|
||||
|
||||
if(wstat & BANK_BREAK) {
|
||||
check_breakpoints(addr);
|
||||
}
|
||||
fcycles = *fcycs_ptr;
|
||||
if(wstat & BANK_IO2_TMP) {
|
||||
if(wstat & BANK_IO2_TMP || iostrobe == 1) {
|
||||
FCYCLES_ROUND;
|
||||
*fcycs_ptr = fcycles;
|
||||
return get_memory_io((addr), fcycs_ptr);
|
||||
@ -403,7 +406,6 @@ get_memory16_pieces_stub(word32 addr, byte *stat, double *fcycs_ptr,
|
||||
word32 addr_latch;
|
||||
word32 ret;
|
||||
word32 tmp1;
|
||||
|
||||
fcycles = *fcycs_ptr;
|
||||
fplus_1 = fplus_ptr->plus_1;
|
||||
fplus_x_m1 = fplus_ptr->plus_x_minus_1;
|
||||
@ -431,7 +433,6 @@ get_memory24_pieces_stub(word32 addr, byte *stat, double *fcycs_ptr,
|
||||
word32 ret;
|
||||
word32 tmp1;
|
||||
word32 tmp2;
|
||||
|
||||
fcycles = *fcycs_ptr;
|
||||
fplus_1 = fplus_ptr->plus_1;
|
||||
fplus_x_m1 = fplus_ptr->plus_x_minus_1;
|
||||
@ -506,7 +507,6 @@ set_memory16_pieces_stub(word32 addr, word32 val, double *fcycs_ptr,
|
||||
double fcycles, fcycles_tmp1;
|
||||
word32 addrp1;
|
||||
word32 wstat;
|
||||
|
||||
fcycles = *fcycs_ptr;
|
||||
SET_MEMORY8(addr, val);
|
||||
addrp1 = addr + 1;
|
||||
@ -598,7 +598,6 @@ set_memory_c(word32 addr, word32 val, int cycs)
|
||||
double fplus_1;
|
||||
double fplus_x_m1;
|
||||
word32 wstat;
|
||||
|
||||
fcycles = g_cur_dcycs - g_last_vbl_dcycs;
|
||||
fplus_1 = 0;
|
||||
fplus_x_m1 = 0;
|
||||
@ -886,7 +885,7 @@ get_remaining_operands(word32 addr, word32 opcode, word32 psr, Fplus *fplus_ptr)
|
||||
FINISH(RET_C70D, 0); \
|
||||
} \
|
||||
} \
|
||||
if(wstat & (1 << (31 - BANK_IO2_BIT))) { \
|
||||
if(wstat & (1 << (31 - BANK_IO2_BIT)) || iostrobe == 1) { \
|
||||
FCYCLES_ROUND; \
|
||||
fcycles_tmp1 = fcycles; \
|
||||
opcode = get_memory_io((addr), &fcycles_tmp1); \
|
||||
|
@ -179,6 +179,11 @@ joystick_init()
|
||||
}
|
||||
}
|
||||
|
||||
if (g_joystick_native_type1<0 && g_joystick_native_type2 <0) {
|
||||
printf ("No joystick is attached\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < 4; i++) {
|
||||
g_paddle_val[i] = 32767;
|
||||
}
|
||||
|
26
src/kegs.sln
Normal file
26
src/kegs.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kegs", "kegs.vcproj", "{4E045654-5CE8-482F-AE4C-5DD99C943461}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Debug|x64.Build.0 = Debug|x64
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Release|Win32.Build.0 = Release|Win32
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Release|x64.ActiveCfg = Release|x64
|
||||
{4E045654-5CE8-482F-AE4C-5DD99C943461}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
1238
src/kegs.vcproj
Normal file
1238
src/kegs.vcproj
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/kegs32.aps
Normal file
BIN
src/kegs32.aps
Normal file
Binary file not shown.
BIN
src/kegs32.ico
Normal file
BIN
src/kegs32.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
209
src/kegs32.rc
Normal file
209
src/kegs32.rc
Normal file
@ -0,0 +1,209 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource."
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_KEGS32 MENU
|
||||
BEGIN
|
||||
POPUP "&Emulator"
|
||||
BEGIN
|
||||
MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK
|
||||
MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET
|
||||
MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Flush Printer", ID_FILE_FLUSHPRINTER
|
||||
MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK
|
||||
MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "Key Commands", ID_HELP_KEY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDC_KEGS32 BITMAP "wintoolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_ACCEL ACCELERATORS
|
||||
BEGIN
|
||||
VK_F1, ID_FILE_DISK, VIRTKEY, ALT, NOINVERT
|
||||
VK_F4, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDC_KEGS32 ICON "kegs32.ico"
|
||||
KEGS32_ICON ICON "kegs32.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 207, 82
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,78,61,50,14
|
||||
LTEXT "KEGS32: 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 "KEGS32_ICON",IDC_STATIC,7,7,20,20
|
||||
END
|
||||
|
||||
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Disk Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,161,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
|
||||
LTEXT "S5D1",IDC_STATIC,19,46,19,8
|
||||
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
|
||||
LTEXT "S5D2",IDC_STATIC,19,62,19,8
|
||||
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
|
||||
LTEXT "S6D1",IDC_STATIC,19,80,19,8
|
||||
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
|
||||
LTEXT "S6D2",IDC_STATIC,19,98,19,8
|
||||
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
|
||||
LTEXT "S7D1",IDC_STATIC,19,118,19,8
|
||||
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
|
||||
LTEXT "S7D2",IDC_STATIC,19,137,19,8
|
||||
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
|
||||
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
|
||||
END
|
||||
|
||||
IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Speed Control"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
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 "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
|
||||
EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,133,107,50,15
|
||||
PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15
|
||||
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
|
||||
ICON IDC_KEGS32,IDC_STATIC,14,19,21,20
|
||||
END
|
||||
|
||||
IDD_KEGS32_KEY DIALOGEX 0, 0, 186, 172
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Help About Key Commands"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,151,50,14
|
||||
LTEXT "KEGS32 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 "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
|
||||
LTEXT "For more information, please consult the readme.kegs file",IDC_STATIC,21,124,144,19
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_DISK "Disk Configuration"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SPEED_1MHZ "Set Speed to 1 Mhz"
|
||||
ID_SPEED_2MHZ "Set Speed to 2.5 Mhz"
|
||||
ID_SPEED_FMHZ "Set Speed to as fast as possible"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
134
src/moremem.c
134
src/moremem.c
@ -30,6 +30,9 @@ extern byte *g_dummy_memory1_ptr;
|
||||
extern byte *g_slow_memory_ptr;
|
||||
extern byte *g_rom_fc_ff_ptr;
|
||||
extern byte *g_rom_cards_ptr;
|
||||
extern byte *g_grappler_rom;
|
||||
extern unsigned char ioslotsel;
|
||||
extern unsigned char iostrobe;
|
||||
|
||||
extern word32 slow_mem_changed[];
|
||||
|
||||
@ -41,8 +44,9 @@ extern Page_info page_info_rd_wr[];
|
||||
extern int Verbose;
|
||||
extern int g_rom_version;
|
||||
extern int g_user_page2_shadow;
|
||||
extern int g_parallel;
|
||||
|
||||
|
||||
char c;
|
||||
/* from iwm.c */
|
||||
int g_num_shadow_all_banks = 0;
|
||||
|
||||
@ -275,7 +279,7 @@ fixup_intcx()
|
||||
int start_k;
|
||||
word32 mask;
|
||||
int j, k;
|
||||
|
||||
int test1;
|
||||
rom10000 = &(g_rom_fc_ff_ptr[0x30000]);
|
||||
|
||||
no_io_shadow = (g_c035_shadow_reg & 0x40);
|
||||
@ -311,25 +315,27 @@ fixup_intcx()
|
||||
}
|
||||
}
|
||||
for(j = 0xc8; j < 0xd0; j++) {
|
||||
/* c800 - cfff */
|
||||
if(((g_c02d_int_crom & (1 << 3)) == 0) || INTCX) {
|
||||
rom_inc = rom10000 + (j << 8);
|
||||
} else {
|
||||
/* c800 space not necessarily mapped */
|
||||
/* just map in ROM */
|
||||
|
||||
/*c800 - cfff */
|
||||
if(((g_c02d_int_crom & (1 << 3)) == 0) || INTCX)
|
||||
{
|
||||
rom_inc = rom10000 + (j << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
rom_inc = rom10000 + (j << 8);
|
||||
|
||||
}
|
||||
SET_PAGE_INFO_RD(j + off, rom_inc);
|
||||
}
|
||||
iostrobe = 0;
|
||||
for(j = 0xc0; j < 0xd0; j++) {
|
||||
SET_PAGE_INFO_WR(j + off, SET_BANK_IO);
|
||||
}
|
||||
}
|
||||
|
||||
if(!no_io_shadow) {
|
||||
SET_PAGE_INFO_RD(0xc7, SET_BANK_IO); /* smartport */
|
||||
}
|
||||
|
||||
fixup_brks();
|
||||
}
|
||||
|
||||
@ -1458,8 +1464,16 @@ io_read(word32 loc, double *cyc_ptr)
|
||||
case 0x94: case 0x95: case 0x96: case 0x97:
|
||||
case 0x98: case 0x99: case 0x9a: case 0x9b:
|
||||
case 0x9c: case 0x9d: case 0x9e: case 0x9f:
|
||||
/* UNIMPL_READ; */
|
||||
return 0;
|
||||
if (g_parallel)
|
||||
{
|
||||
return parallel_read((word16)loc & 0xf);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPL_READ;
|
||||
}
|
||||
|
||||
|
||||
/* 0xc0a0 - 0xc0af */
|
||||
case 0xa0: case 0xa1: case 0xa2: case 0xa3:
|
||||
case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||
@ -1469,19 +1483,41 @@ io_read(word32 loc, double *cyc_ptr)
|
||||
/* UNIMPL_READ; */
|
||||
|
||||
/* 0xc0b0 - 0xc0bf */
|
||||
case 0xb0:
|
||||
//case 0xb0:
|
||||
/* c0b0: female voice tool033 look at this */
|
||||
return 0;
|
||||
case 0xb1: case 0xb2: case 0xb3:
|
||||
case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
case 0xb9: case 0xba: case 0xbb:
|
||||
case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
// return 0;
|
||||
//case 0xb1: case 0xb2: case 0xb3:
|
||||
//case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
//case 0xb9: case 0xba: case 0xbb:
|
||||
//case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
/* UNIMPL_READ; */
|
||||
return 0;
|
||||
// return 0;
|
||||
/* c0b8: Second Sight card stuff: return 0 */
|
||||
//case 0xb8:
|
||||
// return 0;
|
||||
// break;
|
||||
/*Uthernet read access on slot 3*/
|
||||
case 0xb0:
|
||||
case 0xb1:
|
||||
case 0xb2:
|
||||
case 0xb3:
|
||||
case 0xb4:
|
||||
case 0xb5:
|
||||
case 0xb6:
|
||||
case 0xb7:
|
||||
case 0xb8:
|
||||
return 0;
|
||||
break;
|
||||
case 0xb9:
|
||||
case 0xba:
|
||||
case 0xbb:
|
||||
case 0xbc:
|
||||
case 0xbd:
|
||||
case 0xbe:
|
||||
case 0xbf:
|
||||
if (tfe_enabled){
|
||||
return tfe_read((word16)loc & 0xf);
|
||||
}
|
||||
else
|
||||
{return 0;}
|
||||
|
||||
/* 0xc0c0 - 0xc0cf */
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
@ -1537,12 +1573,13 @@ io_read(word32 loc, double *cyc_ptr)
|
||||
}
|
||||
UNIMPL_READ;
|
||||
case 0xf:
|
||||
if((loc & 0xfff) == 0xfff) {
|
||||
return g_rom_fc_ff_ptr[0x3cfff];
|
||||
}
|
||||
|
||||
if(INTCX || ((g_c02d_int_crom & (1 << 3)) == 0)) {
|
||||
return(g_rom_fc_ff_ptr[0x3c000 + (loc & 0xfff)]);
|
||||
}
|
||||
if((loc & 0xfff) == 0xfff) {
|
||||
return g_rom_fc_ff_ptr[0x3cfff];
|
||||
}
|
||||
UNIMPL_READ;
|
||||
}
|
||||
|
||||
@ -1569,6 +1606,7 @@ io_write(word32 loc, int val, double *cyc_ptr)
|
||||
val = val & 0xff;
|
||||
switch((loc >> 8) & 0xf) {
|
||||
case 0: /* 0xc000 - 0xc0ff */
|
||||
//printf ("ioaddress: %x", (loc & 0xf));
|
||||
switch(loc & 0xff) {
|
||||
/* 0xc000 - 0xc00f */
|
||||
case 0x00: /* 0xc000 */
|
||||
@ -2113,11 +2151,19 @@ io_write(word32 loc, int val, double *cyc_ptr)
|
||||
return;
|
||||
|
||||
/* 0xc090 - 0xc09f */
|
||||
case 0x90: case 0x91: case 0x92: case 0x93:
|
||||
case 0x90:
|
||||
case 0x91: case 0x92: case 0x93:
|
||||
case 0x94: case 0x95: case 0x96: case 0x97:
|
||||
case 0x98: case 0x99: case 0x9a: case 0x9b:
|
||||
case 0x9c: case 0x9d: case 0x9e: case 0x9f:
|
||||
UNIMPL_WRITE;
|
||||
if (g_parallel)
|
||||
{
|
||||
return parallel_write((word16)loc & 0xf, (byte)val);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPL_WRITE;
|
||||
}
|
||||
|
||||
/* 0xc0a0 - 0xc0af */
|
||||
case 0xa0: case 0xa1: case 0xa3:
|
||||
@ -2128,17 +2174,43 @@ io_write(word32 loc, int val, double *cyc_ptr)
|
||||
case 0xa2: /* Burger Times writes here on error */
|
||||
case 0xa8:
|
||||
/* Kurzweil SMP writes to 0xc0a8, ignore it */
|
||||
UNIMPL_WRITE;
|
||||
return;
|
||||
|
||||
/* 0xc0b0 - 0xc0bf */
|
||||
case 0xb0:
|
||||
//case 0xb0:
|
||||
/* Second sight stuff--ignore it */
|
||||
return;
|
||||
case 0xb1: case 0xb2: case 0xb3:
|
||||
case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
case 0xb8: case 0xb9: case 0xba: case 0xbb:
|
||||
case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
//case 0xb1: case 0xb2: case 0xb3:
|
||||
//case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
//case 0xb8: case 0xb9: case 0xba: case 0xbb:
|
||||
//case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
// UNIMPL_WRITE;
|
||||
/*Uthernet write access on slot 3*/
|
||||
case 0xb0:
|
||||
case 0xb1:
|
||||
case 0xb2:
|
||||
case 0xb3:
|
||||
case 0xb4:
|
||||
case 0xb5:
|
||||
case 0xb6:
|
||||
case 0xb7:
|
||||
case 0xb8:
|
||||
case 0xb9:
|
||||
case 0xba:
|
||||
case 0xbb:
|
||||
case 0xbc:
|
||||
case 0xbd:
|
||||
case 0xbe:
|
||||
case 0xbf:
|
||||
if (tfe_enabled)
|
||||
{
|
||||
return tfe_store((word16)loc & 0xf, (byte)val);
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPL_WRITE;
|
||||
}
|
||||
|
||||
/* 0xc0c0 - 0xc0cf */
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
|
@ -9,12 +9,12 @@
|
||||
<string name="title">main</string>
|
||||
<array count="3" name="items">
|
||||
<object class="IBCarbonMenuItem" id="185">
|
||||
<string name="title">GSPORTMAC</string>
|
||||
<string name="title">KEGSMAC</string>
|
||||
<object name="submenu" class="IBCarbonMenu" id="184">
|
||||
<string name="title">GSPORTMAC</string>
|
||||
<string name="title">KEGSMAC</string>
|
||||
<array count="3" name="items">
|
||||
<object class="IBCarbonMenuItem" id="187">
|
||||
<string name="title">About GSPORTMAC</string>
|
||||
<string name="title">About KEGSMAC</string>
|
||||
<int name="keyEquivalentModifier">0</int>
|
||||
<ostype name="command">abou</ostype>
|
||||
</object>
|
||||
@ -39,7 +39,7 @@
|
||||
<string name="title">Configuration F4</string>
|
||||
<int name="keyEquivalentModifier">0</int>
|
||||
<ostype name="command">KCFG</ostype>
|
||||
<string name="helpTagText">Enter GSport Configuration Panel</string>
|
||||
<string name="helpTagText">Enter KEGS Configuration Panel</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
|
@ -1,23 +1,12 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
/************************************************************************/
|
||||
/* KEGS: Apple //gs Emulator */
|
||||
/* Copyright 2002 by Kent Dickey */
|
||||
/* */
|
||||
/* This code is covered by the GNU GPL */
|
||||
/* */
|
||||
/* The KEGS web page is kegs.sourceforge.net */
|
||||
/* You may contact the author at: kadickey@alumni.princeton.edu */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef ASM
|
||||
# ifdef INCLUDE_RCSID_S
|
||||
|
@ -1,23 +1,12 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
/************************************************************************/
|
||||
/* KEGS: Apple //gs Emulator */
|
||||
/* Copyright 2002 by Kent Dickey */
|
||||
/* */
|
||||
/* This code is covered by the GNU GPL */
|
||||
/* */
|
||||
/* The KEGS web page is kegs.sourceforge.net */
|
||||
/* You may contact the author at: kadickey@alumni.princeton.edu */
|
||||
/************************************************************************/
|
||||
|
||||
const char rcsid_paddles_c[] = "@(#)$KmKId: paddles.c,v 1.14 2004-10-19 14:52:36-04 kentd Exp $";
|
||||
|
||||
|
76
src/parallel.c
Normal file
76
src/parallel.c
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
parallel.c
|
||||
|
||||
This file handles the Apple II Parallel Card emulation in slot 1. Its very
|
||||
basic, but allows for future support of redirecting the output to a real
|
||||
parallel port, files, and additional types of emulated printers.
|
||||
*/
|
||||
|
||||
#include "defc.h"
|
||||
#include "printer.h"
|
||||
extern int g_parallel_out_masking;
|
||||
extern int g_vbl_count;
|
||||
extern int g_printer_timeout;
|
||||
int printer_vbl_count = 0;
|
||||
int port_block = 0;
|
||||
|
||||
byte parallel_read(word16 io_address)
|
||||
{
|
||||
printf("parallel card status called at %x\n", io_address);
|
||||
//since we only have a virtual printer, always return state as "Ready"
|
||||
return 0xff;
|
||||
}
|
||||
void parallel_write(word16 io_address, byte val)
|
||||
{
|
||||
//Mask MSB if user has it set.
|
||||
if(g_parallel_out_masking) {
|
||||
val = val & 0xfe;
|
||||
}
|
||||
printf("parallel card called at %x\n", io_address);
|
||||
//send a byte to the virtual printer
|
||||
//By default all output to $C090 gets sent to the printer
|
||||
if (io_address == 0x00)
|
||||
{
|
||||
port_block = 1;
|
||||
printer_loop(val);
|
||||
printer_vbl_count = g_vbl_count+(g_printer_timeout*60);
|
||||
port_block = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//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
|
||||
//print somewhat how a regular application would.
|
||||
void printer_update()
|
||||
{
|
||||
if (port_block != 1 && printer_vbl_count != 0 && g_vbl_count >= printer_vbl_count)
|
||||
{
|
||||
printf("Calling printer_update and flushing!\n");
|
||||
printer_feed();
|
||||
printer_vbl_count = 0;
|
||||
}
|
||||
return;
|
||||
}
|
BIN
src/parallel.rom
Normal file
BIN
src/parallel.rom
Normal file
Binary file not shown.
2046
src/printer.cpp
Normal file
2046
src/printer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
279
src/printer.h
Normal file
279
src/printer.h
Normal file
@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2004 The DOSBox Team
|
||||
*
|
||||
* 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 Library 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 <dosbox.h>
|
||||
//#include "config.h"
|
||||
|
||||
|
||||
|
||||
#if !defined __PRINTER_H
|
||||
#define __PRINTER_H
|
||||
#ifdef __cplusplus
|
||||
#ifdef C_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#if defined (WIN32)
|
||||
#include <windows.h>
|
||||
#include <winspool.h>
|
||||
#endif
|
||||
|
||||
#define STYLE_PROP 0x01
|
||||
#define STYLE_CONDENSED 0x02
|
||||
#define STYLE_BOLD 0x04
|
||||
#define STYLE_DOUBLESTRIKE 0x08
|
||||
#define STYLE_DOUBLEWIDTH 0x10
|
||||
#define STYLE_ITALICS 0x20
|
||||
#define STYLE_UNDERLINE 0x40
|
||||
#define STYLE_SUPERSCRIPT 0x80
|
||||
#define STYLE_SUBSCRIPT 0x100
|
||||
#define STYLE_STRIKETHROUGH 0x200
|
||||
#define STYLE_OVERSCORE 0x400
|
||||
#define STYLE_DOUBLEWIDTHONELINE 0x800
|
||||
#define STYLE_DOUBLEHEIGHT 0x1000
|
||||
|
||||
#define SCORE_NONE 0x00
|
||||
#define SCORE_SINGLE 0x01
|
||||
#define SCORE_DOUBLE 0x02
|
||||
#define SCORE_SINGLEBROKEN 0x05
|
||||
#define SCORE_DOUBLEBROKEN 0x06
|
||||
|
||||
#define QUALITY_DRAFT 0x01
|
||||
#define QUALITY_LQ 0x02
|
||||
|
||||
#define COLOR_BLACK 7<<5
|
||||
typedef unsigned Bitu;
|
||||
typedef signed Bits;
|
||||
typedef unsigned char Bit8u;
|
||||
typedef signed char Bit8s;
|
||||
typedef unsigned short Bit16u;
|
||||
typedef signed short Bit16s;
|
||||
typedef unsigned long Bit32u;
|
||||
typedef signed long Bit32s;
|
||||
typedef double Real64;
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned __int64 Bit64u;
|
||||
typedef signed __int64 Bit64s;
|
||||
#else
|
||||
typedef unsigned long long int Bit64u;
|
||||
typedef signed long long int Bit64s;
|
||||
#endif
|
||||
enum Typeface
|
||||
{
|
||||
roman = 0,
|
||||
sansserif,
|
||||
courier,
|
||||
prestige,
|
||||
script,
|
||||
ocrb,
|
||||
ocra,
|
||||
orator,
|
||||
orators,
|
||||
scriptc,
|
||||
romant,
|
||||
sansserifh,
|
||||
svbusaba = 30,
|
||||
svjittra = 31
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Bitu codepage;
|
||||
const Bit16u* map;
|
||||
} CHARMAP;
|
||||
|
||||
|
||||
class CPrinter {
|
||||
public:
|
||||
|
||||
CPrinter (Bit16u dpi, Bit16u width, Bit16u height, char* output, bool multipageOutput);
|
||||
virtual ~CPrinter();
|
||||
|
||||
// Process one character sent to virtual printer
|
||||
void printChar(Bit8u ch);
|
||||
|
||||
// Hard Reset (like switching printer off and on)
|
||||
void resetPrinterHard();
|
||||
|
||||
// Set Autofeed value
|
||||
void setAutofeed(bool feed);
|
||||
|
||||
// Get Autofeed value
|
||||
bool getAutofeed();
|
||||
|
||||
// True if printer is unable to process more data right now (do not use printChar)
|
||||
bool isBusy();
|
||||
|
||||
// True if the last sent character was received
|
||||
bool ack();
|
||||
|
||||
// Manual formfeed
|
||||
void formFeed();
|
||||
|
||||
// Returns true if the current page is blank
|
||||
bool isBlank();
|
||||
|
||||
private:
|
||||
|
||||
// used to fill the color "sub-pallettes"
|
||||
void FillPalette(Bit8u redmax, Bit8u greenmax, Bit8u bluemax, Bit8u colorID,
|
||||
SDL_Palette* pal);
|
||||
|
||||
// Checks if given char belongs to a command and process it. If false, the character
|
||||
// should be printed
|
||||
bool processCommandChar(Bit8u ch);
|
||||
|
||||
// Resets the printer to the factory settings
|
||||
void resetPrinter();
|
||||
|
||||
// Reload font. Must be called after changing dpi, style or cpi
|
||||
void updateFont();
|
||||
|
||||
// Clears page. If save is true, saves the current page to a bitmap
|
||||
void newPage(bool save, bool resetx);
|
||||
|
||||
// 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
|
||||
void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool add);
|
||||
|
||||
// Draws an anti-aliased line from (fromx, y) to (tox, y). If broken is true, gaps are included
|
||||
void drawLine(Bitu fromx, Bitu tox, Bitu y, bool broken);
|
||||
|
||||
// Setup the bitGraph structure
|
||||
void setupBitImage(Bit8u dens, Bit16u numCols);
|
||||
|
||||
// Process a character that is part of bit image. Must be called iff bitGraph.remBytes > 0.
|
||||
void printBitGraph(Bit8u ch);
|
||||
|
||||
// Copies the codepage mapping from the constant array to CurMap
|
||||
void selectCodepage(Bit16u cp);
|
||||
|
||||
// Output current page
|
||||
void outputPage();
|
||||
|
||||
// Prints out a byte using ASCII85 encoding (only outputs something every four bytes). When b>255, closes the ASCII85 string
|
||||
void fprintASCII85(FILE* f, Bit16u b);
|
||||
|
||||
// Closes a multipage document
|
||||
void finishMultipage();
|
||||
|
||||
// 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
|
||||
|
||||
SDL_Surface* page; // Surface representing the current page
|
||||
FT_Face curFont; // The font currently used to render characters
|
||||
Bit8u color;
|
||||
|
||||
Real64 curX, curY; // Position of the print head (in inch)
|
||||
|
||||
Bit16u dpi; // dpi of the page
|
||||
Bit16u ESCCmd; // ESC-command that is currently processed
|
||||
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 numParam, neededParam; // Numbers of parameters already read/needed to process command
|
||||
|
||||
Bit8u params[20]; // Buffer for the read params
|
||||
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 score; // Score for lines (see SCORE_* constants)
|
||||
|
||||
Real64 topMargin, bottomMargin, rightMargin, leftMargin; // Margins of the page (in inch)
|
||||
Real64 pageWidth, pageHeight; // Size of page (in inch)
|
||||
Real64 defaultPageWidth, defaultPageHeight; // Default size of page (in inch)
|
||||
Real64 lineSpacing; // Size of one line (in inch)
|
||||
|
||||
Real64 horiztabs[32]; // Stores the set horizontal tabs (in inch)
|
||||
Bit8u numHorizTabs; // Number of configured tabs
|
||||
|
||||
Real64 verttabs[16]; // Stores the set vertical tabs (in inch)
|
||||
Bit8u numVertTabs; // Number of configured tabs
|
||||
|
||||
Bit8u curCharTable; // Currently used char table und charset
|
||||
Bit8u printQuality; // Print quality (see QUALITY_* constants)
|
||||
|
||||
Typeface LQtypeFace; // Typeface used in LQ printing mode
|
||||
|
||||
Real64 extraIntraSpace; // Extra space between two characters (set by program, in inch)
|
||||
|
||||
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
|
||||
bool printUpperContr; // True if the upper command characters should be printed
|
||||
|
||||
struct bitGraphicParams // Holds information about printing bit images
|
||||
{
|
||||
Bit16u horizDens, vertDens; // Density of image to print (in dpi)
|
||||
bool adjacent; // Print adjacent pixels? (ignored)
|
||||
Bit8u bytesColumn; // Bytes per column
|
||||
Bit16u remBytes; // Bytes left to read before image is done
|
||||
Bit8u column[6]; // Bytes of the current and last column
|
||||
Bit8u readBytesColumn; // Bytes read so far for the current column
|
||||
} bitGraph;
|
||||
|
||||
Bit8u densk, densl, densy, densz; // Image density modes used in ESC K/L/Y/Z commands
|
||||
|
||||
Bit16u curMap[256]; // Currently used ASCII => Unicode mapping
|
||||
Bit16u charTables[4]; // Charactertables
|
||||
|
||||
Real64 definedUnit; // Unit used by some ESC/P2 commands (negative => use default)
|
||||
|
||||
bool multipoint; // If multipoint mode is enabled
|
||||
Real64 multiPointSize; // Point size of font in multipoint mode
|
||||
Real64 multicpi; // CPI used in multipoint mode
|
||||
|
||||
Real64 hmi; // Horizontal motion index (in inch; overrides CPI settings)
|
||||
|
||||
Bit8u msb; // MSB mode
|
||||
Bit16u numPrintAsChar; // Number of bytes to print as characters (even when normally control codes)
|
||||
|
||||
#if defined (WIN32)
|
||||
HDC printerDC; // Win32 printer device
|
||||
#endif
|
||||
|
||||
char* output; // Output method selected by user
|
||||
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
|
||||
Bit16u multiPageCounter; // Current page (when printing multipages)
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
//Interfaces to C code
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
void printer_init(int pdpi, int pwidth, int pheight, char* poutput, bool mpage);
|
||||
void printer_loop(Bit8u pchar);
|
||||
void printer_close();
|
||||
void printer_feed();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
327
src/printer_charmaps.h
Normal file
327
src/printer_charmaps.h
Normal file
@ -0,0 +1,327 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
|
||||
// Various ASCII codepage to unicode maps
|
||||
|
||||
static const Bit16u cp437Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00a2,0x00a3,0x00a5,0x20a7,0x0192,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp737Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a,0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,
|
||||
0x03a1,0x03a3,0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,
|
||||
0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3,0x03c2,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03c9,0x03ac,0x03ad,0x03ae,0x03ca,0x03af,0x03cc,0x03cd,0x03cb,0x03ce,0x0386,0x0388,0x0389,0x038a,0x038c,0x038e,
|
||||
0x038f,0x00b1,0x2265,0x2264,0x03aa,0x03ab,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp775Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x0106,0x00fc,0x00e9,0x0101,0x00e4,0x0123,0x00e5,0x0107,0x0142,0x0113,0x0156,0x0157,0x012b,0x0179,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x014d,0x00f6,0x0122,0x00a2,0x015a,0x015b,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x00d7,0x00a4,
|
||||
0x0100,0x012a,0x00f3,0x017b,0x017c,0x017a,0x201d,0x00a6,0x00a9,0x00ae,0x00ac,0x00bd,0x00bc,0x0141,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x0104,0x010c,0x0118,0x0116,0x2563,0x2551,0x2557,0x255d,0x012e,0x0160,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x0172,0x016a,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x017d,
|
||||
0x0105,0x010d,0x0119,0x0117,0x012f,0x0161,0x0173,0x016b,0x017e,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x00d3,0x00df,0x014c,0x0143,0x00f5,0x00d5,0x00b5,0x0144,0x0136,0x0137,0x013b,0x013c,0x0146,0x0112,0x0145,0x2019,
|
||||
0x00ad,0x00b1,0x201c,0x00be,0x00b6,0x00a7,0x00f7,0x201e,0x00b0,0x2219,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp850Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x00d7,0x0192,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x00ae,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x00c0,0x00a9,0x2563,0x2551,0x2557,0x255d,0x00a2,0x00a5,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x00e3,0x00c3,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
|
||||
0x00f0,0x00d0,0x00ca,0x00cb,0x00c8,0x0131,0x00cd,0x00ce,0x00cf,0x2518,0x250c,0x2588,0x2584,0x00a6,0x00cc,0x2580,
|
||||
0x00d3,0x00df,0x00d4,0x00d2,0x00f5,0x00d5,0x00b5,0x00fe,0x00de,0x00da,0x00db,0x00d9,0x00fd,0x00dd,0x00af,0x00b4,
|
||||
0x00ad,0x00b1,0x2017,0x00be,0x00b6,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp852Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x016f,0x0107,0x00e7,0x0142,0x00eb,0x0150,0x0151,0x00ee,0x0179,0x00c4,0x0106,
|
||||
0x00c9,0x0139,0x013a,0x00f4,0x00f6,0x013d,0x013e,0x015a,0x015b,0x00d6,0x00dc,0x0164,0x0165,0x0141,0x00d7,0x010d,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x0104,0x0105,0x017d,0x017e,0x0118,0x0119,0x00ac,0x017a,0x010c,0x015f,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x011a,0x015e,0x2563,0x2551,0x2557,0x255d,0x017b,0x017c,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x0102,0x0103,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
|
||||
0x0111,0x0110,0x010e,0x00cb,0x010f,0x0147,0x00cd,0x00ce,0x011b,0x2518,0x250c,0x2588,0x2584,0x0162,0x016e,0x2580,
|
||||
0x00d3,0x00df,0x00d4,0x0143,0x0144,0x0148,0x0160,0x0161,0x0154,0x00da,0x0155,0x0170,0x00fd,0x00dd,0x0163,0x00b4,
|
||||
0x00ad,0x02dd,0x02db,0x02c7,0x02d8,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x02d9,0x0171,0x0158,0x0159,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp855Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x0452,0x0402,0x0453,0x0403,0x0451,0x0401,0x0454,0x0404,0x0455,0x0405,0x0456,0x0406,0x0457,0x0407,0x0458,0x0408,
|
||||
0x0459,0x0409,0x045a,0x040a,0x045b,0x040b,0x045c,0x040c,0x045e,0x040e,0x045f,0x040f,0x044e,0x042e,0x044a,0x042a,
|
||||
0x0430,0x0410,0x0431,0x0411,0x0446,0x0426,0x0434,0x0414,0x0435,0x0415,0x0444,0x0424,0x0433,0x0413,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x0445,0x0425,0x0438,0x0418,0x2563,0x2551,0x2557,0x255d,0x0439,0x0419,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x043a,0x041a,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
|
||||
0x043b,0x041b,0x043c,0x041c,0x043d,0x041d,0x043e,0x041e,0x043f,0x2518,0x250c,0x2588,0x2584,0x041f,0x044f,0x2580,
|
||||
0x042f,0x0440,0x0420,0x0441,0x0421,0x0442,0x0422,0x0443,0x0423,0x0436,0x0416,0x0432,0x0412,0x044c,0x042c,0x2116,
|
||||
0x00ad,0x044b,0x042b,0x0437,0x0417,0x0448,0x0428,0x044d,0x042d,0x0449,0x0429,0x0447,0x0427,0x00a7,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp857Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x0131,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x0130,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x015e,0x015f,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x011e,0x011f,0x00bf,0x00ae,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x00c0,0x00a9,0x2563,0x2551,0x2557,0x255d,0x00a2,0x00a5,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x00e3,0x00c3,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
|
||||
0x00ba,0x00aa,0x00ca,0x00cb,0x00c8,0x0000,0x00cd,0x00ce,0x00cf,0x2518,0x250c,0x2588,0x2584,0x00a6,0x00cc,0x2580,
|
||||
0x00d3,0x00df,0x00d4,0x00d2,0x00f5,0x00d5,0x00b5,0x0000,0x00d7,0x00da,0x00db,0x00d9,0x00ec,0x00ff,0x00af,0x00b4,
|
||||
0x00ad,0x00b1,0x0000,0x00be,0x00b6,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp860Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e3,0x00e0,0x00c1,0x00e7,0x00ea,0x00ca,0x00e8,0x00cd,0x00d4,0x00ec,0x00c3,0x00c2,
|
||||
0x00c9,0x00c0,0x00c8,0x00f4,0x00f5,0x00f2,0x00da,0x00f9,0x00cc,0x00d5,0x00dc,0x00a2,0x00a3,0x00d9,0x20a7,0x00d3,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x00d2,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp861Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00d0,0x00f0,0x00de,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00fe,0x00fb,0x00dd,0x00fd,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x20a7,0x0192,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00c1,0x00cd,0x00d3,0x00da,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp862Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x05d0,0x05d1,0x05d2,0x05d3,0x05d4,0x05d5,0x05d6,0x05d7,0x05d8,0x05d9,0x05da,0x05db,0x05dc,0x05dd,0x05de,0x05df,
|
||||
0x05e0,0x05e1,0x05e2,0x05e3,0x05e4,0x05e5,0x05e6,0x05e7,0x05e8,0x05e9,0x05ea,0x00a2,0x00a3,0x00a5,0x20a7,0x0192,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp863Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00c2,0x00e0,0x00b6,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x2017,0x00c0,0x00a7,
|
||||
0x00c9,0x00c8,0x00ca,0x00f4,0x00cb,0x00cf,0x00fb,0x00f9,0x00a4,0x00d4,0x00dc,0x00a2,0x00a3,0x00d9,0x00db,0x0192,
|
||||
0x00a6,0x00b4,0x00f3,0x00fa,0x00a8,0x00b8,0x00b3,0x00af,0x00ce,0x2310,0x00ac,0x00bd,0x00bc,0x00be,0x00ab,0x00bb,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp864Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x066a,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00b0,0x00b7,0x2219,0x221a,0x2592,0x2500,0x2502,0x253c,0x2524,0x252c,0x251c,0x2534,0x2510,0x250c,0x2514,0x2518,
|
||||
0x03b2,0x221e,0x03c6,0x00b1,0x00bd,0x00bc,0x2248,0x00ab,0x00bb,0xfef7,0xfef8,0x0000,0x0000,0xfefb,0xfefc,0x0000,
|
||||
0x00a0,0x00ad,0xfe82,0x00a3,0x00a4,0xfe84,0x0000,0x0000,0xfe8e,0xfe8f,0xfe95,0xfe99,0x060c,0xfe9d,0xfea1,0xfea5,
|
||||
0x0660,0x0661,0x0662,0x0663,0x0664,0x0665,0x0666,0x0667,0x0668,0x0669,0xfed1,0x061b,0xfeb1,0xfeb5,0xfeb9,0x061f,
|
||||
0x00a2,0xfe80,0xfe81,0xfe83,0xfe85,0xfeca,0xfe8b,0xfe8d,0xfe91,0xfe93,0xfe97,0xfe9b,0xfe9f,0xfea3,0xfea7,0xfea9,
|
||||
0xfeab,0xfead,0xfeaf,0xfeb3,0xfeb7,0xfebb,0xfebf,0xfec1,0xfec5,0xfecb,0xfecf,0x00a6,0x00ac,0x00f7,0x00d7,0xfec9,
|
||||
0x0640,0xfed3,0xfed7,0xfedb,0xfedf,0xfee3,0xfee7,0xfeeb,0xfeed,0xfeef,0xfef3,0xfebd,0xfecc,0xfece,0xfecd,0xfee1,
|
||||
0xfe7d,0x0651,0xfee5,0xfee9,0xfeec,0xfef0,0xfef2,0xfed0,0xfed5,0xfef5,0xfef6,0xfedd,0xfed9,0xfef1,0x25a0,
|
||||
};
|
||||
|
||||
static const Bit16u cp865Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
|
||||
0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x20a7,0x0192,
|
||||
0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00a4,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
|
||||
0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
static const Bit16u cp866Map[256] = {
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
|
||||
0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041a,0x041b,0x041c,0x041d,0x041e,0x041f,
|
||||
0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042a,0x042b,0x042c,0x042d,0x042e,0x042f,
|
||||
0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043a,0x043b,0x043c,0x043d,0x043e,0x043f,
|
||||
0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
|
||||
0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
|
||||
0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
|
||||
0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044a,0x044b,0x044c,0x044d,0x044e,0x044f,
|
||||
0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040e,0x045e,0x00b0,0x2219,0x00b7,0x221a,0x2116,0x00a4,0x25a0,0x00a0
|
||||
};
|
||||
|
||||
CHARMAP charmap[] = {
|
||||
{437, cp437Map},
|
||||
{737, cp737Map},
|
||||
{775, cp775Map},
|
||||
{850, cp850Map},
|
||||
{852, cp852Map},
|
||||
{855, cp855Map},
|
||||
{857, cp857Map},
|
||||
{860, cp860Map},
|
||||
{861, cp861Map},
|
||||
{863, cp863Map},
|
||||
{864, cp864Map},
|
||||
{865, cp865Map},
|
||||
{866, cp866Map},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
static const Bit16u codepages[15] = {0, 437, 932, 850, 851, 853, 855, 860, 863, 865, 852, 857, 862, 864, 866};
|
||||
|
||||
// TODO: Implement all international charsets
|
||||
static const Bit16u intCharSets[15][12] =
|
||||
{
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, // USA
|
||||
{0x0023, 0x0024, 0x00e0, 0x00ba, 0x00e7, 0x00a7, 0x005e, 0x0060, 0x00e9, 0x00f9, 0x00e8, 0x00a8}, // France
|
||||
{0x0023, 0x0024, 0x00a7, 0x00c4, 0x00d6, 0x00dc, 0x005e, 0x0060, 0x00e4, 0x00f6, 0x00fc, 0x00df}, // Germany
|
||||
{0x00a3, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, // UK
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
|
||||
{0x0023, 0x0024, 0x00a7, 0x00c4, 0x0027, 0x0022, 0x00b6, 0x0060, 0x00a9, 0x00ae, 0x2020, 0x2122} // Legal
|
||||
};
|
78
src/protos.h
78
src/protos.h
@ -159,6 +159,7 @@ void config_init(void);
|
||||
void cfg_exit(void);
|
||||
void cfg_toggle_config_panel(void);
|
||||
void cfg_text_screen_dump(void);
|
||||
void cfg_get_tfe_name(void);
|
||||
void config_vbl_update(int doit_3_persec);
|
||||
void config_parse_option(char *buf, int pos, int len, int line);
|
||||
void config_parse_bram(char *buf, int pos, int len);
|
||||
@ -539,3 +540,80 @@ void video_update_status_line(int line, const char *string);
|
||||
void video_show_debug_info(void);
|
||||
word32 float_bus(double dcycs);
|
||||
|
||||
/*parallel.c*/
|
||||
byte parallel_read(word16 paddr);
|
||||
void parallel_write(word16 paddr, byte pvar);
|
||||
void printer_update();
|
||||
|
||||
/*tfc.c*/
|
||||
int tfe_enabled;
|
||||
|
||||
void tfe_init(void);
|
||||
int tfe_resources_init(void);
|
||||
int tfe_cmdline_options_init(void);
|
||||
int set_tfe_interface(const char* name);
|
||||
void get_disabled_state(int * param);
|
||||
|
||||
void tfe_reset(void);
|
||||
void tfe_shutdown(void);
|
||||
byte tfe_read(word16 addr);
|
||||
void tfe_store(word16 addr, byte var);
|
||||
int tfe_read_snapshot_module(struct snapshot_s *s);
|
||||
int tfe_write_snapshot_module(struct snapshot_s *s);
|
||||
int tfe_enumadapter_open(void);
|
||||
int tfe_enumadapter(char **ppname, char **ppdescription);
|
||||
int tfe_enumadapter_close(void);
|
||||
|
||||
/*tfearch.c*/
|
||||
int tfe_arch_init(void);
|
||||
void tfe_arch_pre_reset(void);
|
||||
void tfe_arch_post_reset(void);
|
||||
int tfe_arch_activate(const char *interface_name);
|
||||
void tfe_arch_deactivate(void);
|
||||
void tfe_arch_set_mac(const byte mac[6]);
|
||||
void tfe_arch_set_hashfilter(const int hash_mask[2]);
|
||||
|
||||
void tfe_arch_recv_ctl( int bBroadcast, /* broadcast */
|
||||
int bIA, /* individual address (IA) */
|
||||
int bMulticast, /* multicast if address passes the hash filter */
|
||||
int bCorrect, /* accept correct frames */
|
||||
int bPromiscuous, /* promiscuous mode */
|
||||
int bIAHash /* accept if IA passes the hash filter */
|
||||
);
|
||||
|
||||
void tfe_arch_line_ctl(int bEnableTransmitter, int bEnableReceiver);
|
||||
|
||||
void tfe_arch_transmit(int force, /* FORCE: Delete waiting frames in transmit buffer */
|
||||
int onecoll, /* ONECOLL: Terminate after just one collision */
|
||||
int inhibit_crc, /* INHIBITCRC: Do not append CRC to the transmission */
|
||||
int tx_pad_dis, /* TXPADDIS: Disable padding to 60 Bytes */
|
||||
int txlength, /* Frame length */
|
||||
byte *txframe /* Pointer to the frame to be transmitted */
|
||||
);
|
||||
|
||||
int tfe_arch_receive(byte *pbuffer , /* where to store a frame */
|
||||
int *plen, /* IN: maximum length of frame to copy;
|
||||
OUT: length of received frame
|
||||
OUT can be bigger than IN if received frame was
|
||||
longer than supplied buffer */
|
||||
int *phashed, /* set if the dest. address is accepted by the hash filter */
|
||||
int *phash_index, /* hash table index if hashed == TRUE */
|
||||
int *prx_ok, /* set if good CRC and valid length */
|
||||
int *pcorrect_mac, /* set if dest. address is exactly our IA */
|
||||
int *pbroadcast, /* set if dest. address is a broadcast address */
|
||||
int *pcrc_error /* set if received frame had a CRC error */
|
||||
);
|
||||
|
||||
/*
|
||||
This is a helper for tfe_receive() to determine if the received frame should be accepted
|
||||
according to the settings.
|
||||
|
||||
This function is even allowed to be called in tfearch.c from tfe_arch_receive() if
|
||||
necessary, which is the reason why its prototype is included here in tfearch.h.
|
||||
*/
|
||||
int tfe_should_accept(unsigned char *buffer, int length, int *phashed, int *phash_index,
|
||||
int *pcorrect_mac, int *pbroadcast, int *pmulticast);
|
||||
|
||||
int tfe_arch_enumadapter_open(void);
|
||||
int tfe_arch_enumadapter(char **ppname, char **ppdescription);
|
||||
int tfe_arch_enumadapter_close(void);
|
||||
|
58
src/resource
Normal file
58
src/resource
Normal file
@ -0,0 +1,58 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by kegs32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_KEGS32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_KEGS32_KEY 106
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_FILE_SEND_REBOOT 40014
|
||||
#define ID_Menu 40015
|
||||
#define ID_EMULATOR_FLUSHPRINTER 40016
|
||||
#define ID_FILE_FLUSHPRINTER 40017
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 116
|
||||
#define _APS_NEXT_COMMAND_VALUE 40018
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
57
src/resource.h
Normal file
57
src/resource.h
Normal file
@ -0,0 +1,57 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by kegs32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_KEGS32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_KEGS32_KEY 106
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 111
|
||||
#define _APS_NEXT_COMMAND_VALUE 40013
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
@ -30,7 +30,7 @@ const char rcsid_scc_socket_driver_c[] = "@(#)$KmKId: scc_socket_driver.c,v 1.11
|
||||
extern Scc scc_stat[2];
|
||||
extern int g_serial_modem[];
|
||||
|
||||
extern int h_errno;
|
||||
//extern int h_errno;
|
||||
int g_wsastartup_called = 0;
|
||||
|
||||
/* Usage: scc_socket_init() called to init socket mode */
|
||||
|
@ -25,6 +25,7 @@ const char rcsid_scc_windriver_c[] = "@(#)$KmKId: scc_windriver.c,v 1.4 2004-11-
|
||||
|
||||
#include "defc.h"
|
||||
#include "scc.h"
|
||||
#include "printer.h"
|
||||
|
||||
extern Scc scc_stat[2];
|
||||
extern word32 g_c025_val;
|
||||
@ -32,8 +33,11 @@ extern word32 g_c025_val;
|
||||
#ifdef _WIN32
|
||||
int
|
||||
scc_serial_win_init(int port)
|
||||
{
|
||||
COMMTIMEOUTS commtimeouts;
|
||||
{ int state;
|
||||
Scc *scc_ptr;
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
printf("Called port init.\n");
|
||||
/*COMMTIMEOUTS commtimeouts;
|
||||
char str_buf[8];
|
||||
Scc *scc_ptr;
|
||||
HANDLE host_handle;
|
||||
@ -42,13 +46,12 @@ scc_serial_win_init(int port)
|
||||
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
|
||||
scc_ptr->state = 0; /* mark as failed */
|
||||
|
||||
scc_ptr->state = 0; */ /* mark as failed */
|
||||
/*
|
||||
sprintf(&str_buf[0], "COM%d", port+1);
|
||||
|
||||
host_handle = CreateFile(&str_buf[0], GENERIC_READ | GENERIC_WRITE,
|
||||
0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
printf("scc port is mapped to: %s\n", &str_buf);
|
||||
scc_ptr->host_handle = host_handle;
|
||||
scc_ptr->host_handle2 = malloc(sizeof(DCB));
|
||||
|
||||
@ -72,7 +75,7 @@ scc_serial_win_init(int port)
|
||||
if(ret == 0) {
|
||||
printf("setcommtimeout ret: %d\n", ret);
|
||||
}
|
||||
|
||||
*/ //printer_init(360,85,110,'bmp',0);
|
||||
state = 2; /* raw serial */
|
||||
scc_ptr->state = state;
|
||||
|
||||
@ -163,7 +166,7 @@ scc_serial_win_change_params(int port)
|
||||
|
||||
void
|
||||
scc_serial_win_fill_readbuf(int port, int space_left, double dcycs)
|
||||
{
|
||||
{/*
|
||||
byte tmp_buf[256];
|
||||
Scc *scc_ptr;
|
||||
HANDLE host_handle;
|
||||
@ -177,9 +180,9 @@ scc_serial_win_fill_readbuf(int port, int space_left, double dcycs)
|
||||
if(host_handle == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
/* Try reading some bytes */
|
||||
space_left = MIN(256, space_left);
|
||||
/* space_left = MIN(256, space_left);
|
||||
ret = ReadFile(host_handle, tmp_buf, space_left, &bytes_read, NULL);
|
||||
|
||||
if(ret == 0) {
|
||||
@ -191,7 +194,7 @@ scc_serial_win_fill_readbuf(int port, int space_left, double dcycs)
|
||||
scc_add_to_readbuf(port, tmp_buf[i], dcycs);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
@ -210,10 +213,10 @@ scc_serial_win_empty_writebuf(int port)
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
|
||||
//printf("win_empty_writebuf, host_handle: %d\n", scc_ptr->host_handle);
|
||||
host_handle = scc_ptr->host_handle;
|
||||
/*host_handle = scc_ptr->host_handle;
|
||||
if(host_handle == 0) {
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Try writing some bytes */
|
||||
done = 0;
|
||||
@ -237,18 +240,22 @@ scc_serial_win_empty_writebuf(int port)
|
||||
break;
|
||||
}
|
||||
bytes_written = 1;
|
||||
ret = WriteFile(host_handle, &(scc_ptr->out_buf[rdptr]), len,
|
||||
&bytes_written, NULL);
|
||||
/*ret = WriteFile(host_handle, &(scc_ptr->out_buf[rdptr]), len,
|
||||
&bytes_written, NULL);*/
|
||||
printer_loop(scc_ptr->out_buf[rdptr]);
|
||||
/*ret =
|
||||
printf("WriteFile ret: %d, bytes_written:%d, len:%d\n", ret,
|
||||
(int)bytes_written, len);
|
||||
|
||||
(int)bytes_written, len);*/
|
||||
/*printf("WriteFile bytes_written:%d, len:%d\n",
|
||||
(int)bytes_written, len);*/
|
||||
err_code = (word32)-1;
|
||||
if(ret == 0) {
|
||||
err_code = (word32)GetLastError();
|
||||
/* if(ret == 0) {
|
||||
err_code = 0; //(word32)GetLastError();
|
||||
printf("WriteFile ret:0, err_code: %08x\n", err_code);
|
||||
}
|
||||
}*/
|
||||
|
||||
if(ret == 0 || (bytes_written == 0)) {
|
||||
// if(ret == 0 || (bytes_written == 0)) {
|
||||
if (bytes_written == 0) {
|
||||
done = 1;
|
||||
break;
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ const char rcsid_sim65816_c[] = "@(#)$KmKId: sim65816.c,v 1.367 2004-11-22 02:39
|
||||
#define INCLUDE_RCSID_C
|
||||
#include "defc.h"
|
||||
#undef INCLUDE_RCSID_C
|
||||
|
||||
#include "printer.h"
|
||||
#define PC_LOG_LEN (8*1024)
|
||||
|
||||
|
||||
@ -109,6 +109,21 @@ int g_raw_serial = 1;
|
||||
int g_iw2_emul = 0;
|
||||
int g_serial_out_masking = 0;
|
||||
int g_serial_modem[2] = { 0, 1 };
|
||||
int g_ethernet = 0;
|
||||
int g_ethernet_interface = 0;
|
||||
int g_parallel = 0;
|
||||
int g_parallel_out_masking = 0;
|
||||
int g_printer = 0;
|
||||
int g_printer_dpi = 360;
|
||||
char* g_printer_output = "bmp";
|
||||
int g_printer_multipage = 0;
|
||||
int g_printer_timeout = 2;
|
||||
char* g_printer_font_roman = "roman.ttf";
|
||||
char* g_printer_font_sans = "sansserif.ttf";
|
||||
char* g_printer_font_courier = "courier.ttf";
|
||||
char* g_printer_font_prestige = "prestige.ttf";
|
||||
char* g_printer_font_script = "script.ttf";
|
||||
char* g_printer_font_ocra = "ocra.ttf";
|
||||
|
||||
int g_config_iwm_vbl_count = 0;
|
||||
const char g_kegs_version_str[] = "0.1";
|
||||
@ -391,7 +406,6 @@ get_memory_io(word32 loc, double *cyc_ptr)
|
||||
halt_printf("get_memory_io:%08x out of range==halt!\n", loc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmp = loc & 0xfef000;
|
||||
if(tmp == 0xc000 || tmp == 0xe0c000) {
|
||||
return(io_read(loc & 0xfff, cyc_ptr));
|
||||
@ -508,7 +522,6 @@ void
|
||||
set_memory_io(word32 loc, int val, double *cyc_ptr)
|
||||
{
|
||||
word32 tmp;
|
||||
|
||||
tmp = loc & 0xfef000;
|
||||
if(tmp == 0xc000 || tmp == 0xe0c000) {
|
||||
io_write(loc, val, cyc_ptr);
|
||||
@ -609,6 +622,7 @@ void
|
||||
my_exit(int ret)
|
||||
{
|
||||
end_screen();
|
||||
printer_close();
|
||||
printf("exiting\n");
|
||||
exit(ret);
|
||||
}
|
||||
@ -861,6 +875,15 @@ kegsmain(int argc, char **argv)
|
||||
printf("Forcing black-and-white hires modes\n");
|
||||
g_cur_a2_stat |= ALL_STAT_COLOR_C021;
|
||||
g_use_bw_hires = 1;
|
||||
} else if(!strcmp("-enet", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
printf("Using %d as ethernet enable val\n", tmp1);
|
||||
g_ethernet = tmp1;
|
||||
i++;
|
||||
} else {
|
||||
printf("Bad option: %s\n", argv[i]);
|
||||
exit(3);
|
||||
@ -898,6 +921,33 @@ kegsmain(int argc, char **argv)
|
||||
|
||||
iwm_init();
|
||||
config_init();
|
||||
printer_init(g_printer_dpi,85,110,g_printer_output,g_printer_multipage);
|
||||
//If ethernet is enabled in config.kegs, lets initialize it
|
||||
if (g_ethernet == 1)
|
||||
{
|
||||
int i = 0;
|
||||
char *ppname = NULL;
|
||||
char *ppdes = NULL;
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
//Loop through the available adapters until we reach the interface number specified in config.kegs
|
||||
while(tfe_enumadapter(&ppname,&ppdes))
|
||||
{
|
||||
if (i == g_ethernet_interface) break;
|
||||
i++;
|
||||
}
|
||||
tfe_enumadapter_close();
|
||||
printf("Using host ethernet interface: %s\nUthernet support is ON.\n",ppdes);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("No ethernet host adapters found. Do you have PCap installed/enabled?\nUthernet support is OFF.\n");
|
||||
}
|
||||
set_tfe_interface(ppname); //Connect the emulated ethernet device with the selected host adapter
|
||||
lib_free(ppname);
|
||||
lib_free(ppdes);
|
||||
tfe_init();
|
||||
}
|
||||
|
||||
load_roms_init_memory();
|
||||
|
||||
@ -912,7 +962,6 @@ kegsmain(int argc, char **argv)
|
||||
//sleep(1);
|
||||
#endif
|
||||
sound_init();
|
||||
|
||||
scc_init();
|
||||
adb_init();
|
||||
joystick_init();
|
||||
|
58
src/support.h
Normal file
58
src/support.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2009 The DOSBox Team
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* $Id: support.h,v 1.18 2009/05/27 09:15:41 qbix79 Exp $ */
|
||||
|
||||
#ifndef DOSBOX_SUPPORT_H
|
||||
#define DOSBOX_SUPPORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
typedef signed Bits;
|
||||
|
||||
#if defined (_MSC_VER) /* MS Visual C++ */
|
||||
#define strcasecmp(a,b) stricmp(a,b)
|
||||
#define strncasecmp(a,b,n) _strnicmp(a,b,n)
|
||||
#endif
|
||||
|
||||
#define safe_strncpy(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0)
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
void strreplace(char * str,char o,char n);
|
||||
char *ltrim(char *str);
|
||||
char *rtrim(char *str);
|
||||
char *trim(char * str);
|
||||
char * upcase(char * str);
|
||||
char * lowcase(char * str);
|
||||
|
||||
bool ScanCMDBool(char * cmd,char const * const check);
|
||||
char * ScanCMDRemain(char * cmd);
|
||||
char * StripWord(char *&cmd);
|
||||
bool IsDecWord(char * word);
|
||||
bool IsHexWord(char * word);
|
||||
Bits ConvDecWord(char * word);
|
||||
Bits ConvHexWord(char * word);
|
||||
|
||||
void upcase(std::string &str);
|
||||
void lowcase(std::string &str);
|
||||
|
||||
#endif
|
188
src/tfe/Tfesupp.c
Normal file
188
src/tfe/Tfesupp.c
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* This file is a consolidation of functions required for tfe
|
||||
* emulation taken from the following files
|
||||
*
|
||||
* lib.c - Library functions.
|
||||
* util.c - Miscellaneous utility functions.
|
||||
* crc32.c
|
||||
*
|
||||
* Written by
|
||||
* Andreas Boose <viceteam@t-online.de>
|
||||
* Ettore Perazzoli <ettore@comm2000.it>
|
||||
* Andreas Matthies <andreas.matthies@gmx.net>
|
||||
* Tibor Biczo <crown@mail.matav.hu>
|
||||
* Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de>*
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <tchar.h>
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "tfesupp.h"
|
||||
|
||||
|
||||
// Lib Stuff
|
||||
/* #define LIB_DEBUG*/
|
||||
|
||||
|
||||
#ifdef LIB_DEBUG
|
||||
#define LIB_DEBUG_SIZE 0x10000
|
||||
#define LIB_DEBUG_GUARD 0x1000
|
||||
#endif
|
||||
|
||||
#define CRC32_POLY 0xedb88320
|
||||
static unsigned long crc32_table[256];
|
||||
static int crc32_is_initialized = 0;
|
||||
|
||||
void lib_free(void *ptr)
|
||||
{
|
||||
#ifdef LIB_DEBUG
|
||||
lib_debug_free(ptr, 1, 1);
|
||||
#endif
|
||||
|
||||
#ifdef LIB_DEBUG
|
||||
lib_debug_libc_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *lib_malloc(size_t size)
|
||||
{
|
||||
#ifdef LIB_DEBUG
|
||||
void *ptr = lib_debug_libc_malloc(size);
|
||||
#else
|
||||
void *ptr = malloc(size);
|
||||
#endif
|
||||
|
||||
#ifndef __OS2__
|
||||
if (ptr == NULL && size > 0)
|
||||
exit(-1);
|
||||
#endif
|
||||
#ifdef LIB_DEBUG
|
||||
lib_debug_alloc(ptr, size, 3);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
/* Malloc enough space for `str', copy `str' into it and return its
|
||||
address. */
|
||||
char *lib_stralloc(const char *str)
|
||||
{
|
||||
size_t size;
|
||||
char *ptr;
|
||||
|
||||
if (str == NULL)
|
||||
exit(-1);
|
||||
|
||||
size = strlen(str) + 1;
|
||||
ptr = (char *)lib_malloc(size);
|
||||
|
||||
memcpy(ptr, str, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Like realloc, but abort if not enough memory is available. */
|
||||
void *lib_realloc(void *ptr, size_t size)
|
||||
{
|
||||
#ifdef LIB_DEBUG
|
||||
void *new_ptr = lib_debug_libc_realloc(ptr, size);
|
||||
#else
|
||||
void *new_ptr = realloc(ptr, size);
|
||||
#endif
|
||||
|
||||
#ifndef __OS2__
|
||||
if (new_ptr == NULL)
|
||||
exit(-1);
|
||||
#endif
|
||||
#ifdef LIB_DEBUG
|
||||
lib_debug_free(ptr, 1, 0);
|
||||
lib_debug_alloc(new_ptr, size, 1);
|
||||
#endif
|
||||
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
// Util Stuff
|
||||
|
||||
/* Set a new value to the dynamically allocated string *str.
|
||||
Returns `-1' if nothing has to be done. */
|
||||
int util_string_set(char **str, const char *new_value)
|
||||
{
|
||||
if (*str == NULL) {
|
||||
if (new_value != NULL)
|
||||
*str = lib_stralloc(new_value);
|
||||
} else {
|
||||
if (new_value == NULL) {
|
||||
lib_free(*str);
|
||||
*str = NULL;
|
||||
} else {
|
||||
/* Skip copy if src and dest are already the same. */
|
||||
if (strcmp(*str, new_value) == 0)
|
||||
return -1;
|
||||
|
||||
*str = (char *)lib_realloc(*str, strlen(new_value) + 1);
|
||||
strcpy(*str, new_value);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// crc32 Stuff
|
||||
|
||||
unsigned long crc32_buf(const char *buffer, unsigned int len)
|
||||
{
|
||||
int i, j;
|
||||
unsigned long crc, c;
|
||||
const char *p;
|
||||
|
||||
if (!crc32_is_initialized) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
c = (unsigned long) i;
|
||||
for (j = 0; j < 8; j++)
|
||||
c = c & 1 ? CRC32_POLY ^ (c >> 1) : c >> 1;
|
||||
crc32_table[i] = c;
|
||||
}
|
||||
crc32_is_initialized = 1;
|
||||
}
|
||||
|
||||
crc = 0xffffffff;
|
||||
for (p = buffer; len > 0; ++p, --len)
|
||||
crc = (crc >> 8) ^ crc32_table[(crc ^ *p) & 0xff];
|
||||
|
||||
return ~crc;
|
||||
}
|
||||
|
53
src/tfe/Tfesupp.h
Normal file
53
src/tfe/Tfesupp.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is a consolidation of functions required for tfe
|
||||
* emulation taken from the following files
|
||||
*
|
||||
* lib.h - Library functions.
|
||||
* util.h - Miscellaneous utility functions.
|
||||
* crc32.h
|
||||
*
|
||||
* Written by
|
||||
* Andreas Boose <viceteam@t-online.de>
|
||||
* Ettore Perazzoli <ettore@comm2000.it>
|
||||
* Manfred Spraul <manfreds@colorfullife.com>
|
||||
* Andreas Matthies <andreas.matthies@gmx.net>
|
||||
* Tibor Biczo <crown@mail.matav.hu>
|
||||
* Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de>*
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _TFESUPP_H
|
||||
#define _TFESUPP_H
|
||||
|
||||
extern FILE* g_fh; // Filehandle for log file
|
||||
|
||||
extern void *lib_malloc(size_t size);
|
||||
extern void *lib_realloc(void *p, size_t size);
|
||||
extern void lib_free(void *ptr);
|
||||
extern char *lib_stralloc(const char *str);
|
||||
|
||||
extern int util_string_set(char **str, const char *new_value);
|
||||
|
||||
extern unsigned long crc32_buf(const char *buffer, unsigned int len);
|
||||
|
||||
#endif
|
73
src/tfe/Types.h
Normal file
73
src/tfe/Types.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* types.h - Type definitions for VICE.
|
||||
*
|
||||
* Written by
|
||||
* Ettore Perazzoli <ettore@comm2000.it>
|
||||
* André Fachat <a.fachat@physik.tu-chemnitz.de>
|
||||
* Teemu Rantanen <tvr@cs.hut.fi>
|
||||
* Andreas Boose <viceteam@t-online.de>
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#define _TYPES_H
|
||||
|
||||
/*#ifndef BYTE
|
||||
#define BYTE unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
#define WORD unsigned short
|
||||
#endif*/
|
||||
|
||||
#ifndef DWORD
|
||||
//#ifdef DWORD_IS_LONG
|
||||
#define DWORD unsigned long
|
||||
//#else
|
||||
//#define DWORD unsigned int
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
/* RGJ added for AppleWin */
|
||||
#ifndef ULONG
|
||||
typedef unsigned long ULONG;
|
||||
#endif
|
||||
|
||||
typedef signed char SIGNED_CHAR;
|
||||
typedef signed short SWORD;
|
||||
typedef signed int SDWORD;
|
||||
|
||||
typedef DWORD CLOCK;
|
||||
/* Maximum value of a CLOCK. */
|
||||
#define CLOCK_MAX (~((CLOCK)0))
|
||||
/*
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(NO_REGPARM)
|
||||
#define REGPARM1 __attribute__((regparm(1)))
|
||||
#define REGPARM2 __attribute__((regparm(2)))
|
||||
#define REGPARM3 __attribute__((regparm(3)))
|
||||
#else
|
||||
#define REGPARM1
|
||||
#define REGPARM2
|
||||
#define REGPARM3
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
86
src/tfe/arch/win32/Bittypes.h
Normal file
86
src/tfe/arch/win32/Bittypes.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 1999 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _BITTYPES_H
|
||||
#define _BITTYPES_H
|
||||
|
||||
#ifndef HAVE_U_INT8_T
|
||||
|
||||
#if SIZEOF_CHAR == 1
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef signed char int8_t;
|
||||
#elif SIZEOF_INT == 1
|
||||
typedef unsigned int u_int8_t;
|
||||
typedef signed int int8_t;
|
||||
#else /* XXX */
|
||||
#error "there's no appropriate type for u_int8_t"
|
||||
#endif
|
||||
#define HAVE_U_INT8_T 1
|
||||
#define HAVE_INT8_T 1
|
||||
|
||||
#endif /* HAVE_U_INT8_T */
|
||||
|
||||
#ifndef HAVE_U_INT16_T
|
||||
|
||||
#if SIZEOF_SHORT == 2
|
||||
typedef unsigned short u_int16_t;
|
||||
typedef signed short int16_t;
|
||||
#elif SIZEOF_INT == 2
|
||||
typedef unsigned int u_int16_t;
|
||||
typedef signed int int16_t;
|
||||
#elif SIZEOF_CHAR == 2
|
||||
typedef unsigned char u_int16_t;
|
||||
typedef signed char int16_t;
|
||||
#else /* XXX */
|
||||
#error "there's no appropriate type for u_int16_t"
|
||||
#endif
|
||||
#define HAVE_U_INT16_T 1
|
||||
#define HAVE_INT16_T 1
|
||||
|
||||
#endif /* HAVE_U_INT16_T */
|
||||
|
||||
#ifndef HAVE_U_INT32_T
|
||||
|
||||
#if SIZEOF_INT == 4
|
||||
typedef unsigned int u_int32_t;
|
||||
typedef signed int int32_t;
|
||||
#elif SIZEOF_LONG == 4
|
||||
typedef unsigned long u_int32_t;
|
||||
typedef signed long int32_t;
|
||||
#elif SIZEOF_SHORT == 4
|
||||
typedef unsigned short u_int32_t;
|
||||
typedef signed short int32_t;
|
||||
#else /* XXX */
|
||||
#error "there's no appropriate type for u_int32_t"
|
||||
#endif
|
||||
#define HAVE_U_INT32_T 1
|
||||
#define HAVE_INT32_T 1
|
||||
|
||||
#endif /* HAVE_U_INT32_T */
|
||||
|
||||
#endif /* _BITTYPES_H */
|
516
src/tfe/arch/win32/Bpf.h
Normal file
516
src/tfe/arch/win32/Bpf.h
Normal file
@ -0,0 +1,516 @@
|
||||
/*-
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from the Stanford/CMU enet packet filter,
|
||||
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
|
||||
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
|
||||
* Berkeley Laboratory.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
|
||||
*
|
||||
* @(#) $Header$ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef BPF_MAJOR_VERSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* BSD style release date */
|
||||
#define BPF_RELEASE 199606
|
||||
|
||||
typedef int bpf_int32;
|
||||
typedef u_int bpf_u_int32;
|
||||
|
||||
/*
|
||||
* Alignment macros. BPF_WORDALIGN rounds up to the next
|
||||
* even multiple of BPF_ALIGNMENT.
|
||||
*/
|
||||
#ifndef __NetBSD__
|
||||
#define BPF_ALIGNMENT sizeof(bpf_int32)
|
||||
#else
|
||||
#define BPF_ALIGNMENT sizeof(long)
|
||||
#endif
|
||||
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
|
||||
|
||||
#define BPF_MAXINSNS 512
|
||||
#define BPF_MAXBUFSIZE 0x8000
|
||||
#define BPF_MINBUFSIZE 32
|
||||
|
||||
/*
|
||||
* Structure for BIOCSETF.
|
||||
*/
|
||||
struct bpf_program {
|
||||
u_int bf_len;
|
||||
struct bpf_insn *bf_insns;
|
||||
};
|
||||
|
||||
/*
|
||||
* Struct returned by BIOCGSTATS.
|
||||
*/
|
||||
struct bpf_stat {
|
||||
u_int bs_recv; /* number of packets received */
|
||||
u_int bs_drop; /* number of packets dropped */
|
||||
};
|
||||
|
||||
/*
|
||||
* Struct return by BIOCVERSION. This represents the version number of
|
||||
* the filter language described by the instruction encodings below.
|
||||
* bpf understands a program iff kernel_major == filter_major &&
|
||||
* kernel_minor >= filter_minor, that is, if the value returned by the
|
||||
* running kernel has the same major number and a minor number equal
|
||||
* equal to or less than the filter being downloaded. Otherwise, the
|
||||
* results are undefined, meaning an error may be returned or packets
|
||||
* may be accepted haphazardly.
|
||||
* It has nothing to do with the source code version.
|
||||
*/
|
||||
struct bpf_version {
|
||||
u_short bv_major;
|
||||
u_short bv_minor;
|
||||
};
|
||||
/* Current version number of filter architecture. */
|
||||
#define BPF_MAJOR_VERSION 1
|
||||
#define BPF_MINOR_VERSION 1
|
||||
|
||||
/*
|
||||
* BPF ioctls
|
||||
*
|
||||
* The first set is for compatibility with Sun's pcc style
|
||||
* header files. If your using gcc, we assume that you
|
||||
* have run fixincludes so the latter set should work.
|
||||
*/
|
||||
#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
|
||||
#define BIOCGBLEN _IOR(B,102, u_int)
|
||||
#define BIOCSBLEN _IOWR(B,102, u_int)
|
||||
#define BIOCSETF _IOW(B,103, struct bpf_program)
|
||||
#define BIOCFLUSH _IO(B,104)
|
||||
#define BIOCPROMISC _IO(B,105)
|
||||
#define BIOCGDLT _IOR(B,106, u_int)
|
||||
#define BIOCGETIF _IOR(B,107, struct ifreq)
|
||||
#define BIOCSETIF _IOW(B,108, struct ifreq)
|
||||
#define BIOCSRTIMEOUT _IOW(B,109, struct timeval)
|
||||
#define BIOCGRTIMEOUT _IOR(B,110, struct timeval)
|
||||
#define BIOCGSTATS _IOR(B,111, struct bpf_stat)
|
||||
#define BIOCIMMEDIATE _IOW(B,112, u_int)
|
||||
#define BIOCVERSION _IOR(B,113, struct bpf_version)
|
||||
#define BIOCSTCPF _IOW(B,114, struct bpf_program)
|
||||
#define BIOCSUDPF _IOW(B,115, struct bpf_program)
|
||||
#else
|
||||
#define BIOCGBLEN _IOR('B',102, u_int)
|
||||
#define BIOCSBLEN _IOWR('B',102, u_int)
|
||||
#define BIOCSETF _IOW('B',103, struct bpf_program)
|
||||
#define BIOCFLUSH _IO('B',104)
|
||||
#define BIOCPROMISC _IO('B',105)
|
||||
#define BIOCGDLT _IOR('B',106, u_int)
|
||||
#define BIOCGETIF _IOR('B',107, struct ifreq)
|
||||
#define BIOCSETIF _IOW('B',108, struct ifreq)
|
||||
#define BIOCSRTIMEOUT _IOW('B',109, struct timeval)
|
||||
#define BIOCGRTIMEOUT _IOR('B',110, struct timeval)
|
||||
#define BIOCGSTATS _IOR('B',111, struct bpf_stat)
|
||||
#define BIOCIMMEDIATE _IOW('B',112, u_int)
|
||||
#define BIOCVERSION _IOR('B',113, struct bpf_version)
|
||||
#define BIOCSTCPF _IOW('B',114, struct bpf_program)
|
||||
#define BIOCSUDPF _IOW('B',115, struct bpf_program)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure prepended to each packet.
|
||||
*/
|
||||
struct bpf_hdr {
|
||||
struct timeval bh_tstamp; /* time stamp */
|
||||
bpf_u_int32 bh_caplen; /* length of captured portion */
|
||||
bpf_u_int32 bh_datalen; /* original length of packet */
|
||||
u_short bh_hdrlen; /* length of bpf header (this struct
|
||||
plus alignment padding) */
|
||||
};
|
||||
/*
|
||||
* Because the structure above is not a multiple of 4 bytes, some compilers
|
||||
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
|
||||
* Only the kernel needs to know about it; applications use bh_hdrlen.
|
||||
*/
|
||||
#if defined(KERNEL) || defined(_KERNEL)
|
||||
#define SIZEOF_BPF_HDR 18
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data-link level type codes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are the types that are the same on all platforms; on other
|
||||
* platforms, a <net/bpf.h> should be supplied that defines the additional
|
||||
* DLT_* codes appropriately for that platform (the BSDs, for example,
|
||||
* should not just pick up this version of "bpf.h"; they should also define
|
||||
* the additional DLT_* codes used by their kernels, as well as the values
|
||||
* defined here - and, if the values they use for particular DLT_ types
|
||||
* differ from those here, they should use their values, not the ones
|
||||
* here).
|
||||
*/
|
||||
#define DLT_NULL 0 /* no link-layer encapsulation */
|
||||
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
|
||||
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
|
||||
#define DLT_AX25 3 /* Amateur Radio AX.25 */
|
||||
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
|
||||
#define DLT_CHAOS 5 /* Chaos */
|
||||
#define DLT_IEEE802 6 /* IEEE 802 Networks */
|
||||
#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */
|
||||
#define DLT_SLIP 8 /* Serial Line IP */
|
||||
#define DLT_PPP 9 /* Point-to-point Protocol */
|
||||
#define DLT_FDDI 10 /* FDDI */
|
||||
|
||||
/*
|
||||
* These are values from the traditional libpcap "bpf.h".
|
||||
* Ports of this to particular platforms should replace these definitions
|
||||
* with the ones appropriate to that platform, if the values are
|
||||
* different on that platform.
|
||||
*/
|
||||
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
|
||||
#define DLT_RAW 12 /* raw IP */
|
||||
|
||||
/*
|
||||
* These are values from BSD/OS's "bpf.h".
|
||||
* These are not the same as the values from the traditional libpcap
|
||||
* "bpf.h"; however, these values shouldn't be generated by any
|
||||
* OS other than BSD/OS, so the correct values to use here are the
|
||||
* BSD/OS values.
|
||||
*
|
||||
* Platforms that have already assigned these values to other
|
||||
* DLT_ codes, however, should give these codes the values
|
||||
* from that platform, so that programs that use these codes will
|
||||
* continue to compile - even though they won't correctly read
|
||||
* files of these types.
|
||||
*/
|
||||
#ifdef __NetBSD__
|
||||
#ifndef DLT_SLIP_BSDOS
|
||||
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
|
||||
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
|
||||
#endif
|
||||
#else
|
||||
#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
|
||||
#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
|
||||
#endif
|
||||
|
||||
#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */
|
||||
|
||||
/*
|
||||
* These values are defined by NetBSD; other platforms should refrain from
|
||||
* using them for other purposes, so that NetBSD savefiles with link
|
||||
* types of 50 or 51 can be read as this type on all platforms.
|
||||
*/
|
||||
#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */
|
||||
#define DLT_PPP_ETHER 51 /* PPP over Ethernet */
|
||||
|
||||
/*
|
||||
* Values between 100 and 103 are used in capture file headers as
|
||||
* link-layer types corresponding to DLT_ types that differ
|
||||
* between platforms; don't use those values for new DLT_ new types.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This value was defined by libpcap 0.5; platforms that have defined
|
||||
* it with a different value should define it here with that value -
|
||||
* a link type of 104 in a save file will be mapped to DLT_C_HDLC,
|
||||
* whatever value that happens to be, so programs will correctly
|
||||
* handle files with that link type regardless of the value of
|
||||
* DLT_C_HDLC.
|
||||
*
|
||||
* The name DLT_C_HDLC was used by BSD/OS; we use that name for source
|
||||
* compatibility with programs written for BSD/OS.
|
||||
*
|
||||
* libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
|
||||
* for source compatibility with programs written for libpcap 0.5.
|
||||
*/
|
||||
#define DLT_C_HDLC 104 /* Cisco HDLC */
|
||||
#define DLT_CHDLC DLT_C_HDLC
|
||||
|
||||
#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */
|
||||
|
||||
/*
|
||||
* 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,
|
||||
* except when it isn't. (I.e., sometimes it's just raw IP, and
|
||||
* sometimes it isn't.) We currently handle it as DLT_LINUX_SLL,
|
||||
* so that we don't have to worry about the link-layer header.)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
|
||||
* with other values.
|
||||
* DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
|
||||
* (DLCI, etc.).
|
||||
*/
|
||||
#define DLT_FRELAY 107
|
||||
|
||||
/*
|
||||
* OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
|
||||
* that the AF_ type in the link-layer header is in network byte order.
|
||||
*
|
||||
* OpenBSD defines it as 12, but that collides with DLT_RAW, so we
|
||||
* define it as 108 here. If OpenBSD picks up this file, it should
|
||||
* define DLT_LOOP as 12 in its version, as per the comment above -
|
||||
* and should not use 108 as a DLT_ value.
|
||||
*/
|
||||
#define DLT_LOOP 108
|
||||
|
||||
/*
|
||||
* Values between 109 and 112 are used in capture file headers as
|
||||
* link-layer types corresponding to DLT_ types that might differ
|
||||
* between platforms; don't use those values for new DLT_ types
|
||||
* other than the corresponding DLT_ types.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is for Linux cooked sockets.
|
||||
*/
|
||||
#define DLT_LINUX_SLL 113
|
||||
|
||||
/*
|
||||
* Apple LocalTalk hardware.
|
||||
*/
|
||||
#define DLT_LTALK 114
|
||||
|
||||
/*
|
||||
* Acorn Econet.
|
||||
*/
|
||||
#define DLT_ECONET 115
|
||||
|
||||
/*
|
||||
* Reserved for use with OpenBSD ipfilter.
|
||||
*/
|
||||
#define DLT_IPFILTER 116
|
||||
|
||||
/*
|
||||
* Reserved for use in capture-file headers as a link-layer type
|
||||
* corresponding to OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD,
|
||||
* but that's DLT_LANE8023 in SuSE 6.3, so we can't use 17 for it
|
||||
* in capture-file headers.
|
||||
*/
|
||||
#define DLT_PFLOG 117
|
||||
|
||||
/*
|
||||
* Registered for Cisco-internal use.
|
||||
*/
|
||||
#define DLT_CISCO_IOS 118
|
||||
|
||||
/*
|
||||
* Reserved for 802.11 cards using the Prism II chips, with a link-layer
|
||||
* header including Prism monitor mode information plus an 802.11
|
||||
* header.
|
||||
*/
|
||||
#define DLT_PRISM_HEADER 119
|
||||
|
||||
/*
|
||||
* Reserved for Aironet 802.11 cards, with an Aironet link-layer header
|
||||
* (see Doug Ambrisko's FreeBSD patches).
|
||||
*/
|
||||
#define DLT_AIRONET_HEADER 120
|
||||
|
||||
/*
|
||||
* Reserved for Siemens HiPath HDLC.
|
||||
*/
|
||||
#define DLT_HHDLC 121
|
||||
|
||||
/*
|
||||
* This is for RFC 2625 IP-over-Fibre Channel.
|
||||
*
|
||||
* This is not for use with raw Fibre Channel, where the link-layer
|
||||
* header starts with a Fibre Channel frame header; it's for IP-over-FC,
|
||||
* where the link-layer header starts with an RFC 2625 Network_Header
|
||||
* field.
|
||||
*/
|
||||
#define DLT_IP_OVER_FC 122
|
||||
|
||||
/*
|
||||
* This is for Full Frontal ATM on Solaris with SunATM, with a
|
||||
* pseudo-header followed by an AALn PDU.
|
||||
*
|
||||
* There may be other forms of Full Frontal ATM on other OSes,
|
||||
* with different pseudo-headers.
|
||||
*
|
||||
* If ATM software returns a pseudo-header with VPI/VCI information
|
||||
* (and, ideally, packet type information, e.g. signalling, ILMI,
|
||||
* LANE, LLC-multiplexed traffic, etc.), it should not use
|
||||
* DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump
|
||||
* and the like don't have to infer the presence or absence of a
|
||||
* pseudo-header and the form of the pseudo-header.
|
||||
*/
|
||||
#define DLT_SUNATM 123 /* Solaris+SunATM */
|
||||
|
||||
/*
|
||||
* Reserved as per request from Kent Dahlgren <kent@praesum.com>
|
||||
* for private use.
|
||||
*/
|
||||
#define DLT_RIO 124 /* RapidIO */
|
||||
#define DLT_PCI_EXP 125 /* PCI Express */
|
||||
#define DLT_AURORA 126 /* Xilinx Aurora link layer */
|
||||
|
||||
/*
|
||||
* For future use with 802.11 captures - defined by AbsoluteValue
|
||||
* Systems to store a number of bits of link-layer information:
|
||||
*
|
||||
* http://www.shaftnet.org/~pizza/software/capturefrm.txt
|
||||
*
|
||||
* but could and arguably should also be used by non-AVS Linux
|
||||
* 802.11 drivers and BSD drivers; that may happen in the future.
|
||||
*/
|
||||
#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus WLAN header */
|
||||
|
||||
/*
|
||||
* Reserved for the TZSP encapsulation, as per request from
|
||||
* Chris Waters <chris.waters@networkchemistry.com>
|
||||
* TZSP is a generic encapsulation for any other link type,
|
||||
* which includes a means to include meta-information
|
||||
* with the packet, e.g. signal strength and channel
|
||||
* for 802.11 packets.
|
||||
*/
|
||||
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
|
||||
|
||||
/*
|
||||
* BSD's ARCNET headers have the source host, destination host,
|
||||
* and type at the beginning of the packet; that's what's handed
|
||||
* up to userland via BPF.
|
||||
*
|
||||
* Linux's ARCNET headers, however, have a 2-byte offset field
|
||||
* between the host IDs and the type; that's what's handed up
|
||||
* to userland via PF_PACKET sockets.
|
||||
*
|
||||
* We therefore have to have separate DLT_ values for them.
|
||||
*/
|
||||
#define DLT_ARCNET_LINUX 129 /* ARCNET */
|
||||
|
||||
/*
|
||||
* The instruction encodings.
|
||||
*/
|
||||
/* instruction classes */
|
||||
#define BPF_CLASS(code) ((code) & 0x07)
|
||||
#define BPF_LD 0x00
|
||||
#define BPF_LDX 0x01
|
||||
#define BPF_ST 0x02
|
||||
#define BPF_STX 0x03
|
||||
#define BPF_ALU 0x04
|
||||
#define BPF_JMP 0x05
|
||||
#define BPF_RET 0x06
|
||||
#define BPF_MISC 0x07
|
||||
|
||||
/* ld/ldx fields */
|
||||
#define BPF_SIZE(code) ((code) & 0x18)
|
||||
#define BPF_W 0x00
|
||||
#define BPF_H 0x08
|
||||
#define BPF_B 0x10
|
||||
#define BPF_MODE(code) ((code) & 0xe0)
|
||||
#define BPF_IMM 0x00
|
||||
#define BPF_ABS 0x20
|
||||
#define BPF_IND 0x40
|
||||
#define BPF_MEM 0x60
|
||||
#define BPF_LEN 0x80
|
||||
#define BPF_MSH 0xa0
|
||||
|
||||
/* alu/jmp fields */
|
||||
#define BPF_OP(code) ((code) & 0xf0)
|
||||
#define BPF_ADD 0x00
|
||||
#define BPF_SUB 0x10
|
||||
#define BPF_MUL 0x20
|
||||
#define BPF_DIV 0x30
|
||||
#define BPF_OR 0x40
|
||||
#define BPF_AND 0x50
|
||||
#define BPF_LSH 0x60
|
||||
#define BPF_RSH 0x70
|
||||
#define BPF_NEG 0x80
|
||||
#define BPF_JA 0x00
|
||||
#define BPF_JEQ 0x10
|
||||
#define BPF_JGT 0x20
|
||||
#define BPF_JGE 0x30
|
||||
#define BPF_JSET 0x40
|
||||
#define BPF_SRC(code) ((code) & 0x08)
|
||||
#define BPF_K 0x00
|
||||
#define BPF_X 0x08
|
||||
|
||||
/* ret - BPF_K and BPF_X also apply */
|
||||
#define BPF_RVAL(code) ((code) & 0x18)
|
||||
#define BPF_A 0x10
|
||||
|
||||
/* misc */
|
||||
#define BPF_MISCOP(code) ((code) & 0xf8)
|
||||
#define BPF_TAX 0x00
|
||||
#define BPF_TXA 0x80
|
||||
|
||||
/*
|
||||
* The instruction data structure.
|
||||
*/
|
||||
struct bpf_insn {
|
||||
u_short code;
|
||||
u_char jt;
|
||||
u_char jf;
|
||||
bpf_int32 k;
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for insn array initializers.
|
||||
*/
|
||||
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
|
||||
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
|
||||
|
||||
#if defined(BSD) && (defined(KERNEL) || defined(_KERNEL))
|
||||
/*
|
||||
* Systems based on non-BSD kernels don't have ifnet's (or they don't mean
|
||||
* anything if it is in <net/if.h>) and won't work like this.
|
||||
*/
|
||||
# if __STDC__
|
||||
extern void bpf_tap(struct ifnet *, u_char *, u_int);
|
||||
extern void bpf_mtap(struct ifnet *, struct mbuf *);
|
||||
extern void bpfattach(struct ifnet *, u_int, u_int);
|
||||
extern void bpfilterattach(int);
|
||||
# else
|
||||
extern void bpf_tap();
|
||||
extern void bpf_mtap();
|
||||
extern void bpfattach();
|
||||
extern void bpfilterattach();
|
||||
# endif /* __STDC__ */
|
||||
#endif /* BSD && (_KERNEL || KERNEL) */
|
||||
#if __STDC__ || defined(__cplusplus)
|
||||
extern int bpf_validate(struct bpf_insn *, int);
|
||||
extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
|
||||
#else
|
||||
extern int bpf_validate();
|
||||
extern u_int bpf_filter();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
|
||||
*/
|
||||
#define BPF_MEMWORDS 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
159
src/tfe/arch/win32/Ip6_misc.h
Normal file
159
src/tfe/arch/win32/Ip6_misc.h
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header$ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
#ifndef __MINGW32__
|
||||
#include <ws2tcpip.h>
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#define IN_MULTICAST(a) IN_CLASSD(a)
|
||||
|
||||
#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xe0000000) == 0xe0000000)
|
||||
|
||||
#define IN_LOOPBACKNET 127
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* IPv6 address */
|
||||
struct in6_addr
|
||||
{
|
||||
union
|
||||
{
|
||||
u_int8_t u6_addr8[16];
|
||||
u_int16_t u6_addr16[8];
|
||||
u_int32_t u6_addr32[4];
|
||||
} in6_u;
|
||||
#define s6_addr in6_u.u6_addr8
|
||||
#define s6_addr16 in6_u.u6_addr16
|
||||
#define s6_addr32 in6_u.u6_addr32
|
||||
#define s6_addr64 in6_u.u6_addr64
|
||||
};
|
||||
|
||||
#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
typedef unsigned short sa_family_t;
|
||||
|
||||
#define __SOCKADDR_COMMON(sa_prefix) \
|
||||
sa_family_t sa_prefix##family
|
||||
|
||||
/* Ditto, for IPv6. */
|
||||
struct sockaddr_in6
|
||||
{
|
||||
__SOCKADDR_COMMON (sin6_);
|
||||
u_int16_t sin6_port; /* Transport layer port # */
|
||||
u_int32_t sin6_flowinfo; /* IPv6 flow information */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
};
|
||||
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
|
||||
(((u_int32_t *) (a))[2] == htonl (0xffff)))
|
||||
|
||||
#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
|
||||
|
||||
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
||||
((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
|
||||
|
||||
#define IN6_IS_ADDR_LOOPBACK(a) \
|
||||
(((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
|
||||
((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
|
||||
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
|
||||
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
|
||||
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
|
||||
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
|
||||
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
|
||||
|
||||
#define nd_rd_type nd_rd_hdr.icmp6_type
|
||||
#define nd_rd_code nd_rd_hdr.icmp6_code
|
||||
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
|
||||
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
|
||||
|
||||
/*
|
||||
* IPV6 extension headers
|
||||
*/
|
||||
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
|
||||
#define IPPROTO_IPV6 41 /* IPv6 header. */
|
||||
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
|
||||
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
|
||||
#define IPPROTO_ESP 50 /* encapsulating security payload */
|
||||
#define IPPROTO_AH 51 /* authentication header */
|
||||
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
|
||||
#define IPPROTO_NONE 59 /* IPv6 no next header */
|
||||
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
|
||||
#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */
|
||||
|
||||
#define IPV6_RTHDR_TYPE_0 0
|
||||
|
||||
/* Option types and related macros */
|
||||
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
|
||||
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
|
||||
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
|
||||
#define IP6OPT_JUMBO_LEN 6
|
||||
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */
|
||||
|
||||
#define IP6OPT_RTALERT_LEN 4
|
||||
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
|
||||
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
|
||||
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
|
||||
#define IP6OPT_MINLEN 2
|
||||
|
||||
#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
|
||||
#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
|
||||
#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
|
||||
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
|
||||
#define IP6OPT_EID 0x8a /* 10 0 01010 */
|
||||
|
||||
#define IP6OPT_TYPE(o) ((o) & 0xC0)
|
||||
#define IP6OPT_TYPE_SKIP 0x00
|
||||
#define IP6OPT_TYPE_DISCARD 0x40
|
||||
#define IP6OPT_TYPE_FORCEICMP 0x80
|
||||
#define IP6OPT_TYPE_ICMP 0xC0
|
||||
|
||||
#define IP6OPT_MUTABLE 0x20
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifndef EAI_ADDRFAMILY
|
||||
struct addrinfo {
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
size_t ai_addrlen; /* length of ai_addr */
|
||||
char *ai_canonname; /* canonical name for hostname */
|
||||
struct sockaddr *ai_addr; /* binary address */
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
#endif
|
||||
#endif /* __MINGW32__ */
|
44
src/tfe/arch/win32/pcap-stdinc.h
Normal file
44
src/tfe/arch/win32/pcap-stdinc.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2002
|
||||
* Politecnico di Torino. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the Politecnico
|
||||
* di Torino, and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header$ (LBL)
|
||||
*/
|
||||
|
||||
#define SIZEOF_CHAR 1
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <winsock2.h>
|
||||
#include "bittypes.h"
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
|
||||
#ifndef __MINGW32__
|
||||
#include "IP6_misc.h"
|
||||
#endif
|
||||
|
||||
#define caddr_t char*
|
||||
|
||||
#define snprintf _snprintf
|
||||
//#define vsnprintf _vsnprintf
|
||||
|
273
src/tfe/arch/win32/pcap.h
Normal file
273
src/tfe/arch/win32/pcap.h
Normal file
@ -0,0 +1,273 @@
|
||||
/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header$ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef lib_pcap_h
|
||||
#define lib_pcap_h
|
||||
|
||||
#ifdef WIN32
|
||||
/* RGJ Changed it to "pcap-stdinc.h" for AppleWin */
|
||||
#include "pcap-stdinc.h"
|
||||
#else /* WIN32 */
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* RGJ Changed it to "bpf.h" for AppleWin */
|
||||
#include "bpf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef REMOTE
|
||||
// We have to define the SOCKET here, although it has been defined in sockutils.h
|
||||
// This is to avoid the distribution of the 'sockutils.h' file around
|
||||
// (for example in the WinPcap developer's pack)
|
||||
#ifndef SOCKET
|
||||
#ifdef WIN32
|
||||
#define SOCKET unsigned int
|
||||
#else
|
||||
#define SOCKET int
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PCAP_VERSION_MAJOR 2
|
||||
#define PCAP_VERSION_MINOR 4
|
||||
|
||||
#define PCAP_ERRBUF_SIZE 256
|
||||
|
||||
/*
|
||||
* Compatibility for systems that have a bpf.h that
|
||||
* predates the bpf typedefs for 64-bit support.
|
||||
*/
|
||||
#if BPF_RELEASE - 0 < 199406
|
||||
typedef int bpf_int32;
|
||||
typedef u_int bpf_u_int32;
|
||||
#endif
|
||||
|
||||
typedef struct pcap pcap_t;
|
||||
typedef struct pcap_dumper pcap_dumper_t;
|
||||
typedef struct pcap_if pcap_if_t;
|
||||
typedef struct pcap_addr pcap_addr_t;
|
||||
|
||||
/*
|
||||
* The first record in the file contains saved values for some
|
||||
* of the flags used in the printout phases of tcpdump.
|
||||
* Many fields here are 32 bit ints so compilers won't insert unwanted
|
||||
* padding; these files need to be interchangeable across architectures.
|
||||
*
|
||||
* Do not change the layout of this structure, in any way (this includes
|
||||
* changes that only affect the length of fields in this structure).
|
||||
*
|
||||
* Also, do not change the interpretation of any of the members of this
|
||||
* structure, in any way (this includes using values other than
|
||||
* LINKTYPE_ values, as defined in "savefile.c", in the "linktype"
|
||||
* field).
|
||||
*
|
||||
* Instead:
|
||||
*
|
||||
* introduce a new structure for the new format, if the layout
|
||||
* of the structure changed;
|
||||
*
|
||||
* send mail to "tcpdump-workers@tcpdump.org", requesting a new
|
||||
* magic number for your new capture file format, and, when
|
||||
* you get the new magic number, put it in "savefile.c";
|
||||
*
|
||||
* use that magic number for save files with the changed file
|
||||
* header;
|
||||
*
|
||||
* make the code in "savefile.c" capable of reading files with
|
||||
* the old file header as well as files with the new file header
|
||||
* (using the magic number to determine the header format).
|
||||
*
|
||||
* Then supply the changes to "patches@tcpdump.org", so that future
|
||||
* versions of libpcap and programs that use it (such as tcpdump) will
|
||||
* be able to read your new capture file format.
|
||||
*/
|
||||
struct pcap_file_header {
|
||||
bpf_u_int32 magic;
|
||||
u_short version_major;
|
||||
u_short version_minor;
|
||||
bpf_int32 thiszone; /* gmt to local correction */
|
||||
bpf_u_int32 sigfigs; /* accuracy of timestamps */
|
||||
bpf_u_int32 snaplen; /* max length saved portion of each pkt */
|
||||
bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Each packet in the dump file is prepended with this generic header.
|
||||
* This gets around the problem of different headers for different
|
||||
* packet interfaces.
|
||||
*/
|
||||
struct pcap_pkthdr {
|
||||
struct timeval ts; /* time stamp */
|
||||
bpf_u_int32 caplen; /* length of portion present */
|
||||
bpf_u_int32 len; /* length this packet (off wire) */
|
||||
};
|
||||
|
||||
/*
|
||||
* As returned by the pcap_stats()
|
||||
*/
|
||||
struct pcap_stat {
|
||||
u_int ps_recv; /* number of packets received */
|
||||
u_int ps_drop; /* number of packets dropped */
|
||||
u_int ps_ifdrop; /* drops by interface XXX not yet supported */
|
||||
#ifdef REMOTE
|
||||
#ifdef WIN32
|
||||
// u_int bs_capt; /* number of packets that reach the application */
|
||||
#endif /* WIN32 */
|
||||
u_int ps_capt; /* number of packets that reach the application; please get rid off the Win32 ifdef */
|
||||
u_int ps_sent; /* number of packets sent by the server on the network */
|
||||
u_int ps_netdrop; /* number of packets lost on the network */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Item in a list of interfaces.
|
||||
*/
|
||||
struct pcap_if {
|
||||
struct pcap_if *next;
|
||||
char *name; /* name to hand to "pcap_open_live()" */
|
||||
char *description; /* textual description of interface, or NULL */
|
||||
struct pcap_addr *addresses;
|
||||
bpf_u_int32 flags; /* PCAP_IF_ interface flags */
|
||||
};
|
||||
|
||||
#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */
|
||||
|
||||
/*
|
||||
* Representation of an interface address.
|
||||
*/
|
||||
struct pcap_addr {
|
||||
struct pcap_addr *next;
|
||||
struct sockaddr *addr; /* address */
|
||||
struct sockaddr *netmask; /* netmask for that address */
|
||||
struct sockaddr *broadaddr; /* broadcast address for that address */
|
||||
struct sockaddr *dstaddr; /* P2P destination address for that address */
|
||||
};
|
||||
|
||||
typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
|
||||
char *pcap_lookupdev(char *);
|
||||
int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);
|
||||
pcap_t *pcap_open_live(const char *, int, int, int, char *);
|
||||
pcap_t *pcap_open_dead(int, int);
|
||||
pcap_t *pcap_open_offline(const char *, char *);
|
||||
void pcap_close(pcap_t *);
|
||||
int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
|
||||
int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *);
|
||||
const u_char*
|
||||
pcap_next(pcap_t *, struct pcap_pkthdr *);
|
||||
int pcap_stats(pcap_t *, struct pcap_stat *);
|
||||
int pcap_setfilter(pcap_t *, struct bpf_program *);
|
||||
int pcap_getnonblock(pcap_t *, char *);
|
||||
int pcap_setnonblock(pcap_t *, int, char *);
|
||||
void pcap_perror(pcap_t *, char *);
|
||||
char *pcap_strerror(int);
|
||||
char *pcap_geterr(pcap_t *);
|
||||
int pcap_compile(pcap_t *, struct bpf_program *, char *, int,
|
||||
bpf_u_int32);
|
||||
int pcap_compile_nopcap(int, int, struct bpf_program *,
|
||||
char *, int, bpf_u_int32);
|
||||
void pcap_freecode(struct bpf_program *);
|
||||
int pcap_datalink(pcap_t *);
|
||||
int pcap_list_datalinks(pcap_t *, int **);
|
||||
int pcap_set_datalink(pcap_t *, int);
|
||||
int pcap_datalink_name_to_val(const char *);
|
||||
const char *pcap_datalink_val_to_name(int);
|
||||
int pcap_snapshot(pcap_t *);
|
||||
int pcap_is_swapped(pcap_t *);
|
||||
int pcap_major_version(pcap_t *);
|
||||
int pcap_minor_version(pcap_t *);
|
||||
|
||||
/* XXX */
|
||||
FILE *pcap_file(pcap_t *);
|
||||
int pcap_fileno(pcap_t *);
|
||||
|
||||
pcap_dumper_t *pcap_dump_open(pcap_t *, const char *);
|
||||
int pcap_dump_flush(pcap_dumper_t *);
|
||||
void pcap_dump_close(pcap_dumper_t *);
|
||||
void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
int pcap_findalldevs(pcap_if_t **, char *);
|
||||
void pcap_freealldevs(pcap_if_t *);
|
||||
|
||||
/* To avoid callback, this returns one packet at a time */
|
||||
int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, u_char **pkt_data);
|
||||
|
||||
/* XXX this guy lives in the bpf tree */
|
||||
u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
|
||||
int bpf_validate(struct bpf_insn *f, int len);
|
||||
char *bpf_image(struct bpf_insn *, int);
|
||||
void bpf_dump(struct bpf_program *, int);
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Win32 definitions
|
||||
*/
|
||||
|
||||
int pcap_setbuff(pcap_t *p, int dim);
|
||||
int pcap_setmode(pcap_t *p, int mode);
|
||||
int pcap_sendpacket(pcap_t *p, u_char *buf, int size);
|
||||
int pcap_setmintocopy(pcap_t *p, int size);
|
||||
|
||||
#ifdef WPCAP
|
||||
/* Include file with the wpcap-specific extensions */
|
||||
#include <Win32-Extensions.h>
|
||||
#endif
|
||||
|
||||
#define MODE_CAPT 0
|
||||
#define MODE_STAT 1
|
||||
#define MODE_MON 2
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef REMOTE
|
||||
/* Includes most of the public stuff that is needed for the remote capture */
|
||||
#include "remote-ext.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
556
src/tfe/arch/win32/tfearch.c
Normal file
556
src/tfe/arch/win32/tfearch.c
Normal file
@ -0,0 +1,556 @@
|
||||
/*
|
||||
* tfearch.c - TFE ("The final ethernet") emulation,
|
||||
* architecture-dependant stuff
|
||||
*
|
||||
* Written by
|
||||
* Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de>
|
||||
*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* #define WPCAP */
|
||||
|
||||
#include "pcap.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "..\..\defc.h"
|
||||
|
||||
|
||||
typedef pcap_t *(*pcap_open_live_t)(const char *, int, int, int, char *);
|
||||
typedef int (*pcap_dispatch_t)(pcap_t *, int, pcap_handler, u_char *);
|
||||
typedef int (*pcap_setnonblock_t)(pcap_t *, int, char *);
|
||||
typedef int (*pcap_datalink_t)(pcap_t *);
|
||||
typedef int (*pcap_findalldevs_t)(pcap_if_t **, char *);
|
||||
typedef void (*pcap_freealldevs_t)(pcap_if_t *);
|
||||
typedef int (*pcap_sendpacket_t)(pcap_t *p, u_char *buf, int size);
|
||||
|
||||
/** #define TFE_DEBUG_ARCH 1 **/
|
||||
/** #define TFE_DEBUG_PKTDUMP 1 **/
|
||||
|
||||
/* #define TFE_DEBUG_FRAMES - might be defined in TFE.H! */
|
||||
|
||||
#define TFE_DEBUG_WARN 1 /* this should not be deactivated */
|
||||
|
||||
static pcap_open_live_t p_pcap_open_live;
|
||||
static pcap_dispatch_t p_pcap_dispatch;
|
||||
static pcap_setnonblock_t p_pcap_setnonblock;
|
||||
static pcap_findalldevs_t p_pcap_findalldevs;
|
||||
static pcap_freealldevs_t p_pcap_freealldevs;
|
||||
static pcap_sendpacket_t p_pcap_sendpacket;
|
||||
static pcap_datalink_t p_pcap_datalink;
|
||||
|
||||
static HINSTANCE pcap_library = NULL;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* variables needed */
|
||||
|
||||
|
||||
//static log_t tfe_arch_log = LOG_ERR;
|
||||
|
||||
|
||||
static pcap_if_t *TfePcapNextDev = NULL;
|
||||
static pcap_if_t *TfePcapAlldevs = NULL;
|
||||
static pcap_t *TfePcapFP = NULL;
|
||||
|
||||
static char TfePcapErrbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
#ifdef TFE_DEBUG_PKTDUMP
|
||||
|
||||
static
|
||||
void debug_output( const char *text, BYTE *what, int count )
|
||||
{
|
||||
char buffer[256];
|
||||
char *p = buffer;
|
||||
char *pbuffer1 = what;
|
||||
int len1 = count;
|
||||
int i;
|
||||
|
||||
sprintf(buffer, "\n%s: length = %u\n", text, len1);
|
||||
OutputDebugString(buffer);
|
||||
do {
|
||||
p = buffer;
|
||||
for (i=0; (i<8) && len1>0; len1--, i++) {
|
||||
sprintf( p, "%02x ", (unsigned int)(unsigned char)*pbuffer1++);
|
||||
p += 3;
|
||||
}
|
||||
*(p-1) = '\n'; *p = 0;
|
||||
OutputDebugString(buffer);
|
||||
} while (len1>0);
|
||||
}
|
||||
#endif // #ifdef TFE_DEBUG_PKTDUMP
|
||||
|
||||
|
||||
static
|
||||
void TfePcapFreeLibrary(void)
|
||||
{
|
||||
if (pcap_library) {
|
||||
if (!FreeLibrary(pcap_library)) {
|
||||
//log_message(tfe_arch_log, "FreeLibrary WPCAP.DLL failed!");
|
||||
}
|
||||
pcap_library = NULL;
|
||||
|
||||
p_pcap_open_live = NULL;
|
||||
p_pcap_dispatch = NULL;
|
||||
p_pcap_setnonblock = NULL;
|
||||
p_pcap_findalldevs = NULL;
|
||||
p_pcap_freealldevs = NULL;
|
||||
p_pcap_sendpacket = NULL;
|
||||
p_pcap_datalink = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* since I don't like typing too much... */
|
||||
#define GET_PROC_ADDRESS_AND_TEST( _name_ ) \
|
||||
p_##_name_ = (_name_##_t) GetProcAddress(pcap_library, #_name_ ); \
|
||||
if (!p_##_name_ ) { \
|
||||
/*log_message(tfe_arch_log, "GetProcAddress " #_name_ " failed!");*/ \
|
||||
TfePcapFreeLibrary(); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
static
|
||||
BOOL TfePcapLoadLibrary(void)
|
||||
{
|
||||
if (!pcap_library) {
|
||||
pcap_library = LoadLibrary("wpcap.dll");
|
||||
|
||||
if (!pcap_library) {
|
||||
//log_message(tfe_arch_log, "LoadLibrary WPCAP.DLL failed!" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_open_live);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_dispatch);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_setnonblock);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_findalldevs);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_freealldevs);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_sendpacket);
|
||||
GET_PROC_ADDRESS_AND_TEST(pcap_datalink);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef GET_PROC_ADDRESS_AND_TEST
|
||||
|
||||
|
||||
/*
|
||||
static
|
||||
void TfePcapCloseAdapter(void)
|
||||
{
|
||||
if (TfePcapAlldevs) {
|
||||
(*p_pcap_freealldevs)(TfePcapAlldevs);
|
||||
TfePcapAlldevs = NULL;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
These functions let the UI enumerate the available interfaces.
|
||||
|
||||
First, TfeEnumAdapterOpen() is used to start enumeration.
|
||||
|
||||
TfeEnumAdapter is then used to gather information for each adapter present
|
||||
on the system, where:
|
||||
|
||||
ppname points to a pointer which will hold the name of the interface
|
||||
ppdescription points to a pointer which will hold the description of the interface
|
||||
|
||||
For each of these parameters, new memory is allocated, so it has to be
|
||||
freed with lib_free().
|
||||
|
||||
TfeEnumAdapterClose() must be used to stop processing.
|
||||
|
||||
Each function returns 1 on success, and 0 on failure.
|
||||
TfeEnumAdapter() only fails if there is no more adpater; in this case,
|
||||
*ppname and *ppdescription are not altered.
|
||||
*/
|
||||
int tfe_arch_enumadapter_open(void)
|
||||
{
|
||||
if (!TfePcapLoadLibrary()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((*p_pcap_findalldevs)(&TfePcapAlldevs, TfePcapErrbuf) == -1)
|
||||
{
|
||||
//log_message(tfe_arch_log, "ERROR in TfeEnumAdapterOpen: pcap_findalldevs: '%s'", TfePcapErrbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!TfePcapAlldevs) {
|
||||
/*log_message(tfe_arch_log, "ERROR in TfeEnumAdapterOpen, finding all pcap devices - "
|
||||
"Do we have the necessary privilege rights?");*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
TfePcapNextDev = TfePcapAlldevs;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int tfe_arch_enumadapter(char **ppname, char **ppdescription)
|
||||
{
|
||||
if (!TfePcapNextDev)
|
||||
return 0;
|
||||
|
||||
*ppname = lib_stralloc(TfePcapNextDev->name);
|
||||
*ppdescription = lib_stralloc(TfePcapNextDev->description);
|
||||
|
||||
TfePcapNextDev = TfePcapNextDev->next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int tfe_arch_enumadapter_close(void)
|
||||
{
|
||||
if (TfePcapAlldevs) {
|
||||
(*p_pcap_freealldevs)(TfePcapAlldevs);
|
||||
TfePcapAlldevs = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static
|
||||
BOOL TfePcapOpenAdapter(const char *interface_name)
|
||||
{
|
||||
pcap_if_t *TfePcapDevice = NULL;
|
||||
|
||||
if (!tfe_enumadapter_open()) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
/* look if we can find the specified adapter */
|
||||
char *pname;
|
||||
char *pdescription;
|
||||
BOOL found = FALSE;
|
||||
|
||||
if (interface_name) {
|
||||
/* we have an interface name, try it */
|
||||
TfePcapDevice = TfePcapAlldevs;
|
||||
|
||||
while (tfe_enumadapter(&pname, &pdescription)) {
|
||||
if (strcmp(pname, interface_name)==0) {
|
||||
found = TRUE;
|
||||
}
|
||||
lib_free(pname);
|
||||
lib_free(pdescription);
|
||||
if (found) break;
|
||||
TfePcapDevice = TfePcapNextDev;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
/* just take the first adapter */
|
||||
TfePcapDevice = TfePcapAlldevs;
|
||||
}
|
||||
}
|
||||
|
||||
TfePcapFP = (*p_pcap_open_live)(TfePcapDevice->name, 1700, 1, 20, TfePcapErrbuf);
|
||||
if ( TfePcapFP == NULL)
|
||||
{
|
||||
//log_message(tfe_arch_log, "ERROR opening adapter: '%s'", TfePcapErrbuf);
|
||||
tfe_enumadapter_close();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((*p_pcap_setnonblock)(TfePcapFP, 1, TfePcapErrbuf)<0)
|
||||
{
|
||||
//log_message(tfe_arch_log, "WARNING: Setting PCAP to non-blocking failed: '%s'", TfePcapErrbuf);
|
||||
}
|
||||
|
||||
/* Check the link layer. We support only Ethernet for simplicity. */
|
||||
if((*p_pcap_datalink)(TfePcapFP) != DLT_EN10MB)
|
||||
{
|
||||
//log_message(tfe_arch_log, "ERROR: TFE works only on Ethernet networks.");
|
||||
tfe_enumadapter_close();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tfe_enumadapter_close();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* the architecture-dependend functions */
|
||||
|
||||
|
||||
int tfe_arch_init(void)
|
||||
{
|
||||
//tfe_arch_log = log_open("TFEARCH");
|
||||
|
||||
if (!TfePcapLoadLibrary()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void tfe_arch_pre_reset( void )
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_pre_reset()." );
|
||||
#endif
|
||||
}
|
||||
|
||||
void tfe_arch_post_reset( void )
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_post_reset()." );
|
||||
#endif
|
||||
}
|
||||
|
||||
int tfe_arch_activate(const char *interface_name)
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_activate()." );
|
||||
#endif
|
||||
if (!TfePcapOpenAdapter(interface_name)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void tfe_arch_deactivate( void )
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_deactivate()." );
|
||||
#endif
|
||||
}
|
||||
|
||||
void tfe_arch_set_mac( const BYTE mac[6] )
|
||||
{
|
||||
#if defined(TFE_DEBUG_ARCH) || defined(TFE_DEBUG_FRAMES)
|
||||
log_message( tfe_arch_log, "New MAC address set: %02X:%02X:%02X:%02X:%02X:%02X.",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
|
||||
#endif
|
||||
}
|
||||
|
||||
void tfe_arch_set_hashfilter(const int hash_mask[2])
|
||||
{
|
||||
#if defined(TFE_DEBUG_ARCH) || defined(TFE_DEBUG_FRAMES)
|
||||
log_message( tfe_arch_log, "New hash filter set: %08X:%08X.",
|
||||
hash_mask[1], hash_mask[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void tfe_arch_receive_remove_committed_frame(void)
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_receive_remove_committed_frame()." );
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
void tfe_arch_recv_ctl( int bBroadcast, /* broadcast */
|
||||
int bIA, /* individual address (IA) */
|
||||
int bMulticast, /* multicast if address passes the hash filter */
|
||||
int bCorrect, /* accept correct frames */
|
||||
int bPromiscuous, /* promiscuous mode */
|
||||
int bIAHash /* accept if IA passes the hash filter */
|
||||
)
|
||||
{
|
||||
#if defined(TFE_DEBUG_ARCH) || defined(TFE_DEBUG_FRAMES)
|
||||
log_message( tfe_arch_log, "tfe_arch_recv_ctl() called with the following parameters:" );
|
||||
log_message( tfe_arch_log, "\tbBroadcast = %s", bBroadcast ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbIA = %s", bIA ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbMulticast = %s", bMulticast ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbCorrect = %s", bCorrect ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbPromiscuous = %s", bPromiscuous ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbIAHash = %s", bIAHash ? "TRUE" : "FALSE" );
|
||||
#endif
|
||||
}
|
||||
|
||||
void tfe_arch_line_ctl(int bEnableTransmitter, int bEnableReceiver )
|
||||
{
|
||||
#if defined(TFE_DEBUG_ARCH) || defined(TFE_DEBUG_FRAMES)
|
||||
log_message( tfe_arch_log, "tfe_arch_line_ctl() called with the following parameters:" );
|
||||
log_message( tfe_arch_log, "\tbEnableTransmitter = %s", bEnableTransmitter ? "TRUE" : "FALSE" );
|
||||
log_message( tfe_arch_log, "\tbEnableReceiver = %s", bEnableReceiver ? "TRUE" : "FALSE" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
typedef struct TFE_PCAP_INTERNAL_tag {
|
||||
|
||||
unsigned int len;
|
||||
BYTE *buffer;
|
||||
|
||||
} TFE_PCAP_INTERNAL;
|
||||
|
||||
/* Callback function invoked by libpcap for every incoming packet */
|
||||
static
|
||||
void TfePcapPacketHandler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
|
||||
{
|
||||
TFE_PCAP_INTERNAL *pinternal = (void*)param;
|
||||
|
||||
/* determine the count of bytes which has been returned,
|
||||
* but make sure not to overrun the buffer
|
||||
*/
|
||||
if (header->caplen < pinternal->len)
|
||||
pinternal->len = header->caplen;
|
||||
|
||||
memcpy(pinternal->buffer, pkt_data, pinternal->len);
|
||||
}
|
||||
|
||||
/* the following function receives a frame.
|
||||
|
||||
If there's none, it returns a -1.
|
||||
If there is one, it returns the length of the frame in bytes.
|
||||
|
||||
It copies the frame to *buffer and returns the number of copied
|
||||
bytes as return value.
|
||||
|
||||
At most 'len' bytes are copied.
|
||||
*/
|
||||
static
|
||||
int tfe_arch_receive_frame(TFE_PCAP_INTERNAL *pinternal)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
/* check if there is something to receive */
|
||||
if ((*p_pcap_dispatch)(TfePcapFP, 1, TfePcapPacketHandler, (void*)pinternal)!=0) {
|
||||
/* Something has been received */
|
||||
ret = pinternal->len;
|
||||
}
|
||||
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_receive_frame() called, returns %d.", ret );
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void tfe_arch_transmit(int force, /* FORCE: Delete waiting frames in transmit buffer */
|
||||
int onecoll, /* ONECOLL: Terminate after just one collision */
|
||||
int inhibit_crc, /* INHIBITCRC: Do not append CRC to the transmission */
|
||||
int tx_pad_dis, /* TXPADDIS: Disable padding to 60 Bytes */
|
||||
int txlength, /* Frame length */
|
||||
BYTE *txframe /* Pointer to the frame to be transmitted */
|
||||
)
|
||||
{
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_transmit() called, with: "
|
||||
"force = %s, onecoll = %s, inhibit_crc=%s, tx_pad_dis=%s, txlength=%u",
|
||||
force ? "TRUE" : "FALSE",
|
||||
onecoll ? "TRUE" : "FALSE",
|
||||
inhibit_crc ? "TRUE" : "FALSE",
|
||||
tx_pad_dis ? "TRUE" : "FALSE",
|
||||
txlength
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef TFE_DEBUG_PKTDUMP
|
||||
debug_output( "Transmit frame: ", txframe, txlength);
|
||||
#endif // #ifdef TFE_DEBUG_PKTDUMP
|
||||
|
||||
if ((*p_pcap_sendpacket)(TfePcapFP, txframe, txlength) == -1) {
|
||||
//log_message(tfe_arch_log, "WARNING! Could not send packet!");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
tfe_arch_receive()
|
||||
|
||||
This function checks if there was a frame received.
|
||||
If so, it returns 1, else 0.
|
||||
|
||||
If there was no frame, none of the parameters is changed!
|
||||
|
||||
If there was a frame, the following actions are done:
|
||||
|
||||
- at maximum *plen byte are transferred into the buffer given by pbuffer
|
||||
- *plen gets the length of the received frame, EVEN if this is more
|
||||
than has been copied to pbuffer!
|
||||
- if the dest. address was accepted by the hash filter, *phashed is set, else
|
||||
cleared.
|
||||
- if the dest. address was accepted by the hash filter, *phash_index is
|
||||
set to the number of the rule leading to the acceptance
|
||||
- if the receive was ok (good CRC and valid length), *prx_ok is set,
|
||||
else cleared.
|
||||
- if the dest. address was accepted because it's exactly our MAC address
|
||||
(set by tfe_arch_set_mac()), *pcorrect_mac is set, else cleared.
|
||||
- if the dest. address was accepted since it was a broadcast address,
|
||||
*pbroadcast is set, else cleared.
|
||||
- if the received frame had a crc error, *pcrc_error is set, else cleared
|
||||
*/
|
||||
int tfe_arch_receive(BYTE *pbuffer , /* where to store a frame */
|
||||
int *plen, /* IN: maximum length of frame to copy;
|
||||
OUT: length of received frame
|
||||
OUT can be bigger than IN if received frame was
|
||||
longer than supplied buffer */
|
||||
int *phashed, /* set if the dest. address is accepted by the hash filter */
|
||||
int *phash_index, /* hash table index if hashed == TRUE */
|
||||
int *prx_ok, /* set if good CRC and valid length */
|
||||
int *pcorrect_mac, /* set if dest. address is exactly our IA */
|
||||
int *pbroadcast, /* set if dest. address is a broadcast address */
|
||||
int *pcrc_error /* set if received frame had a CRC error */
|
||||
)
|
||||
{
|
||||
int len;
|
||||
|
||||
TFE_PCAP_INTERNAL internal = { *plen, pbuffer };
|
||||
|
||||
|
||||
#ifdef TFE_DEBUG_ARCH
|
||||
log_message( tfe_arch_log, "tfe_arch_receive() called, with *plen=%u.", *plen );
|
||||
#endif
|
||||
|
||||
assert((*plen&1)==0);
|
||||
|
||||
len = tfe_arch_receive_frame(&internal);
|
||||
|
||||
if (len!=-1) {
|
||||
|
||||
#ifdef TFE_DEBUG_PKTDUMP
|
||||
debug_output( "Received frame: ", internal.buffer, internal.len );
|
||||
#endif // #ifdef TFE_DEBUG_PKTDUMP
|
||||
|
||||
if (len&1)
|
||||
++len;
|
||||
|
||||
*plen = len;
|
||||
|
||||
/* we don't decide if this frame fits the needs;
|
||||
* by setting all zero, we let tfe.c do the work
|
||||
* for us
|
||||
*/
|
||||
*phashed =
|
||||
*phash_index =
|
||||
*pbroadcast =
|
||||
*pcorrect_mac =
|
||||
*pcrc_error = 0;
|
||||
|
||||
/* this frame has been received correctly */
|
||||
*prx_ok = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
1987
src/tfe/tfe.c
Normal file
1987
src/tfe/tfe.c
Normal file
File diff suppressed because it is too large
Load Diff
10
src/vars_kegs32
Normal file
10
src/vars_kegs32
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
TARGET = kegswin.exe
|
||||
OBJECTS = $(OBJECTS1) win32snd_driver.o windriver.o kegs32.o
|
||||
CCOPTS = -O2 -DKEGS_LITTLE_ENDIAN
|
||||
SUFFIX = ".exe"
|
||||
NAME = kegswin
|
||||
|
||||
XOPTS = -Wall -fomit-frame-pointer -march=pentium
|
||||
XLIBS =
|
||||
|
BIN
src/win32.ico
Normal file
BIN
src/win32.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
168
src/win32.rc
168
src/win32.rc
@ -1,24 +1,3 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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 <windows.h>
|
||||
#include "winresource.h"
|
||||
|
||||
@ -28,67 +7,45 @@
|
||||
#define IDC_STATIC (-1)
|
||||
#endif
|
||||
|
||||
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Disk Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,161,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
|
||||
LTEXT "S5D1",IDC_STATIC,19,46,19,8
|
||||
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
|
||||
LTEXT "S5D2",IDC_STATIC,19,62,19,8
|
||||
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
|
||||
LTEXT "S6D1",IDC_STATIC,19,80,19,8
|
||||
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
|
||||
LTEXT "S6D2",IDC_STATIC,19,98,19,8
|
||||
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
|
||||
LTEXT "S7D1",IDC_STATIC,19,118,19,8
|
||||
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
|
||||
LTEXT "S7D2",IDC_STATIC,19,137,19,8
|
||||
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
|
||||
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
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_KEGS32 MENU DISCARDABLE
|
||||
IDC_KEGS32 MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&Emulator"
|
||||
BEGIN
|
||||
MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK
|
||||
MENUITEM "Send CTRL Open-Apple Reset\tCTRL-ALT-BREAK",
|
||||
ID_FILE_SENDRESET
|
||||
MENUITEM "&Set Disk Configuration", ID_FILE_DISK
|
||||
MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET
|
||||
MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK
|
||||
MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT
|
||||
MENUITEM "E&xit", ID_FILE_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "Key Commands", ID_HELP_KEY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RT_MANIFEST
|
||||
//
|
||||
|
||||
// CREATEPROCESS_MANIFEST RT_MANIFEST "kegs.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_TOOLBAR BITMAP DISCARDABLE "wintoolbar.bmp"
|
||||
IDC_KEGS32 BITMAP DISCARDABLE "wintoolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -122,9 +79,102 @@ CAPTION "About"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,78,61,50,14
|
||||
LTEXT "KEGS32: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is free for non-commercial use.",
|
||||
LTEXT "KEGS32: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is licensed under GNU GPL.",
|
||||
IDC_STATIC,38,7,162,45,NOT WS_GROUP
|
||||
ICON "KEGS32_ICON",IDC_STATIC,7,7,21,20,0
|
||||
END
|
||||
|
||||
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Disk Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,161,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
|
||||
LTEXT "S5D1",IDC_STATIC,19,46,19,8
|
||||
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
|
||||
LTEXT "S5D2",IDC_STATIC,19,62,19,8
|
||||
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
|
||||
LTEXT "S6D1",IDC_STATIC,19,80,19,8
|
||||
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
|
||||
LTEXT "S6D2",IDC_STATIC,19,98,19,8
|
||||
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
|
||||
LTEXT "S7D1",IDC_STATIC,19,118,19,8
|
||||
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
|
||||
LTEXT "S7D2",IDC_STATIC,19,137,19,8
|
||||
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,
|
||||
WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
|
||||
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
|
||||
END
|
||||
|
||||
IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Speed Control"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
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 "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
|
||||
EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,133,107,50,15
|
||||
PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15
|
||||
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
|
||||
ICON IDC_KEGS32,IDC_STATIC,14,19,21,20
|
||||
END
|
||||
|
||||
IDD_KEGS32_KEY DIALOG 0, 0, 186, 172
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Help About Key Commands"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,151,50,14
|
||||
LTEXT "KEGS32 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 "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
|
||||
LTEXT "For more information, please consult the readme.kegs file",
|
||||
IDC_STATIC,21,124,144,19
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_DISK "Disk Configuration"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SPEED_1MHZ "Set Speed to 1 Mhz"
|
||||
ID_SPEED_2MHZ "Set Speed to 2.5 Mhz"
|
||||
ID_SPEED_FMHZ "Set Speed to as fast as possible"
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
@ -1,23 +1,12 @@
|
||||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
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
|
||||
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
|
||||
*/
|
||||
/************************************************************************/
|
||||
/* KEGS: Apple //gs Emulator */
|
||||
/* Copyright 2002 by Kent Dickey */
|
||||
/* */
|
||||
/* This code is covered by the GNU GPL */
|
||||
/* */
|
||||
/* The KEGS web page is kegs.sourceforge.net */
|
||||
/* You may contact the author at: kadickey@alumni.princeton.edu */
|
||||
/************************************************************************/
|
||||
|
||||
const char rcsid_win32snd_driver_c[] = "@(#)$KmKId: win32snd_driver.c,v 1.5 2002-11-19 03:09:59-05 kadickey Exp $";
|
||||
|
||||
@ -28,7 +17,7 @@ const char rcsid_win32snd_driver_c[] = "@(#)$KmKId: win32snd_driver.c,v 1.5 2002
|
||||
# include <windows.h>
|
||||
# include <mmsystem.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
//#include <unistd.h>
|
||||
|
||||
extern int Verbose;
|
||||
|
||||
@ -69,8 +58,8 @@ win32snd_shutdown()
|
||||
#ifndef __CYGWIN__
|
||||
|
||||
void CALLBACK
|
||||
handle_wav_snd(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1,
|
||||
DWORD dwParam2)
|
||||
handle_wav_snd(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1,
|
||||
DWORD_PTR dwParam2)
|
||||
{
|
||||
LPWAVEHDR lpwavehdr;
|
||||
|
||||
@ -131,7 +120,7 @@ child_sound_init_win32()
|
||||
}
|
||||
|
||||
res = waveOutOpen(&g_wave_handle, WAVE_MAPPER, &wavefmt,
|
||||
(DWORD)handle_wav_snd, 0, CALLBACK_FUNCTION | WAVE_ALLOWSYNC);
|
||||
(DWORD_PTR)handle_wav_snd, 0, CALLBACK_FUNCTION | WAVE_ALLOWSYNC);
|
||||
|
||||
if(res != MMSYSERR_NOERROR) {
|
||||
printf("Cannot register audio\n");
|
||||
|
1930
src/windriver.c
1930
src/windriver.c
File diff suppressed because it is too large
Load Diff
@ -3,11 +3,13 @@
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by win32.rc
|
||||
//
|
||||
#define CREATEPROCESS_MANIFEST 1
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_KEGS32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_KEGS32_KEY 106
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
@ -29,6 +31,20 @@
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FLUSHPRINTER 40017
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_8MHZ 50003
|
||||
#define ID_SPEED_FMHZ 50004
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
BIN
src/wintoolbar.bmp
Normal file
BIN
src/wintoolbar.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 758 B |
Loading…
x
Reference in New Issue
Block a user