diff --git a/src/86Box.rc b/src/86Box.rc index c72678d63..a36f17ca4 100644 --- a/src/86Box.rc +++ b/src/86Box.rc @@ -708,10 +708,10 @@ BEGIN 2137 "Mid VLB/PCI" 2138 "Fast VLB/PCI" 2139 "Microsoft 2-button mouse (serial)" - 2140 "2-button mouse (PS/2)" - 2141 "Microsoft Intellimouse (PS/2)" - 2142 "Amstrad mouse" - 2143 "Olivetti M24 mouse" + 2140 "Mouse Systems mouse (serial)" + 2141 "2-button mouse (PS/2)" + 2142 "Microsoft Intellimouse (PS/2)" + 2143 "Bus mouse" END STRINGTABLE DISCARDABLE @@ -733,8 +733,8 @@ BEGIN 2158 "SCSI (%02i:%02i)" 2159 "IDE (PIO-only)" 2160 "%" PRIu64 - 2161 "Microsoft Bus mouse" - 2162 "Mouse Systems mouse" + 2161 "Genius Bus mouse" + 2162 "Amstrad mouse" 2163 "Attempting to create a spuriously large hard disk image" 2164 "Invalid number of sectors (valid values are between 1 and 99)" 2165 "Invalid number of cylinders (valid values are between 1 and 1023)" @@ -749,8 +749,8 @@ BEGIN 2174 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0" 2175 "CD-ROM image (*.ISO)\0*.ISO\0All files (*.*)\0*.*\0" 2176 "Use CTRL + ALT + PAGE DOWN to return to windowed mode" - 2177 "Microsoft InPort mouse" - 2178 "Genius Bus mouse" + 2177 "Olivetti M24 mouse" + 2178 "" 2179 "Floppy %i (%s): %ws" 2180 "CD-ROM %i: %ws" 2181 "Removable disk %i: %s" diff --git a/src/CMakeModules/FindD3D9.cmake b/src/CMakeModules/FindD3D9.cmake deleted file mode 100644 index 6e7ed3237..000000000 --- a/src/CMakeModules/FindD3D9.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# Locate directdraw -# This module defines -# D3D9_LIBRARIES -# D3D9_FOUND, if false, do not try to link to directinput -# D3D9_INCLUDE_DIR, where to find the headers -# -# $D3D9_DIR is an environment variable that would -# point to the this path in the plateform devkit (Samples\Multimedia\DirectShow) -# -# Created by Cedric Pinson. -# - -SET( D3D9_FOUND FALSE ) - -IF( WIN32 ) - FIND_PATH( D3D9_ROOT_DIR Include/D3D9.h - PATHS - $ENV{PATH} - $ENV{PROGRAMFILES} - ) - - FIND_PATH( D3D9_INCLUDE_DIR d3d9.h - PATHS - ${D3D9_ROOT_DIR}/Include - ) - - FIND_LIBRARY( D3D9_LIBRARY d3d9.lib d3dx9 - PATHS - ${D3D9_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( D3D9_GUID_LIBRARY dxguid.lib - PATHS - ${D3D9_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( D3D9_ERR_LIBRARY dxerr.lib - PATHS - ${D3D9_ROOT_DIR}/lib/x86 - ) - - SET( D3D9_LIBRARIES - ${D3D9_LIBRARY} - ${D3D9_GUID_LIBRARY} - ${D3D9_ERR_LIBRARY} - ) - - IF ( D3D9_INCLUDE_DIR AND D3D9_LIBRARIES ) - SET( D3D9_FOUND TRUE ) - ENDIF ( D3D9_INCLUDE_DIR AND D3D9_LIBRARIES ) -ENDIF( WIN32 ) - -MARK_AS_ADVANCED( D3D9_FOUND ) \ No newline at end of file diff --git a/src/CMakeModules/FindDirectDraw.cmake b/src/CMakeModules/FindDirectDraw.cmake deleted file mode 100644 index c5f995313..000000000 --- a/src/CMakeModules/FindDirectDraw.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# Locate directdraw -# This module defines -# DDRAW_LIBRARIES -# DDRAW_FOUND, if false, do not try to link to directinput -# DDRAW_INCLUDE_DIR, where to find the headers -# -# $DDRAW_DIR is an environment variable that would -# point to the this path in the plateform devkit (Samples\Multimedia\DirectShow) -# -# Created by Cedric Pinson. -# - -SET( DDRAW_FOUND FALSE ) - -IF( WIN32 ) - FIND_PATH( DDRAW_ROOT_DIR Include/D3D10.h - PATHS - $ENV{PATH} - $ENV{PROGRAMFILES} - ) - - FIND_PATH( DDRAW_INCLUDE_DIR ddraw.h - PATHS - ${DDRAW_ROOT_DIR}/Include - ) - - FIND_LIBRARY( DDRAW_LIBRARY ddraw.lib - PATHS - ${DDRAW_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( DDRAW_GUID_LIBRARY dxguid.lib - PATHS - ${DDRAW_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( DDRAW_ERR_LIBRARY dxerr.lib - PATHS - ${DDRAW_ROOT_DIR}/lib/x86 - ) - - SET( DDRAW_LIBRARIES - ${DDRAW_LIBRARY} - ${DDRAW_GUID_LIBRARY} - ${DDRAW_ERR_LIBRARY} - ) - - IF ( DDRAW_INCLUDE_DIR AND DDRAW_LIBRARIES ) - SET( DDRAW_FOUND TRUE ) - ENDIF ( DDRAW_INCLUDE_DIR AND DDRAW_LIBRARIES ) -ENDIF( WIN32 ) - -MARK_AS_ADVANCED( DDRAW_FOUND ) \ No newline at end of file diff --git a/src/CMakeModules/FindDirectInput.cmake b/src/CMakeModules/FindDirectInput.cmake deleted file mode 100644 index b7b457527..000000000 --- a/src/CMakeModules/FindDirectInput.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# Locate directinput -# This module defines -# DIRECTINPUT_LIBRARIES -# DIRECTINPUT_FOUND, if false, do not try to link to directinput -# DIRECTINPUT_INCLUDE_DIR, where to find the headers -# -# $DIRECTINPUT_DIR is an environment variable that would -# point to the this path in the plateform devkit (Samples\Multimedia\DirectShow) -# -# Created by Cedric Pinson. -# - -SET( DIRECTINPUT_FOUND FALSE ) - -IF( WIN32 ) - FIND_PATH( DIRECTINPUT_ROOT_DIR Include/D3D10.h - PATHS - $ENV{PATH} - $ENV{PROGRAMFILES} - ) - - FIND_PATH( DIRECTINPUT_INCLUDE_DIR dinput.h - PATHS - ${DIRECTINPUT_ROOT_DIR}/Include - ) - - FIND_LIBRARY( DIRECTINPUT_LIBRARY dinput7.lib dinput8.lib - PATHS - ${DIRECTINPUT_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( DIRECTINPUT_GUID_LIBRARY dxguid.lib - PATHS - ${DIRECTINPUT_ROOT_DIR}/lib/x86 - ) - - FIND_LIBRARY( DIRECTINPUT_ERR_LIBRARY dxerr.lib - PATHS - ${DIRECTINPUT_ROOT_DIR}/lib/x86 - ) - - SET( DIRECTINPUT_LIBRARIES - ${DIRECTINPUT_LIBRARY} - ${DIRECTINPUT_GUID_LIBRARY} - ${DIRECTINPUT_ERR_LIBRARY} - ) - - IF ( DIRECTINPUT_INCLUDE_DIR AND DIRECTINPUT_LIBRARIES ) - SET( DIRECTINPUT_FOUND TRUE ) - ENDIF ( DIRECTINPUT_INCLUDE_DIR AND DIRECTINPUT_LIBRARIES ) -ENDIF( WIN32 ) - -MARK_AS_ADVANCED( DIRECTINPUT_FOUND ) \ No newline at end of file diff --git a/src/386.c b/src/CPU/386.c similarity index 99% rename from src/386.c rename to src/CPU/386.c index 256a1ce88..6bd69af85 100644 --- a/src/386.c +++ b/src/CPU/386.c @@ -5,15 +5,15 @@ #include #include #include -#include "ibm.h" +#include "../ibm.h" +#include "cpu.h" #include "x86.h" #include "x87.h" -#include "mem.h" -#include "cpu.h" -#include "disc.h" -#include "fdc.h" -#include "pic.h" -#include "timer.h" +#include "../mem.h" +#include "../disc.h" +#include "../fdc.h" +#include "../pic.h" +#include "../timer.h" #include "386_common.h" diff --git a/src/386.h b/src/CPU/386.h similarity index 100% rename from src/386.h rename to src/CPU/386.h diff --git a/src/386_common.h b/src/CPU/386_common.h similarity index 100% rename from src/386_common.h rename to src/CPU/386_common.h diff --git a/src/386_dynarec.c b/src/CPU/386_dynarec.c similarity index 99% rename from src/386_dynarec.c rename to src/CPU/386_dynarec.c index 69a3df8a8..06066223f 100644 --- a/src/386_dynarec.c +++ b/src/CPU/386_dynarec.c @@ -5,17 +5,17 @@ #include #include #include -#include "ibm.h" +#include "../ibm.h" +#include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" +#include "../mem.h" #include "codegen.h" -#include "cpu.h" -#include "disc.h" -#include "fdc.h" -#include "pic.h" -#include "timer.h" +#include "../disc.h" +#include "../fdc.h" +#include "../pic.h" +#include "../timer.h" #include "386_common.h" diff --git a/src/386_dynarec_ops.c b/src/CPU/386_dynarec_ops.c similarity index 97% rename from src/386_dynarec_ops.c rename to src/CPU/386_dynarec_ops.c index 7b5a5c7f5..e0e018872 100644 --- a/src/386_dynarec_ops.c +++ b/src/CPU/386_dynarec_ops.c @@ -2,15 +2,15 @@ #ifndef INFINITY # define INFINITY (__builtin_inff()) #endif -#include "ibm.h" +#include "../ibm.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" #include "x86_flags.h" -#include "mem.h" +#include "../mem.h" #include "codegen.h" -#include "pic.h" +#include "../pic.h" #define CPU_BLOCK_END() cpu_block_end = 1 diff --git a/src/386_ops.h b/src/CPU/386_ops.h similarity index 100% rename from src/386_ops.h rename to src/CPU/386_ops.h diff --git a/src/808x.c b/src/CPU/808x.c similarity index 99% rename from src/808x.c rename to src/CPU/808x.c index 6f72fb613..297782386 100644 --- a/src/808x.c +++ b/src/CPU/808x.c @@ -12,16 +12,14 @@ 2 clocks - fetch opcode 2 etc*/ #include #include - -#include "ibm.h" - +#include "../ibm.h" #include "cpu.h" -#include "keyboard.h" -#include "mem.h" -#include "nmi.h" -#include "pic.h" -#include "timer.h" #include "x86.h" +#include "../keyboard.h" +#include "../mem.h" +#include "../nmi.h" +#include "../pic.h" +#include "../timer.h" int xt_cpu_multi; int nmi = 0; @@ -481,7 +479,7 @@ void dumpregs(int force) #ifndef RELEASE_BUILD indump = 1; output=0; - chdir(pcempath); + _wchdir(pcempath); nopageerrors=1; f=fopen("ram.dmp","wb"); fwrite(ram,mem_size*1024,1,f); diff --git a/src/codegen.c b/src/CPU/codegen.c similarity index 94% rename from src/codegen.c rename to src/CPU/codegen.c index 5667c9bad..afe795601 100644 --- a/src/codegen.c +++ b/src/CPU/codegen.c @@ -1,6 +1,6 @@ -#include "ibm.h" +#include "../ibm.h" #include "x86_ops.h" -#include "mem.h" +#include "../mem.h" #include "codegen.h" void (*codegen_timing_start)(); diff --git a/src/codegen.h b/src/CPU/codegen.h similarity index 100% rename from src/codegen.h rename to src/CPU/codegen.h diff --git a/src/codegen_ops.c b/src/CPU/codegen_ops.c similarity index 99% rename from src/codegen_ops.c rename to src/CPU/codegen_ops.c index a1f846a52..2bd6550e2 100644 --- a/src/codegen_ops.c +++ b/src/CPU/codegen_ops.c @@ -1,4 +1,5 @@ -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "x86.h" #include "x86_ops.h" #include "x86_flags.h" diff --git a/src/codegen_ops.h b/src/CPU/codegen_ops.h similarity index 100% rename from src/codegen_ops.h rename to src/CPU/codegen_ops.h diff --git a/src/codegen_ops_arith.h b/src/CPU/codegen_ops_arith.h similarity index 100% rename from src/codegen_ops_arith.h rename to src/CPU/codegen_ops_arith.h diff --git a/src/codegen_ops_fpu.h b/src/CPU/codegen_ops_fpu.h similarity index 100% rename from src/codegen_ops_fpu.h rename to src/CPU/codegen_ops_fpu.h diff --git a/src/codegen_ops_jump.h b/src/CPU/codegen_ops_jump.h similarity index 100% rename from src/codegen_ops_jump.h rename to src/CPU/codegen_ops_jump.h diff --git a/src/codegen_ops_logic.h b/src/CPU/codegen_ops_logic.h similarity index 100% rename from src/codegen_ops_logic.h rename to src/CPU/codegen_ops_logic.h diff --git a/src/codegen_ops_misc.h b/src/CPU/codegen_ops_misc.h similarity index 100% rename from src/codegen_ops_misc.h rename to src/CPU/codegen_ops_misc.h diff --git a/src/codegen_ops_mmx.h b/src/CPU/codegen_ops_mmx.h similarity index 100% rename from src/codegen_ops_mmx.h rename to src/CPU/codegen_ops_mmx.h diff --git a/src/codegen_ops_mov.h b/src/CPU/codegen_ops_mov.h similarity index 100% rename from src/codegen_ops_mov.h rename to src/CPU/codegen_ops_mov.h diff --git a/src/codegen_ops_shift.h b/src/CPU/codegen_ops_shift.h similarity index 100% rename from src/codegen_ops_shift.h rename to src/CPU/codegen_ops_shift.h diff --git a/src/codegen_ops_stack.h b/src/CPU/codegen_ops_stack.h similarity index 100% rename from src/codegen_ops_stack.h rename to src/CPU/codegen_ops_stack.h diff --git a/src/codegen_ops_x86-64.h b/src/CPU/codegen_ops_x86-64.h similarity index 100% rename from src/codegen_ops_x86-64.h rename to src/CPU/codegen_ops_x86-64.h diff --git a/src/codegen_ops_x86.h b/src/CPU/codegen_ops_x86.h similarity index 100% rename from src/codegen_ops_x86.h rename to src/CPU/codegen_ops_x86.h diff --git a/src/codegen_ops_xchg.h b/src/CPU/codegen_ops_xchg.h similarity index 100% rename from src/codegen_ops_xchg.h rename to src/CPU/codegen_ops_xchg.h diff --git a/src/codegen_timing_486.c b/src/CPU/codegen_timing_486.c similarity index 99% rename from src/codegen_timing_486.c rename to src/CPU/codegen_timing_486.c index 19b958931..ddcbc260c 100644 --- a/src/codegen_timing_486.c +++ b/src/CPU/codegen_timing_486.c @@ -1,9 +1,9 @@ -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" #include "codegen.h" #define CYCLES(c) (int *)c diff --git a/src/codegen_timing_686.c b/src/CPU/codegen_timing_686.c similarity index 99% rename from src/codegen_timing_686.c rename to src/CPU/codegen_timing_686.c index c4b4cc456..eab10357b 100644 --- a/src/codegen_timing_686.c +++ b/src/CPU/codegen_timing_686.c @@ -7,13 +7,12 @@ - FPU queue - Out of order execution (beyond most simplistic approximation) */ - -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" #include "codegen.h" /*Instruction has different execution time for 16 and 32 bit data. Does not pair */ diff --git a/src/codegen_timing_pentium.c b/src/CPU/codegen_timing_pentium.c similarity index 99% rename from src/codegen_timing_pentium.c rename to src/CPU/codegen_timing_pentium.c index 6d678915e..2812e63ae 100644 --- a/src/codegen_timing_pentium.c +++ b/src/CPU/codegen_timing_pentium.c @@ -8,13 +8,12 @@ - FPU latencies - MMX latencies */ - -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" #include "codegen.h" /*Instruction has different execution time for 16 and 32 bit data. Does not pair */ diff --git a/src/codegen_timing_winchip.c b/src/CPU/codegen_timing_winchip.c similarity index 99% rename from src/codegen_timing_winchip.c rename to src/CPU/codegen_timing_winchip.c index 5d1a26bf3..a76a08e7a 100644 --- a/src/codegen_timing_winchip.c +++ b/src/CPU/codegen_timing_winchip.c @@ -1,9 +1,9 @@ -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" #include "codegen.h" #define CYCLES(c) (int *)c diff --git a/src/codegen_x86-64.c b/src/CPU/codegen_x86-64.c similarity index 100% rename from src/codegen_x86-64.c rename to src/CPU/codegen_x86-64.c diff --git a/src/codegen_x86-64.h b/src/CPU/codegen_x86-64.h similarity index 100% rename from src/codegen_x86-64.h rename to src/CPU/codegen_x86-64.h diff --git a/src/codegen_x86.c b/src/CPU/codegen_x86.c similarity index 99% rename from src/codegen_x86.c rename to src/CPU/codegen_x86.c index e7971c383..a42b32104 100644 --- a/src/codegen_x86.c +++ b/src/CPU/codegen_x86.c @@ -1,13 +1,12 @@ #if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32 - #include -#include "ibm.h" +#include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_flags.h" #include "x86_ops.h" #include "x87.h" -#include "mem.h" #include "386_common.h" diff --git a/src/codegen_x86.h b/src/CPU/codegen_x86.h similarity index 100% rename from src/codegen_x86.h rename to src/CPU/codegen_x86.h diff --git a/src/cpu.c b/src/CPU/cpu.c similarity index 99% rename from src/cpu.c rename to src/CPU/cpu.c index d2e1b26f7..453e8626a 100644 --- a/src/cpu.c +++ b/src/CPU/cpu.c @@ -1,13 +1,13 @@ /* Copyright holders: Sarah Walker, Tenshi, leilei see COPYING for more details */ -#include "ibm.h" +#include "../ibm.h" #include "cpu.h" -#include "model.h" -#include "io.h" +#include "../model.h" +#include "../io.h" #include "x86_ops.h" -#include "mem.h" -#include "pci.h" +#include "../mem.h" +#include "../pci.h" #include "codegen.h" int isa_cycles; diff --git a/src/cpu.h b/src/CPU/cpu.h similarity index 100% rename from src/cpu.h rename to src/CPU/cpu.h diff --git a/src/x86.h b/src/CPU/x86.h similarity index 100% rename from src/x86.h rename to src/CPU/x86.h diff --git a/src/x86_flags.h b/src/CPU/x86_flags.h similarity index 100% rename from src/x86_flags.h rename to src/CPU/x86_flags.h diff --git a/src/x86_ops.h b/src/CPU/x86_ops.h similarity index 100% rename from src/x86_ops.h rename to src/CPU/x86_ops.h diff --git a/src/x86_ops_arith.h b/src/CPU/x86_ops_arith.h similarity index 100% rename from src/x86_ops_arith.h rename to src/CPU/x86_ops_arith.h diff --git a/src/x86_ops_atomic.h b/src/CPU/x86_ops_atomic.h similarity index 100% rename from src/x86_ops_atomic.h rename to src/CPU/x86_ops_atomic.h diff --git a/src/x86_ops_bcd.h b/src/CPU/x86_ops_bcd.h similarity index 100% rename from src/x86_ops_bcd.h rename to src/CPU/x86_ops_bcd.h diff --git a/src/x86_ops_bit.h b/src/CPU/x86_ops_bit.h similarity index 100% rename from src/x86_ops_bit.h rename to src/CPU/x86_ops_bit.h diff --git a/src/x86_ops_bitscan.h b/src/CPU/x86_ops_bitscan.h similarity index 100% rename from src/x86_ops_bitscan.h rename to src/CPU/x86_ops_bitscan.h diff --git a/src/x86_ops_call.h b/src/CPU/x86_ops_call.h similarity index 100% rename from src/x86_ops_call.h rename to src/CPU/x86_ops_call.h diff --git a/src/x86_ops_flag.h b/src/CPU/x86_ops_flag.h similarity index 100% rename from src/x86_ops_flag.h rename to src/CPU/x86_ops_flag.h diff --git a/src/x86_ops_fpu.h b/src/CPU/x86_ops_fpu.h similarity index 100% rename from src/x86_ops_fpu.h rename to src/CPU/x86_ops_fpu.h diff --git a/src/x86_ops_i686.h b/src/CPU/x86_ops_i686.h similarity index 100% rename from src/x86_ops_i686.h rename to src/CPU/x86_ops_i686.h diff --git a/src/x86_ops_inc_dec.h b/src/CPU/x86_ops_inc_dec.h similarity index 100% rename from src/x86_ops_inc_dec.h rename to src/CPU/x86_ops_inc_dec.h diff --git a/src/x86_ops_int.h b/src/CPU/x86_ops_int.h similarity index 100% rename from src/x86_ops_int.h rename to src/CPU/x86_ops_int.h diff --git a/src/x86_ops_io.h b/src/CPU/x86_ops_io.h similarity index 100% rename from src/x86_ops_io.h rename to src/CPU/x86_ops_io.h diff --git a/src/x86_ops_jump.h b/src/CPU/x86_ops_jump.h similarity index 100% rename from src/x86_ops_jump.h rename to src/CPU/x86_ops_jump.h diff --git a/src/x86_ops_misc.h b/src/CPU/x86_ops_misc.h similarity index 100% rename from src/x86_ops_misc.h rename to src/CPU/x86_ops_misc.h diff --git a/src/x86_ops_mmx.h b/src/CPU/x86_ops_mmx.h similarity index 100% rename from src/x86_ops_mmx.h rename to src/CPU/x86_ops_mmx.h diff --git a/src/x86_ops_mmx_arith.h b/src/CPU/x86_ops_mmx_arith.h similarity index 100% rename from src/x86_ops_mmx_arith.h rename to src/CPU/x86_ops_mmx_arith.h diff --git a/src/x86_ops_mmx_cmp.h b/src/CPU/x86_ops_mmx_cmp.h similarity index 100% rename from src/x86_ops_mmx_cmp.h rename to src/CPU/x86_ops_mmx_cmp.h diff --git a/src/x86_ops_mmx_logic.h b/src/CPU/x86_ops_mmx_logic.h similarity index 100% rename from src/x86_ops_mmx_logic.h rename to src/CPU/x86_ops_mmx_logic.h diff --git a/src/x86_ops_mmx_mov.h b/src/CPU/x86_ops_mmx_mov.h similarity index 100% rename from src/x86_ops_mmx_mov.h rename to src/CPU/x86_ops_mmx_mov.h diff --git a/src/x86_ops_mmx_pack.h b/src/CPU/x86_ops_mmx_pack.h similarity index 100% rename from src/x86_ops_mmx_pack.h rename to src/CPU/x86_ops_mmx_pack.h diff --git a/src/x86_ops_mmx_shift.h b/src/CPU/x86_ops_mmx_shift.h similarity index 100% rename from src/x86_ops_mmx_shift.h rename to src/CPU/x86_ops_mmx_shift.h diff --git a/src/x86_ops_mov.h b/src/CPU/x86_ops_mov.h similarity index 100% rename from src/x86_ops_mov.h rename to src/CPU/x86_ops_mov.h diff --git a/src/x86_ops_mov_ctrl.h b/src/CPU/x86_ops_mov_ctrl.h similarity index 100% rename from src/x86_ops_mov_ctrl.h rename to src/CPU/x86_ops_mov_ctrl.h diff --git a/src/x86_ops_mov_seg.h b/src/CPU/x86_ops_mov_seg.h similarity index 100% rename from src/x86_ops_mov_seg.h rename to src/CPU/x86_ops_mov_seg.h diff --git a/src/x86_ops_movx.h b/src/CPU/x86_ops_movx.h similarity index 100% rename from src/x86_ops_movx.h rename to src/CPU/x86_ops_movx.h diff --git a/src/x86_ops_msr.h b/src/CPU/x86_ops_msr.h similarity index 100% rename from src/x86_ops_msr.h rename to src/CPU/x86_ops_msr.h diff --git a/src/x86_ops_mul.h b/src/CPU/x86_ops_mul.h similarity index 100% rename from src/x86_ops_mul.h rename to src/CPU/x86_ops_mul.h diff --git a/src/x86_ops_pmode.h b/src/CPU/x86_ops_pmode.h similarity index 100% rename from src/x86_ops_pmode.h rename to src/CPU/x86_ops_pmode.h diff --git a/src/x86_ops_prefix.h b/src/CPU/x86_ops_prefix.h similarity index 100% rename from src/x86_ops_prefix.h rename to src/CPU/x86_ops_prefix.h diff --git a/src/x86_ops_rep.h b/src/CPU/x86_ops_rep.h similarity index 100% rename from src/x86_ops_rep.h rename to src/CPU/x86_ops_rep.h diff --git a/src/x86_ops_ret.h b/src/CPU/x86_ops_ret.h similarity index 100% rename from src/x86_ops_ret.h rename to src/CPU/x86_ops_ret.h diff --git a/src/x86_ops_set.h b/src/CPU/x86_ops_set.h similarity index 100% rename from src/x86_ops_set.h rename to src/CPU/x86_ops_set.h diff --git a/src/x86_ops_shift.h b/src/CPU/x86_ops_shift.h similarity index 100% rename from src/x86_ops_shift.h rename to src/CPU/x86_ops_shift.h diff --git a/src/x86_ops_stack.h b/src/CPU/x86_ops_stack.h similarity index 100% rename from src/x86_ops_stack.h rename to src/CPU/x86_ops_stack.h diff --git a/src/x86_ops_string.h b/src/CPU/x86_ops_string.h similarity index 100% rename from src/x86_ops_string.h rename to src/CPU/x86_ops_string.h diff --git a/src/x86_ops_xchg.h b/src/CPU/x86_ops_xchg.h similarity index 100% rename from src/x86_ops_xchg.h rename to src/CPU/x86_ops_xchg.h diff --git a/src/x86seg.c b/src/CPU/x86seg.c similarity index 99% rename from src/x86seg.c rename to src/CPU/x86seg.c index 1042712ae..71fe5ccef 100644 --- a/src/x86seg.c +++ b/src/CPU/x86seg.c @@ -4,9 +4,9 @@ #include #include #include -#include "ibm.h" -#include "mem.h" -#include "nvr.h" +#include "../ibm.h" +#include "../mem.h" +#include "../nvr.h" #include "x86.h" #include "386.h" #include "386_common.h" diff --git a/src/x86seg.h b/src/CPU/x86seg.h similarity index 100% rename from src/x86seg.h rename to src/CPU/x86seg.h diff --git a/src/x87.c b/src/CPU/x87.c similarity index 98% rename from src/x87.c rename to src/CPU/x87.c index a729a14c4..a241130fb 100644 --- a/src/x87.c +++ b/src/CPU/x87.c @@ -1,14 +1,14 @@ #define fplog 0 - #include -#include "ibm.h" -#include "pic.h" +#include "../ibm.h" +#include "../pic.h" #include "x86.h" #include "x86_flags.h" #include "x86_ops.h" #include "x87.h" #include "386_common.h" + uint16_t x87_gettag() { uint16_t ret = 0; diff --git a/src/x87.h b/src/CPU/x87.h similarity index 100% rename from src/x87.h rename to src/CPU/x87.h diff --git a/src/x87_ops.h b/src/CPU/x87_ops.h similarity index 100% rename from src/x87_ops.h rename to src/CPU/x87_ops.h diff --git a/src/x87_ops_arith.h b/src/CPU/x87_ops_arith.h similarity index 100% rename from src/x87_ops_arith.h rename to src/CPU/x87_ops_arith.h diff --git a/src/x87_ops_loadstore.h b/src/CPU/x87_ops_loadstore.h similarity index 100% rename from src/x87_ops_loadstore.h rename to src/CPU/x87_ops_loadstore.h diff --git a/src/x87_ops_misc.h b/src/CPU/x87_ops_misc.h similarity index 100% rename from src/x87_ops_misc.h rename to src/CPU/x87_ops_misc.h diff --git a/src/Makefile.mingw b/src/Makefile.mingw index cefbc5bdc..783447992 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 MinGW 32-bit environment. # -# Version: @(#)Makefile.mingw 1.0.5 2017/05/05 +# Version: @(#)Makefile.mingw 1.0.6 2017/05/06 # # Authors: Kotori, # Fred N. van Kempen, @@ -30,31 +30,52 @@ EXTRAS = # Do we want a debugging build? DEBUG = n +OPTIM = n +X64 = n ######################################################################### # Nothing should need changing from here on.. # ######################################################################### -VPATH = . dosbox lzf resid-fp slirp +VPATH = . cpu sound sound/resid-fp video lzf slirp CPP = g++.exe CC = gcc.exe WINDRES = windres.exe OPTS = -DWIN32 $(EXTRAS) $(STUFF) ifeq ($(DEBUG), y) -DFLAGS = -march=i686 -Og -ggdb -DDEBUG +DFLAGS = -march=i686 -ggdb -DDEBUG +COPTIM = -Og else -ifeq ($(OPTIMIZED), y) -DFLAGS = -march=native -mtune=native -O6 +ifeq ($(OPTIM), y) +DFLAGS = -march=native +COPTIM = -O6 else -DFLAGS = -march=i686 -O3 +ifeq ($(X64), y) +DFLAGS = +else +DFLAGS = -march=i686 +endif +COPTIM = -O3 endif endif -AFLAGS = -msse -msse2 -mfpmath=sse -CFLAGS = $(OPTS) $(DFLAGS) $(AFLAGS) \ +ifeq ($(OPTIM), y) +AOPTIM = -mtune=native +else +AOPTIM = +endif +AFLAGS = -msse -msse2 \ + -mfpmath=sse +CFLAGS = $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) $(AFLAGS) \ -fomit-frame-pointer -mstackrealign RFLAGS = --input-format=rc -O coff +ifeq ($(X64), y) +PLATCG = codegen_x86-64.o +else +PLATCG = codegen_x86.o +endif + MAINOBJ = pc.o config.o device.o timer.o dma.o io.o nmi.o pic.o \ mca.o mcr.o pit.o ppi.o pci.o sio.o intel.o rom.o mem.o \ @@ -63,7 +84,7 @@ CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ codegen.o \ codegen_ops.o codegen_timing_486.o \ codegen_timing_686.o codegen_timing_pentium.o \ - codegen_timing_winchip.o codegen_x86.o \ + codegen_timing_winchip.o $(PLATCG) \ x86seg.o x87.o SYSOBJ = model.o \ headland.o \ @@ -88,22 +109,31 @@ DEVOBJ = bugger.o lpt.o serial.o \ mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o \ fdd.o fdc.o \ fdc37c665.o fdc37c669.o fdc37c932fr.o fdi2raw.o \ - hdd.o hdd_esdi.o mfm_at.o mfm_xebec.o ide.o xtide.o piix.o scsi_hd.o \ + hdd.o \ + mfm_at.o mfm_xebec.o hdd_esdi.o ide.o xtide.o piix.o \ disc.o \ disc_86f.o disc_fdi.o disc_imd.o disc_img.o \ disc_random.o disc_td0.o \ cdrom.o cdrom-ioctl.o cdrom-iso.o cdrom-null.o USBOBJ = usb.o -NETOBJ = ne2000.o nethandler.o -SCSIOBJ = scsi.o scsi_buslogic.o scsi_aha154x.o -SNDOBJ = sound.o sound_speaker.o dac.o sound_ps1.o sound_pssj.o \ - sound_adlib.o sound_adlibgold.o sound_ad1848.o sound_sb.o \ - sound_sb_dsp.o sound_cms.o sound_dbopl.o sound_emu8k.o \ - sound_gus.o sound_opl.o sound_mpu401_uart.o sound_pas16.o \ - sound_resid.o sound_sn76489.o sound_ssi2001.o sound_wss.o \ - sound_ym7128.o soundopenal.o +NETOBJ = network.o net_ne2000.o +SCSIOBJ = scsi.o scsi_disk.o scsi_buslogic.o scsi_aha154x.o +SNDOBJ = sound.o \ + convolve.o convolve-sse.o envelope.o extfilt.o \ + filter.o pot.o sid.o voice.o wave6581__ST.o \ + wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \ + wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ + wave8580_PST.o wave.o \ + dbopl.o nukedopl.o openal.o \ + snd_speaker.o dac.o snd_ps1.o snd_pssj.o \ + snd_adlib.o snd_adlibgold.o snd_ad1848.o \ + snd_sb.o snd_sb_dsp.o snd_cms.o snd_dbopl.o \ + snd_emu8k.o snd_gus.o snd_opl.o \ + snd_mpu401_uart.o snd_pas16.o snd_resid.o \ + snd_sn76489.o snd_ssi2001.o snd_wss.o \ + snd_ym7128.o VIDOBJ = video.o \ - vid_mda.o vid_cga.o vid_ega.o \ + vid_cga.o vid_cga_comp.o vid_mda.o vid_ega.o \ vid_vga.o vid_svga.o vid_svga_render.o \ vid_hercules.o vid_herculesplus.o vid_incolor.o \ vid_colorplus.o \ @@ -128,22 +158,18 @@ VIDOBJ = video.o \ WINOBJ = win.o \ win-d3d.o win-d3d-fs.o \ win-ddraw.o win-ddraw-fs.o win-ddraw-screenshot.o \ - win-language.o win-status.o win-video.o \ - win-keyboard.o win-mouse.o win-joystick.o win-midi.o \ + win-language.o win-status.o \ + win-video.o win-serial.o win-mouse.o \ + win-joystick.o win-midi.o \ win-settings.o win-deviceconfig.o win-joystickconfig.o \ 86Box.res OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \ $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ) -DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o LZFOBJ = lzf_c.o lzf_d.o -SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o \ - sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o \ - wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ - wave8580_PST.o wave.o -SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o \ - queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o \ - udp.o if.o mbuf.o slirp.o tcp_subr.o +SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \ + ip_input.o queue.o tcp_input.o tftp.o debug.o ip_output.o \ + sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi \ @@ -164,12 +190,10 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ @echo $< @$(CPP) $(CFLAGS) -c $< -$(PROG).exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) +$(PROG).exe: $(OBJ) $(LZFOBJ) $(SLIRPOBJ) @echo Linking $(PROG).exe .. @$(CC) -o $(PROG).exe \ - $(OBJ) \ - $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) \ - $(LIBS) + $(OBJ) $(LZFOBJ) $(SLIRPOBJ) $(LIBS) ifneq ($(DEBUG), y) strip $(PROG).exe endif diff --git a/src/Makefile.mingw64 b/src/Makefile.mingw64 index 7dfc840ac..2f0f9b408 100644 --- a/src/Makefile.mingw64 +++ b/src/Makefile.mingw64 @@ -6,9 +6,9 @@ # # This file is part of the 86Box distribution. # -# Modified Makefile for Win32 MinGW 32-bit environment. +# Modified Makefile for Win64 MinGW 64-bit environment. # -# Version: @(#)Makefile.mingw64 1.0.0 2017/05/05 +# Version: @(#)Makefile.mingw64 1.0.2 2017/05/06 # # Authors: Kotori, # Fred N. van Kempen, @@ -16,174 +16,18 @@ # Richard G., # +# Include the default Makefile. +include Makefile.mingw + # Name of the executable. PROG = 86Box64 # Various compile-time options. -# -DROM_TRACE=0xcd800 traces ROM access from segment C800 -# -DIO_TACE=0x66 traces I/O on port 0x66 STUFF = - -# Add feature selections here. -# -DBUGGER adds the ISA BusBugger emulation. EXTRAS = - -# Do we want a debugging build? DEBUG = n +OPTIM = n +X64 = y -######################################################################### -# Nothing should need changing from here on.. # -######################################################################### -VPATH = . dosbox lzf resid-fp slirp -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe - -OPTS = -DWIN32 $(EXTRAS) $(STUFF) -ifeq ($(DEBUG), y) -DFLAGS = -march=i686 -Og -ggdb -DDEBUG -else -ifeq ($(OPTIMIZED), y) -DFLAGS = -march=native -mtune=native -O6 -else -DFLAGS = -O3 -endif -endif -AFLAGS = -msse -msse2 -mfpmath=sse -CFLAGS = $(OPTS) $(DFLAGS) $(AFLAGS) \ - -fomit-frame-pointer -mstackrealign -RFLAGS = --input-format=rc -O coff - - -MAINOBJ = pc.o config.o device.o timer.o dma.o io.o nmi.o pic.o \ - mca.o mcr.o pit.o ppi.o pci.o sio.o intel.o rom.o mem.o \ - memregs.o intel_flash.o rtc.o nvr.o ps2_nvr.o -CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ - codegen.o \ - codegen_ops.o codegen_timing_486.o \ - codegen_timing_686.o codegen_timing_pentium.o \ - codegen_timing_winchip.o codegen_x86-64.o \ - x86seg.o x87.o -SYSOBJ = model.o \ - headland.o \ - i430hx.o i430lx.o i430fx.o i430nx.o i430vx.o i440fx.o \ - neat.o \ - ali1429.o \ - opti495.o \ - scat.o \ - sis496.o \ - wd76c10.o \ - acer386sx.o acerm3a.o amstrad.o \ - compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \ - tandy_eeprom.o tandy_rom.o -DEVOBJ = bugger.o lpt.o serial.o \ - um8669f.o pc87306.o sis85c471.o w83877f.o \ - keyboard.o \ - keyboard_xt.o keyboard_at.o keyboard_pcjr.o \ - keyboard_amstrad.o keyboard_olim24.o \ - gameport.o \ - joystick_standard.o joystick_ch_flightstick_pro.o \ - joystick_sw_pad.o joystick_tm_fcs.o \ - mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o \ - fdd.o fdc.o \ - fdc37c665.o fdc37c669.o fdc37c932fr.o fdi2raw.o \ - hdd.o hdd_esdi.o mfm_at.o mfm_xebec.o ide.o xtide.o piix.o scsi_hd.o \ - disc.o \ - disc_86f.o disc_fdi.o disc_imd.o disc_img.o \ - disc_random.o disc_td0.o \ - cdrom.o cdrom-ioctl.o cdrom-iso.o cdrom-null.o -USBOBJ = usb.o -NETOBJ = ne2000.o nethandler.o -SCSIOBJ = scsi.o scsi_buslogic.o scsi_aha154x.o -SNDOBJ = sound.o sound_speaker.o dac.o sound_ps1.o sound_pssj.o \ - sound_adlib.o sound_adlibgold.o sound_ad1848.o sound_sb.o \ - sound_sb_dsp.o sound_cms.o sound_dbopl.o sound_emu8k.o \ - sound_gus.o sound_opl.o sound_mpu401_uart.o sound_pas16.o \ - sound_resid.o sound_sn76489.o sound_ssi2001.o sound_wss.o \ - sound_ym7128.o soundopenal.o -VIDOBJ = video.o \ - vid_mda.o vid_cga.o vid_ega.o \ - vid_vga.o vid_svga.o vid_svga_render.o \ - vid_hercules.o vid_herculesplus.o vid_incolor.o \ - vid_colorplus.o \ - vid_genius.o \ - vid_s3.o vid_s3_virge.o \ - vid_et4000.o vid_et4000w32.o vid_icd2061.o \ - vid_oti067.o \ - vid_paradise.o \ - vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \ - vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \ - vid_ati68860_ramdac.o vid_ati_mach64.o \ - vid_ics2595.o \ - vid_sdac_ramdac.o \ - vid_stg_ramdac.o \ - vid_unk_ramdac.o \ - vid_wy700.o \ - vid_voodoo.o \ - vid_pcjr.o vid_ps1_svga.o \ - vid_olivetti_m24.o \ - vid_pc1512.o vid_pc1640.o vid_pc200.o \ - vid_tandy.o vid_tandysl.o -WINOBJ = win.o \ - win-d3d.o win-d3d-fs.o \ - win-ddraw.o win-ddraw-fs.o win-ddraw-screenshot.o \ - win-language.o win-status.o win-video.o \ - win-keyboard.o win-mouse.o win-joystick.o win-midi.o \ - win-settings.o win-deviceconfig.o win-joystickconfig.o \ - 86Box.res -OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \ - $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ) - -DBOBJ = dbopl.o nukedopl.o vid_cga_comp.o -LZFOBJ = lzf_c.o lzf_d.o -SIDOBJ = convolve.o convolve-sse.o envelope.o extfilt.o filter.o pot.o \ - sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o \ - wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ - wave8580_PST.o wave.o -SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o ip_input.o \ - queue.o tcp_input.o tftp.o debug.o ip_output.o sbuf.o tcp_output.o \ - udp.o if.o mbuf.o slirp.o tcp_subr.o - -LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \ - -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lwsock32 -liphlpapi \ - -lstdc++ -lpsapi -static-libstdc++ -static-libgcc \ - -static -L. -lwpcapdelay - - -# Build rules. -%.o: %.c - @echo $< - $(CC) $(CFLAGS) -c $< - -%.o: %.cc - @echo $< - @$(CPP) $(CFLAGS) -c $< - -%.o: %.cpp - @echo $< - @$(CPP) $(CFLAGS) -c $< - -$(PROG).exe: $(OBJ) $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) - @echo Linking $(PROG).exe .. - @$(CC) -o $(PROG).exe \ - $(OBJ) \ - $(DBOBJ) $(LZFOBJ) $(SIDOBJ) $(SLIRPOBJ) \ - $(LIBS) -ifneq ($(DEBUG), y) - strip $(PROG).exe -endif - -all: $(PROG).exe - -clean: - rm *.o - rm *.exe - rm *.res - -86Box.res: 86Box.rc - @echo Processing $< - @$(WINDRES) $(RFLAGS) -i 86Box.rc -o 86Box.res - - -# End of Makefile.mingw. +# End of Makefile.mingw64. diff --git a/src/dosbox/dbopl.cpp b/src/SOUND/dbopl.cpp similarity index 100% rename from src/dosbox/dbopl.cpp rename to src/SOUND/dbopl.cpp diff --git a/src/dosbox/dbopl.h b/src/SOUND/dbopl.h similarity index 100% rename from src/dosbox/dbopl.h rename to src/SOUND/dbopl.h diff --git a/src/filters.h b/src/SOUND/filters.h similarity index 100% rename from src/filters.h rename to src/SOUND/filters.h diff --git a/src/dosbox/nukedopl.cpp b/src/SOUND/nukedopl.cpp similarity index 100% rename from src/dosbox/nukedopl.cpp rename to src/SOUND/nukedopl.cpp diff --git a/src/dosbox/nukedopl.h b/src/SOUND/nukedopl.h similarity index 100% rename from src/dosbox/nukedopl.h rename to src/SOUND/nukedopl.h diff --git a/src/soundopenal.c b/src/SOUND/openal.c similarity index 96% rename from src/soundopenal.c rename to src/SOUND/openal.c index 8cb065fbd..9f20b57de 100644 --- a/src/soundopenal.c +++ b/src/SOUND/openal.c @@ -3,13 +3,14 @@ #include #include #ifdef USE_OPENAL -#include -#include -#include +# include +# include +# include #endif -#include "ibm.h" +#include "../ibm.h" #include "sound.h" + FILE *allog; #ifdef USE_OPENAL ALuint buffers[4]; /* front and back buffers */ @@ -19,7 +20,8 @@ static ALuint source[2]; /* audio source */ #define FREQ 48000 #define BUFLEN SOUNDBUFLEN -void closeal(); + +void closeal(ALvoid); ALvoid alutInit(ALint *argc,ALbyte **argv) { ALCcontext *Context; @@ -60,14 +62,14 @@ void initalmain(int argc, char *argv[]) #endif } -void closeal() +void closeal(ALvoid) { #ifdef USE_OPENAL alutExit(); #endif } -void inital() +void inital(ALvoid) { #ifdef USE_OPENAL int c; diff --git a/src/resid-fp/AUTHORS b/src/SOUND/resid-fp/AUTHORS similarity index 100% rename from src/resid-fp/AUTHORS rename to src/SOUND/resid-fp/AUTHORS diff --git a/src/resid-fp/COPYING b/src/SOUND/resid-fp/COPYING similarity index 100% rename from src/resid-fp/COPYING rename to src/SOUND/resid-fp/COPYING diff --git a/src/resid-fp/ChangeLog b/src/SOUND/resid-fp/ChangeLog similarity index 100% rename from src/resid-fp/ChangeLog rename to src/SOUND/resid-fp/ChangeLog diff --git a/src/resid-fp/INSTALL b/src/SOUND/resid-fp/INSTALL similarity index 100% rename from src/resid-fp/INSTALL rename to src/SOUND/resid-fp/INSTALL diff --git a/src/resid-fp/Makefile.am b/src/SOUND/resid-fp/Makefile.am similarity index 100% rename from src/resid-fp/Makefile.am rename to src/SOUND/resid-fp/Makefile.am diff --git a/src/resid-fp/Makefile.in b/src/SOUND/resid-fp/Makefile.in similarity index 100% rename from src/resid-fp/Makefile.in rename to src/SOUND/resid-fp/Makefile.in diff --git a/src/resid-fp/NEWS b/src/SOUND/resid-fp/NEWS similarity index 100% rename from src/resid-fp/NEWS rename to src/SOUND/resid-fp/NEWS diff --git a/src/resid-fp/README b/src/SOUND/resid-fp/README similarity index 100% rename from src/resid-fp/README rename to src/SOUND/resid-fp/README diff --git a/src/resid-fp/README.VICE b/src/SOUND/resid-fp/README.VICE similarity index 100% rename from src/resid-fp/README.VICE rename to src/SOUND/resid-fp/README.VICE diff --git a/src/resid-fp/aclocal.m4 b/src/SOUND/resid-fp/aclocal.m4 similarity index 100% rename from src/resid-fp/aclocal.m4 rename to src/SOUND/resid-fp/aclocal.m4 diff --git a/src/resid-fp/configure b/src/SOUND/resid-fp/configure similarity index 100% rename from src/resid-fp/configure rename to src/SOUND/resid-fp/configure diff --git a/src/resid-fp/configure.in b/src/SOUND/resid-fp/configure.in similarity index 100% rename from src/resid-fp/configure.in rename to src/SOUND/resid-fp/configure.in diff --git a/src/resid-fp/convolve-sse.cc b/src/SOUND/resid-fp/convolve-sse.cc similarity index 100% rename from src/resid-fp/convolve-sse.cc rename to src/SOUND/resid-fp/convolve-sse.cc diff --git a/src/resid-fp/convolve.cc b/src/SOUND/resid-fp/convolve.cc similarity index 100% rename from src/resid-fp/convolve.cc rename to src/SOUND/resid-fp/convolve.cc diff --git a/src/resid-fp/envelope.cc b/src/SOUND/resid-fp/envelope.cc similarity index 100% rename from src/resid-fp/envelope.cc rename to src/SOUND/resid-fp/envelope.cc diff --git a/src/resid-fp/envelope.h b/src/SOUND/resid-fp/envelope.h similarity index 100% rename from src/resid-fp/envelope.h rename to src/SOUND/resid-fp/envelope.h diff --git a/src/resid-fp/extfilt.cc b/src/SOUND/resid-fp/extfilt.cc similarity index 100% rename from src/resid-fp/extfilt.cc rename to src/SOUND/resid-fp/extfilt.cc diff --git a/src/resid-fp/extfilt.h b/src/SOUND/resid-fp/extfilt.h similarity index 100% rename from src/resid-fp/extfilt.h rename to src/SOUND/resid-fp/extfilt.h diff --git a/src/resid-fp/filter.cc b/src/SOUND/resid-fp/filter.cc similarity index 100% rename from src/resid-fp/filter.cc rename to src/SOUND/resid-fp/filter.cc diff --git a/src/resid-fp/filter.h b/src/SOUND/resid-fp/filter.h similarity index 100% rename from src/resid-fp/filter.h rename to src/SOUND/resid-fp/filter.h diff --git a/src/resid-fp/pot.cc b/src/SOUND/resid-fp/pot.cc similarity index 100% rename from src/resid-fp/pot.cc rename to src/SOUND/resid-fp/pot.cc diff --git a/src/resid-fp/pot.h b/src/SOUND/resid-fp/pot.h similarity index 100% rename from src/resid-fp/pot.h rename to src/SOUND/resid-fp/pot.h diff --git a/src/resid-fp/samp2src.pl b/src/SOUND/resid-fp/samp2src.pl similarity index 100% rename from src/resid-fp/samp2src.pl rename to src/SOUND/resid-fp/samp2src.pl diff --git a/src/resid-fp/sid.cc b/src/SOUND/resid-fp/sid.cc similarity index 100% rename from src/resid-fp/sid.cc rename to src/SOUND/resid-fp/sid.cc diff --git a/src/resid-fp/sid.h b/src/SOUND/resid-fp/sid.h similarity index 100% rename from src/resid-fp/sid.h rename to src/SOUND/resid-fp/sid.h diff --git a/src/resid-fp/siddefs-fp.h b/src/SOUND/resid-fp/siddefs-fp.h similarity index 100% rename from src/resid-fp/siddefs-fp.h rename to src/SOUND/resid-fp/siddefs-fp.h diff --git a/src/resid-fp/siddefs-fp.h.in b/src/SOUND/resid-fp/siddefs-fp.h.in similarity index 100% rename from src/resid-fp/siddefs-fp.h.in rename to src/SOUND/resid-fp/siddefs-fp.h.in diff --git a/src/resid-fp/version.cc b/src/SOUND/resid-fp/version.cc similarity index 100% rename from src/resid-fp/version.cc rename to src/SOUND/resid-fp/version.cc diff --git a/src/resid-fp/voice.cc b/src/SOUND/resid-fp/voice.cc similarity index 100% rename from src/resid-fp/voice.cc rename to src/SOUND/resid-fp/voice.cc diff --git a/src/resid-fp/voice.h b/src/SOUND/resid-fp/voice.h similarity index 100% rename from src/resid-fp/voice.h rename to src/SOUND/resid-fp/voice.h diff --git a/src/resid-fp/wave.cc b/src/SOUND/resid-fp/wave.cc similarity index 100% rename from src/resid-fp/wave.cc rename to src/SOUND/resid-fp/wave.cc diff --git a/src/resid-fp/wave.h b/src/SOUND/resid-fp/wave.h similarity index 100% rename from src/resid-fp/wave.h rename to src/SOUND/resid-fp/wave.h diff --git a/src/resid-fp/wave6581_PST.cc b/src/SOUND/resid-fp/wave6581_PST.cc similarity index 100% rename from src/resid-fp/wave6581_PST.cc rename to src/SOUND/resid-fp/wave6581_PST.cc diff --git a/src/resid-fp/wave6581_PST.dat b/src/SOUND/resid-fp/wave6581_PST.dat similarity index 100% rename from src/resid-fp/wave6581_PST.dat rename to src/SOUND/resid-fp/wave6581_PST.dat diff --git a/src/resid-fp/wave6581_PS_.cc b/src/SOUND/resid-fp/wave6581_PS_.cc similarity index 100% rename from src/resid-fp/wave6581_PS_.cc rename to src/SOUND/resid-fp/wave6581_PS_.cc diff --git a/src/resid-fp/wave6581_PS_.dat b/src/SOUND/resid-fp/wave6581_PS_.dat similarity index 100% rename from src/resid-fp/wave6581_PS_.dat rename to src/SOUND/resid-fp/wave6581_PS_.dat diff --git a/src/resid-fp/wave6581_P_T.cc b/src/SOUND/resid-fp/wave6581_P_T.cc similarity index 100% rename from src/resid-fp/wave6581_P_T.cc rename to src/SOUND/resid-fp/wave6581_P_T.cc diff --git a/src/resid-fp/wave6581_P_T.dat b/src/SOUND/resid-fp/wave6581_P_T.dat similarity index 100% rename from src/resid-fp/wave6581_P_T.dat rename to src/SOUND/resid-fp/wave6581_P_T.dat diff --git a/src/resid-fp/wave6581__ST.cc b/src/SOUND/resid-fp/wave6581__ST.cc similarity index 100% rename from src/resid-fp/wave6581__ST.cc rename to src/SOUND/resid-fp/wave6581__ST.cc diff --git a/src/resid-fp/wave6581__ST.dat b/src/SOUND/resid-fp/wave6581__ST.dat similarity index 100% rename from src/resid-fp/wave6581__ST.dat rename to src/SOUND/resid-fp/wave6581__ST.dat diff --git a/src/resid-fp/wave8580_PST.cc b/src/SOUND/resid-fp/wave8580_PST.cc similarity index 100% rename from src/resid-fp/wave8580_PST.cc rename to src/SOUND/resid-fp/wave8580_PST.cc diff --git a/src/resid-fp/wave8580_PST.dat b/src/SOUND/resid-fp/wave8580_PST.dat similarity index 100% rename from src/resid-fp/wave8580_PST.dat rename to src/SOUND/resid-fp/wave8580_PST.dat diff --git a/src/resid-fp/wave8580_PS_.cc b/src/SOUND/resid-fp/wave8580_PS_.cc similarity index 100% rename from src/resid-fp/wave8580_PS_.cc rename to src/SOUND/resid-fp/wave8580_PS_.cc diff --git a/src/resid-fp/wave8580_PS_.dat b/src/SOUND/resid-fp/wave8580_PS_.dat similarity index 100% rename from src/resid-fp/wave8580_PS_.dat rename to src/SOUND/resid-fp/wave8580_PS_.dat diff --git a/src/resid-fp/wave8580_P_T.cc b/src/SOUND/resid-fp/wave8580_P_T.cc similarity index 100% rename from src/resid-fp/wave8580_P_T.cc rename to src/SOUND/resid-fp/wave8580_P_T.cc diff --git a/src/resid-fp/wave8580_P_T.dat b/src/SOUND/resid-fp/wave8580_P_T.dat similarity index 100% rename from src/resid-fp/wave8580_P_T.dat rename to src/SOUND/resid-fp/wave8580_P_T.dat diff --git a/src/resid-fp/wave8580__ST.cc b/src/SOUND/resid-fp/wave8580__ST.cc similarity index 100% rename from src/resid-fp/wave8580__ST.cc rename to src/SOUND/resid-fp/wave8580__ST.cc diff --git a/src/resid-fp/wave8580__ST.dat b/src/SOUND/resid-fp/wave8580__ST.dat similarity index 100% rename from src/resid-fp/wave8580__ST.dat rename to src/SOUND/resid-fp/wave8580__ST.dat diff --git a/src/sound_ad1848.c b/src/SOUND/snd_ad1848.c similarity index 98% rename from src/sound_ad1848.c rename to src/SOUND/snd_ad1848.c index c97a6d518..10ff8b2b3 100644 --- a/src/sound_ad1848.c +++ b/src/SOUND/snd_ad1848.c @@ -3,15 +3,17 @@ AD1848 CODEC emulation (Windows Sound System compatible)*/ #include - -#include "ibm.h" -#include "dma.h" -#include "pic.h" +#include "../ibm.h" +#include "../dma.h" +#include "../pic.h" +#include "../timer.h" #include "sound.h" -#include "sound_ad1848.h" +#include "snd_ad1848.h" + static int ad1848_vols[64]; + void ad1848_setirq(ad1848_t *ad1848, int irq) { ad1848->irq = irq; diff --git a/src/sound_ad1848.h b/src/SOUND/snd_ad1848.h similarity index 97% rename from src/sound_ad1848.h rename to src/SOUND/snd_ad1848.h index 6c5e02c55..3a0dd4e46 100644 --- a/src/sound_ad1848.h +++ b/src/SOUND/snd_ad1848.h @@ -1,5 +1,3 @@ -#include "timer.h" - typedef struct ad1848_t { int index; diff --git a/src/sound_adlib.c b/src/SOUND/snd_adlib.c similarity index 95% rename from src/sound_adlib.c rename to src/SOUND/snd_adlib.c index 70ed47b7a..e131d04c3 100644 --- a/src/sound_adlib.c +++ b/src/SOUND/snd_adlib.c @@ -1,12 +1,12 @@ #include -#include "ibm.h" -#include "io.h" -#include "device.h" +#include "../ibm.h" +#include "../io.h" +#include "../mca.h" +#include "../device.h" #include "sound.h" -#include "mca.h" +#include "snd_adlib.h" +#include "snd_opl.h" -#include "sound_adlib.h" -#include "sound_opl.h" typedef struct adlib_t { @@ -15,6 +15,7 @@ typedef struct adlib_t uint8_t pos_regs[8]; } adlib_t; + static void adlib_get_buffer(int32_t *buffer, int len, void *p) { adlib_t *adlib = (adlib_t *)p; diff --git a/src/sound_adlib.h b/src/SOUND/snd_adlib.h similarity index 100% rename from src/sound_adlib.h rename to src/SOUND/snd_adlib.h diff --git a/src/sound_adlibgold.c b/src/SOUND/snd_adlibgold.c similarity index 99% rename from src/sound_adlibgold.c rename to src/SOUND/snd_adlibgold.c index 0a4f1aaa4..e03a9cf9b 100644 --- a/src/sound_adlibgold.c +++ b/src/SOUND/snd_adlibgold.c @@ -1,18 +1,19 @@ #include #include -#include "ibm.h" -#include "device.h" - -#include "sound_opl.h" -#include "sound_ym7128.h" -#include "dma.h" -#include "io.h" -#include "pic.h" -#include "pit.h" +#include "../ibm.h" +#include "../io.h" +#include "../dma.h" +#include "../pic.h" +#include "../pit.h" +#include "../mem.h" +#include "../rom.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "timer.h" - #include "filters.h" +#include "snd_opl.h" +#include "snd_ym7128.h" + typedef struct adgold_t { diff --git a/src/sound_adlibgold.h b/src/SOUND/snd_adlibgold.h similarity index 100% rename from src/sound_adlibgold.h rename to src/SOUND/snd_adlibgold.h diff --git a/src/sound_cms.c b/src/SOUND/snd_cms.c similarity index 98% rename from src/sound_cms.c rename to src/SOUND/snd_cms.c index 93a2aab1f..1cbf723b2 100644 --- a/src/sound_cms.c +++ b/src/SOUND/snd_cms.c @@ -1,14 +1,15 @@ #include #include -#include "ibm.h" - -#include "device.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../device.h" #include "sound.h" -#include "sound_cms.h" +#include "snd_cms.h" + #define MASTER_CLOCK 7159090 + typedef struct cms_t { int addrs[2]; diff --git a/src/sound_cms.h b/src/SOUND/snd_cms.h similarity index 100% rename from src/sound_cms.h rename to src/SOUND/snd_cms.h diff --git a/src/sound_dbopl.cc b/src/SOUND/snd_dbopl.cc similarity index 98% rename from src/sound_dbopl.cc rename to src/SOUND/snd_dbopl.cc index 8f7463357..bf3260b84 100644 --- a/src/sound_dbopl.cc +++ b/src/SOUND/snd_dbopl.cc @@ -1,12 +1,14 @@ /* Copyright holders: The DOSBox Team, SA1988 see COPYING for more details */ -#include "dosbox/dbopl.h" -#include "dosbox/nukedopl.h" -#include "sound_dbopl.h" +#include "dbopl.h" +#include "nukedopl.h" +#include "snd_dbopl.h" + int opl3_type = 0; + static struct { DBOPL::Chip chip; diff --git a/src/sound_dbopl.h b/src/SOUND/snd_dbopl.h similarity index 100% rename from src/sound_dbopl.h rename to src/SOUND/snd_dbopl.h diff --git a/src/sound_emu8k.c b/src/SOUND/snd_emu8k.c similarity index 99% rename from src/sound_emu8k.c rename to src/SOUND/snd_emu8k.c index d9cddbdab..670e057a1 100644 --- a/src/sound_emu8k.c +++ b/src/SOUND/snd_emu8k.c @@ -5,12 +5,15 @@ highest (10.72 Hz) = 2^12 steps = 4096*/ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "sound_emu8k.h" -#include "timer.h" +#include "snd_emu8k.h" + enum { diff --git a/src/sound_emu8k.h b/src/SOUND/snd_emu8k.h similarity index 100% rename from src/sound_emu8k.h rename to src/SOUND/snd_emu8k.h diff --git a/src/sound_gus.c b/src/SOUND/snd_gus.c similarity index 99% rename from src/sound_gus.c rename to src/SOUND/snd_gus.c index 34b0416e4..2735d77fd 100644 --- a/src/sound_gus.c +++ b/src/SOUND/snd_gus.c @@ -1,15 +1,15 @@ #include #include #include -#include "ibm.h" - -#include "device.h" -#include "dma.h" -#include "io.h" -#include "pic.h" +#include "../ibm.h" +#include "../io.h" +#include "../pic.h" +#include "../dma.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "sound_gus.h" -#include "timer.h" +#include "snd_gus.h" + typedef struct gus_t { diff --git a/src/sound_gus.h b/src/SOUND/snd_gus.h similarity index 100% rename from src/sound_gus.h rename to src/SOUND/snd_gus.h diff --git a/src/sound_mpu401_uart.c b/src/SOUND/snd_mpu401_uart.c similarity index 93% rename from src/sound_mpu401_uart.c rename to src/SOUND/snd_mpu401_uart.c index 5d70b5427..ac145f49f 100644 --- a/src/sound_mpu401_uart.c +++ b/src/SOUND/snd_mpu401_uart.c @@ -1,7 +1,8 @@ -#include "ibm.h" -#include "io.h" -#include "plat-midi.h" -#include "sound_mpu401_uart.h" +#include "../ibm.h" +#include "../io.h" +#include "../plat-midi.h" +#include "snd_mpu401_uart.h" + enum { @@ -9,6 +10,7 @@ enum STATUS_INPUT_NOT_READY = 0x80 }; + static void mpu401_uart_write(uint16_t addr, uint8_t val, void *p) { mpu401_uart_t *mpu = (mpu401_uart_t *)p; diff --git a/src/sound_mpu401_uart.h b/src/SOUND/snd_mpu401_uart.h similarity index 100% rename from src/sound_mpu401_uart.h rename to src/SOUND/snd_mpu401_uart.h diff --git a/src/sound_opl.c b/src/SOUND/snd_opl.c similarity index 97% rename from src/sound_opl.c rename to src/SOUND/snd_opl.c index 28647f6dc..d04b7be9a 100644 --- a/src/sound_opl.c +++ b/src/SOUND/snd_opl.c @@ -3,11 +3,13 @@ */ #include #include -#include "ibm.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../timer.h" #include "sound.h" -#include "sound_opl.h" -#include "sound_dbopl.h" +#include "snd_opl.h" +#include "snd_dbopl.h" + /*Interfaces between PCem and the actual OPL emulator*/ diff --git a/src/sound_opl.h b/src/SOUND/snd_opl.h similarity index 100% rename from src/sound_opl.h rename to src/SOUND/snd_opl.h diff --git a/src/sound_pas16.c b/src/SOUND/snd_pas16.c similarity index 99% rename from src/sound_pas16.c rename to src/SOUND/snd_pas16.c index 69c245f5e..e91b7a09a 100644 --- a/src/sound_pas16.c +++ b/src/SOUND/snd_pas16.c @@ -1,17 +1,17 @@ #include -#include "ibm.h" - -#include "device.h" -#include "dma.h" -#include "filters.h" -#include "io.h" -#include "pic.h" -#include "pit.h" +#include "../ibm.h" +#include "../io.h" +#include "../pic.h" +#include "../pit.h" +#include "../dma.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "sound_opl.h" -#include "sound_pas16.h" -#include "sound_sb_dsp.h" -#include "timer.h" +#include "snd_opl.h" +#include "snd_pas16.h" +#include "snd_sb_dsp.h" +#include "filters.h" + /* Original PAS uses 2 x OPL2 diff --git a/src/sound_pas16.h b/src/SOUND/snd_pas16.h similarity index 100% rename from src/sound_pas16.h rename to src/SOUND/snd_pas16.h diff --git a/src/sound_ps1.c b/src/SOUND/snd_ps1.c similarity index 96% rename from src/sound_ps1.c rename to src/SOUND/snd_ps1.c index 6c2498e7e..85334101a 100644 --- a/src/sound_ps1.c +++ b/src/SOUND/snd_ps1.c @@ -1,11 +1,13 @@ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "pic.h" +#include "../ibm.h" +#include "../io.h" +#include "../pic.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "sound_ps1.h" -#include "sound_sn76489.h" +#include "snd_ps1.h" +#include "snd_sn76489.h" + typedef struct ps1_audio_t { diff --git a/src/sound_ps1.h b/src/SOUND/snd_ps1.h similarity index 100% rename from src/sound_ps1.h rename to src/SOUND/snd_ps1.h diff --git a/src/sound_pssj.c b/src/SOUND/snd_pssj.c similarity index 97% rename from src/sound_pssj.c rename to src/SOUND/snd_pssj.c index bda1442fd..dc52aee46 100644 --- a/src/sound_pssj.c +++ b/src/SOUND/snd_pssj.c @@ -1,14 +1,14 @@ #include -#include "ibm.h" -#include "device.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../dma.h" +#include "../pic.h" +#include "../timer.h" +#include "../device.h" #include "sound.h" -#include "sound_pssj.h" -#include "sound_sn76489.h" +#include "snd_pssj.h" +#include "snd_sn76489.h" -#include "dma.h" -#include "pic.h" -#include "timer.h" typedef struct pssj_t { diff --git a/src/sound_pssj.h b/src/SOUND/snd_pssj.h similarity index 100% rename from src/sound_pssj.h rename to src/SOUND/snd_pssj.h diff --git a/src/sound_resid.cc b/src/SOUND/snd_resid.cc similarity index 98% rename from src/sound_resid.cc rename to src/SOUND/snd_resid.cc index 8185b6046..ef1d32854 100644 --- a/src/sound_resid.cc +++ b/src/SOUND/snd_resid.cc @@ -3,7 +3,8 @@ #include #include #include "resid-fp/sid.h" -#include "sound_resid.h" +#include "snd_resid.h" + typedef struct psid_t { @@ -12,9 +13,11 @@ typedef struct psid_t int16_t last_sample; } psid_t; + psid_t *psid; -void *sid_init() + +void *sid_init(void) { // psid_t *psid; int c; diff --git a/src/sound_resid.h b/src/SOUND/snd_resid.h similarity index 100% rename from src/sound_resid.h rename to src/SOUND/snd_resid.h diff --git a/src/sound_sb.c b/src/SOUND/snd_sb.c similarity index 99% rename from src/sound_sb.c rename to src/SOUND/snd_sb.c index cd7b456f3..32f3fbc34 100644 --- a/src/sound_sb.c +++ b/src/SOUND/snd_sb.c @@ -1,19 +1,19 @@ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mca.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mca.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "sound.h" -#include "sound_emu8k.h" -#include "sound_mpu401_uart.h" -#include "sound_opl.h" -#include "sound_sb.h" -#include "sound_sb_dsp.h" - +#include "snd_emu8k.h" +#include "snd_mpu401_uart.h" +#include "snd_opl.h" +#include "snd_sb.h" +#include "snd_sb_dsp.h" #include "filters.h" + typedef struct sb_mixer_t { int master_l, master_r; diff --git a/src/sound_sb.h b/src/SOUND/snd_sb.h similarity index 100% rename from src/sound_sb.h rename to src/SOUND/snd_sb.h diff --git a/src/sound_sb_dsp.c b/src/SOUND/snd_sb_dsp.c similarity index 99% rename from src/sound_sb_dsp.c rename to src/SOUND/snd_sb_dsp.c index 13298d446..16215d05e 100644 --- a/src/sound_sb_dsp.c +++ b/src/SOUND/snd_sb_dsp.c @@ -3,24 +3,21 @@ 486-33 - 20kHz 486-50 - 32kHz Pentium - 45kHz*/ - #include #include -#include "ibm.h" - - -#include "dma.h" -#include "io.h" -#include "pic.h" +#include "../ibm.h" +#include "../io.h" +#include "../pic.h" +#include "../dma.h" +#include "../timer.h" #include "sound.h" -#include "sound_sb_dsp.h" -#include "timer.h" +#include "snd_sb_dsp.h" + void pollsb(void *p); void sb_poll_i(void *p); - static int sbe2dat[4][9] = { { 0x01, -0x02, -0x04, 0x08, -0x10, 0x20, 0x40, -0x80, -106 }, { -0x01, 0x02, -0x04, 0x08, 0x10, -0x20, 0x40, -0x80, 165 }, diff --git a/src/sound_sb_dsp.h b/src/SOUND/snd_sb_dsp.h similarity index 100% rename from src/sound_sb_dsp.h rename to src/SOUND/snd_sb_dsp.h diff --git a/src/sound_sn76489.c b/src/SOUND/snd_sn76489.c similarity index 99% rename from src/sound_sn76489.c rename to src/SOUND/snd_sn76489.c index 7d6fe80a1..574769322 100644 --- a/src/sound_sn76489.c +++ b/src/SOUND/snd_sn76489.c @@ -1,13 +1,15 @@ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../device.h" #include "sound.h" -#include "sound_sn76489.h" +#include "snd_sn76489.h" + int sn76489_mute; + static float volslog[16]= { 0.00000f,0.59715f,0.75180f,0.94650f, diff --git a/src/sound_sn76489.h b/src/SOUND/snd_sn76489.h similarity index 100% rename from src/sound_sn76489.h rename to src/SOUND/snd_sn76489.h diff --git a/src/sound_speaker.c b/src/SOUND/snd_speaker.c similarity index 93% rename from src/sound_speaker.c rename to src/SOUND/snd_speaker.c index f4bc7086d..25344d922 100644 --- a/src/sound_speaker.c +++ b/src/SOUND/snd_speaker.c @@ -1,17 +1,18 @@ -#include "ibm.h" +#include "../ibm.h" #include "sound.h" -#include "sound_speaker.h" +#include "snd_speaker.h" + int speaker_mute = 0; - -static int16_t speaker_buffer[SOUNDBUFLEN]; - -static int speaker_pos = 0; - int speaker_gated = 0; int speaker_enable = 0, was_speaker_enable = 0; -void speaker_update() + +static int16_t speaker_buffer[SOUNDBUFLEN]; +static int speaker_pos = 0; + + +void speaker_update(void) { int16_t val; @@ -51,7 +52,8 @@ static void speaker_get_buffer(int32_t *buffer, int len, void *p) speaker_pos = 0; } -void speaker_init() + +void speaker_init(void) { sound_add_handler(speaker_get_buffer, NULL); speaker_mute = 0; diff --git a/src/sound_speaker.h b/src/SOUND/snd_speaker.h similarity index 100% rename from src/sound_speaker.h rename to src/SOUND/snd_speaker.h diff --git a/src/sound_ssi2001.c b/src/SOUND/snd_ssi2001.c similarity index 94% rename from src/sound_ssi2001.c rename to src/SOUND/snd_ssi2001.c index d0a7e2136..d42898b9d 100644 --- a/src/sound_ssi2001.c +++ b/src/SOUND/snd_ssi2001.c @@ -1,11 +1,11 @@ #include -#include "ibm.h" -#include "device.h" -#include "io.h" +#include "../ibm.h" +#include "../io.h" +#include "../device.h" #include "sound.h" +#include "snd_resid.h" +#include "snd_ssi2001.h" -#include "sound_resid.h" -#include "sound_ssi2001.h" typedef struct ssi2001_t { diff --git a/src/sound_ssi2001.h b/src/SOUND/snd_ssi2001.h similarity index 100% rename from src/sound_ssi2001.h rename to src/SOUND/snd_ssi2001.h diff --git a/src/sound_wss.c b/src/SOUND/snd_wss.c similarity index 93% rename from src/sound_wss.c rename to src/SOUND/snd_wss.c index f8a5bcbd6..a58bc0b64 100644 --- a/src/sound_wss.c +++ b/src/SOUND/snd_wss.c @@ -2,18 +2,18 @@ Windows Sound System emulation*/ -#include #include -#include "ibm.h" - -#include "device.h" -#include "dma.h" -#include "io.h" -#include "pic.h" +#include +#include "../ibm.h" +#include "../io.h" +#include "../pic.h" +#include "../dma.h" +#include "../device.h" #include "sound.h" -#include "sound_ad1848.h" -#include "sound_opl.h" -#include "sound_wss.h" +#include "snd_ad1848.h" +#include "snd_opl.h" +#include "snd_wss.h" + /*530, 11, 3 - 530=23*/ /*530, 11, 1 - 530=22*/ @@ -29,6 +29,7 @@ static int wss_dma[4] = {0, 0, 1, 3}; static int wss_irq[8] = {5, 7, 9, 10, 11, 12, 14, 15}; /*W95 only uses 7-9, others may be wrong*/ + typedef struct wss_t { uint8_t config; diff --git a/src/sound_wss.h b/src/SOUND/snd_wss.h similarity index 100% rename from src/sound_wss.h rename to src/SOUND/snd_wss.h diff --git a/src/sound_ym7128.c b/src/SOUND/snd_ym7128.c similarity index 99% rename from src/sound_ym7128.c rename to src/SOUND/snd_ym7128.c index be0b3946c..4bea44f53 100644 --- a/src/sound_ym7128.c +++ b/src/SOUND/snd_ym7128.c @@ -1,9 +1,11 @@ -#include "ibm.h" -#include "sound_ym7128.h" +#include "../ibm.h" +#include "snd_ym7128.h" + static int attenuation[32]; static int tap_position[32]; + void ym7128_init(ym7128_t *ym7128) { int c; diff --git a/src/sound_ym7128.h b/src/SOUND/snd_ym7128.h similarity index 100% rename from src/sound_ym7128.h rename to src/SOUND/snd_ym7128.h diff --git a/src/sound.c b/src/SOUND/sound.c similarity index 96% rename from src/sound.c rename to src/SOUND/sound.c index a00f7f9ca..1b60e3068 100644 --- a/src/sound.c +++ b/src/SOUND/sound.c @@ -1,30 +1,26 @@ #include #include #include - -#include "cdrom.h" -#include "ibm.h" - -#include "device.h" - +#include "../ibm.h" +#include "../device.h" +#include "../timer.h" +#include "../thread.h" +#include "../cdrom.h" +#include "sound.h" +#include "snd_opl.h" +#include "snd_adlib.h" +#include "snd_adlibgold.h" +#include "snd_pas16.h" +#include "snd_sb.h" +#include "snd_sb_dsp.h" +#include "snd_wss.h" #include "filters.h" -#include "sound_opl.h" - -#include "sound.h" -#include "sound_adlib.h" -#include "sound_adlibgold.h" -#include "sound_pas16.h" -#include "sound_sb.h" -#include "sound_sb_dsp.h" -#include "sound_wss.h" - -#include "timer.h" -#include "thread.h" int sound_card_current = 0; static int sound_card_last = 0; + typedef struct { char name[64]; diff --git a/src/sound.h b/src/SOUND/sound.h similarity index 97% rename from src/sound.h rename to src/SOUND/sound.h index 23eea439e..ffa9d87af 100644 --- a/src/sound.h +++ b/src/SOUND/sound.h @@ -1,5 +1,3 @@ -#include "timer.h" - void sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p); extern int sound_card_current; diff --git a/src/vid_ati18800.c b/src/VIDEO/vid_ati18800.c similarity index 98% rename from src/vid_ati18800.c rename to src/VIDEO/vid_ati18800.c index bb30b4f1c..ecbb4fe40 100644 --- a/src/vid_ati18800.c +++ b/src/VIDEO/vid_ati18800.c @@ -3,16 +3,17 @@ */ /*ATI 18800 emulation (VGA Edge-16)*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_ati18800.h" #include "vid_ati_eeprom.h" #include "vid_svga.h" + typedef struct ati18800_t { svga_t svga; diff --git a/src/vid_ati18800.h b/src/VIDEO/vid_ati18800.h similarity index 100% rename from src/vid_ati18800.h rename to src/VIDEO/vid_ati18800.h diff --git a/src/vid_ati28800.c b/src/VIDEO/vid_ati28800.c similarity index 99% rename from src/vid_ati28800.c rename to src/VIDEO/vid_ati28800.c index 54269a9de..84d8ec8e4 100644 --- a/src/vid_ati28800.c +++ b/src/VIDEO/vid_ati28800.c @@ -3,17 +3,18 @@ */ /*ATI 28800 emulation (VGA Charger)*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" +#include "../timer.h" #include "video.h" #include "vid_ati28800.h" #include "vid_ati_eeprom.h" #include "vid_svga.h" #include "vid_svga_render.h" -#include "timer.h" + typedef struct ati28800_t { diff --git a/src/vid_ati28800.h b/src/VIDEO/vid_ati28800.h similarity index 100% rename from src/vid_ati28800.h rename to src/VIDEO/vid_ati28800.h diff --git a/src/vid_ati68860_ramdac.c b/src/VIDEO/vid_ati68860_ramdac.c similarity index 99% rename from src/vid_ati68860_ramdac.c rename to src/VIDEO/vid_ati68860_ramdac.c index a8c2f132d..f1d1d6b84 100644 --- a/src/vid_ati68860_ramdac.c +++ b/src/VIDEO/vid_ati68860_ramdac.c @@ -21,13 +21,14 @@ bit 0 Controls 6/8bit DAC. 0: 8bit DAC/LUT, 1: 6bit DAC/LUT 5-6 Always set ? 7 If set can remove "snow" in some cases (A860_Delay_L ?) ?? */ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_ati68860_ramdac.h" #include "vid_svga_render.h" + void ati68860_ramdac_out(uint16_t addr, uint8_t val, ati68860_ramdac_t *ramdac, svga_t *svga) { switch (addr) diff --git a/src/vid_ati68860_ramdac.h b/src/VIDEO/vid_ati68860_ramdac.h similarity index 100% rename from src/vid_ati68860_ramdac.h rename to src/VIDEO/vid_ati68860_ramdac.h diff --git a/src/vid_ati_eeprom.c b/src/VIDEO/vid_ati_eeprom.c similarity index 99% rename from src/vid_ati_eeprom.c rename to src/VIDEO/vid_ati_eeprom.c index bc7a56079..198575a60 100644 --- a/src/vid_ati_eeprom.c +++ b/src/VIDEO/vid_ati_eeprom.c @@ -1,11 +1,12 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ -#include "ibm.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../mem.h" +#include "../rom.h" #include "vid_ati_eeprom.h" + enum { EEPROM_IDLE, diff --git a/src/vid_ati_eeprom.h b/src/VIDEO/vid_ati_eeprom.h similarity index 100% rename from src/vid_ati_eeprom.h rename to src/VIDEO/vid_ati_eeprom.h diff --git a/src/vid_ati_mach64.c b/src/VIDEO/vid_ati_mach64.c similarity index 99% rename from src/vid_ati_mach64.c rename to src/VIDEO/vid_ati_mach64.c index 4a2744c59..12bbf2383 100644 --- a/src/vid_ati_mach64.c +++ b/src/VIDEO/vid_ati_mach64.c @@ -1,12 +1,12 @@ /*ATI Mach64 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../rom.h" +#include "../thread.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" @@ -14,6 +14,7 @@ #include "vid_ati_eeprom.h" #include "vid_ics2595.h" + #define FIFO_SIZE 65536 #define FIFO_MASK (FIFO_SIZE - 1) #define FIFO_ENTRY_SIZE (1 << 31) diff --git a/src/vid_ati_mach64.h b/src/VIDEO/vid_ati_mach64.h similarity index 100% rename from src/vid_ati_mach64.h rename to src/VIDEO/vid_ati_mach64.h diff --git a/src/vid_bt485_ramdac.c b/src/VIDEO/vid_bt485_ramdac.c similarity index 99% rename from src/vid_bt485_ramdac.c rename to src/VIDEO/vid_bt485_ramdac.c index 57848a128..e11f69132 100644 --- a/src/vid_bt485_ramdac.c +++ b/src/VIDEO/vid_bt485_ramdac.c @@ -3,12 +3,13 @@ */ /*Brooktree BT485 true colour RAMDAC emulation*/ /*Currently only a dummy stub for logging and passing output to the generic SVGA handler*/ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_bt485_ramdac.h" + int bt485_get_clock_divider(bt485_ramdac_t *ramdac) { return 1; /* Will be implemented later. */ diff --git a/src/vid_bt485_ramdac.h b/src/VIDEO/vid_bt485_ramdac.h similarity index 100% rename from src/vid_bt485_ramdac.h rename to src/VIDEO/vid_bt485_ramdac.h diff --git a/src/vid_cga.c b/src/VIDEO/vid_cga.c similarity index 99% rename from src/vid_cga.c rename to src/VIDEO/vid_cga.c index a665e45d9..646ba51e9 100644 --- a/src/vid_cga.c +++ b/src/VIDEO/vid_cga.c @@ -4,18 +4,19 @@ /*CGA emulation*/ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_cga.h" -#include "dosbox/vid_cga_comp.h" +#include "vid_cga_comp.h" #ifndef __unix -#include "win-cgapal.h" +#include "../win-cgapal.h" #endif + #define CGA_RGB 0 #define CGA_COMPOSITE 1 diff --git a/src/vid_cga.h b/src/VIDEO/vid_cga.h similarity index 100% rename from src/vid_cga.h rename to src/VIDEO/vid_cga.h diff --git a/src/dosbox/vid_cga_comp.c b/src/VIDEO/vid_cga_comp.c similarity index 99% rename from src/dosbox/vid_cga_comp.c rename to src/VIDEO/vid_cga_comp.c index 63e54cdad..a63d69f2e 100644 --- a/src/dosbox/vid_cga_comp.c +++ b/src/VIDEO/vid_cga_comp.c @@ -8,11 +8,13 @@ #include "../ibm.h" #include "../device.h" #include "../mem.h" -#include "../vid_cga.h" +#include "vid_cga.h" #include "vid_cga_comp.h" + int CGA_Composite_Table[1024]; + static double brightness = 0; static double contrast = 100; static double saturation = 100; diff --git a/src/dosbox/vid_cga_comp.h b/src/VIDEO/vid_cga_comp.h similarity index 100% rename from src/dosbox/vid_cga_comp.h rename to src/VIDEO/vid_cga_comp.h diff --git a/src/vid_cl5429.h b/src/VIDEO/vid_cl5429.h similarity index 100% rename from src/vid_cl5429.h rename to src/VIDEO/vid_cl5429.h diff --git a/src/vid_cl_gd.c b/src/VIDEO/vid_cl_gd.c similarity index 99% rename from src/vid_cl_gd.c rename to src/VIDEO/vid_cl_gd.c index b932992bb..89d9d3c77 100644 --- a/src/vid_cl_gd.c +++ b/src/VIDEO/vid_cl_gd.c @@ -1,10 +1,10 @@ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" @@ -12,6 +12,7 @@ #include "vid_cl_gd.h" #include "vid_cl_gd_blit.h" + void cirrus_update_bank_ptr(clgd_t *clgd, uint8_t bank_index); void clgd_recalctimings(svga_t *svga); @@ -1113,4 +1114,4 @@ device_t gd6235_device = clgd_speed_changed, clgd_force_redraw, clgd_add_status_info -}; \ No newline at end of file +}; diff --git a/src/vid_cl_gd.h b/src/VIDEO/vid_cl_gd.h similarity index 100% rename from src/vid_cl_gd.h rename to src/VIDEO/vid_cl_gd.h diff --git a/src/vid_cl_gd_blit.c b/src/VIDEO/vid_cl_gd_blit.c similarity index 99% rename from src/vid_cl_gd_blit.c rename to src/VIDEO/vid_cl_gd_blit.c index b312f0012..18d6642f3 100644 --- a/src/vid_cl_gd_blit.c +++ b/src/VIDEO/vid_cl_gd_blit.c @@ -1,10 +1,10 @@ /*This is the CL-GD 5446 blitter, directly from QEMU*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" @@ -12,6 +12,7 @@ #include "vid_cl_gd.h" #include "vid_cl_gd_blit.h" + // Same for all the svga->vrammask which are -s>cirrus_addr_mask in the original. // Eventually this needs to be configurable diff --git a/src/vid_cl_gd_blit.h b/src/VIDEO/vid_cl_gd_blit.h similarity index 100% rename from src/vid_cl_gd_blit.h rename to src/VIDEO/vid_cl_gd_blit.h diff --git a/src/vid_cl_gd_vga_rop.h b/src/VIDEO/vid_cl_gd_vga_rop.h similarity index 100% rename from src/vid_cl_gd_vga_rop.h rename to src/VIDEO/vid_cl_gd_vga_rop.h diff --git a/src/vid_cl_gd_vga_rop2.h b/src/VIDEO/vid_cl_gd_vga_rop2.h similarity index 100% rename from src/vid_cl_gd_vga_rop2.h rename to src/VIDEO/vid_cl_gd_vga_rop2.h diff --git a/src/vid_cl_ramdac.c b/src/VIDEO/vid_cl_ramdac.c similarity index 97% rename from src/vid_cl_ramdac.c rename to src/VIDEO/vid_cl_ramdac.c index 2520038ea..340d27c88 100644 --- a/src/vid_cl_ramdac.c +++ b/src/VIDEO/vid_cl_ramdac.c @@ -1,13 +1,14 @@ -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_cl_ramdac.h" #include "vid_cl_gd.h" #include "vid_cl_gd_blit.h" + void cl_ramdac_out(uint16_t addr, uint8_t val, cl_ramdac_t *ramdac, void *clgd, svga_t *svga) { clgd_t *real_clgd = (clgd_t *) clgd; @@ -97,4 +98,4 @@ uint8_t cl_ramdac_in(uint16_t addr, cl_ramdac_t *ramdac, void *clgd, svga_t *svg break; } return svga_in(addr, svga); -} \ No newline at end of file +} diff --git a/src/vid_cl_ramdac.h b/src/VIDEO/vid_cl_ramdac.h similarity index 100% rename from src/vid_cl_ramdac.h rename to src/VIDEO/vid_cl_ramdac.h diff --git a/src/vid_colorplus.c b/src/VIDEO/vid_colorplus.c similarity index 99% rename from src/vid_colorplus.c rename to src/VIDEO/vid_colorplus.c index 13a661b04..25ceb71dc 100644 --- a/src/vid_colorplus.c +++ b/src/VIDEO/vid_colorplus.c @@ -1,15 +1,16 @@ /*Plantronics ColorPlus emulation*/ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_cga.h" #include "vid_colorplus.h" -#include "dosbox/vid_cga_comp.h" +#include "vid_cga_comp.h" + /* Bits in the colorplus control register: */ #define COLORPLUS_PLANE_SWAP 0x40 /* Swap planes at 0000h and 4000h */ diff --git a/src/vid_colorplus.h b/src/VIDEO/vid_colorplus.h similarity index 100% rename from src/vid_colorplus.h rename to src/VIDEO/vid_colorplus.h diff --git a/src/vid_ega.c b/src/VIDEO/vid_ega.c similarity index 99% rename from src/vid_ega.c rename to src/VIDEO/vid_ega.c index 42062b5b8..9243c825f 100644 --- a/src/vid_ega.c +++ b/src/VIDEO/vid_ega.c @@ -1,14 +1,15 @@ /*EGA emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_ega.h" + extern uint8_t edatlookup[4][4]; static uint8_t ega_rotate[8][256]; diff --git a/src/vid_ega.h b/src/VIDEO/vid_ega.h similarity index 100% rename from src/vid_ega.h rename to src/VIDEO/vid_ega.h diff --git a/src/vid_et4000.c b/src/VIDEO/vid_et4000.c similarity index 98% rename from src/vid_et4000.c rename to src/VIDEO/vid_et4000.c index 77831c446..9ee0255a6 100644 --- a/src/vid_et4000.c +++ b/src/VIDEO/vid_et4000.c @@ -3,17 +3,17 @@ */ /*ET4000 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_unk_ramdac.h" - #include "vid_et4000.h" + typedef struct et4000_t { svga_t svga; diff --git a/src/vid_et4000.h b/src/VIDEO/vid_et4000.h similarity index 100% rename from src/vid_et4000.h rename to src/VIDEO/vid_et4000.h diff --git a/src/vid_et4000w32.c b/src/VIDEO/vid_et4000w32.c similarity index 99% rename from src/vid_et4000w32.c rename to src/VIDEO/vid_et4000w32.c index 7f63f946a..69b21af50 100644 --- a/src/vid_et4000w32.c +++ b/src/VIDEO/vid_et4000w32.c @@ -4,18 +4,19 @@ - Accelerator doesn't work in planar modes */ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../rom.h" +#include "../device.h" +#include "../thread.h" #include "video.h" #include "vid_svga.h" #include "vid_icd2061.h" #include "vid_stg_ramdac.h" + #define FIFO_SIZE 65536 #define FIFO_MASK (FIFO_SIZE - 1) #define FIFO_ENTRY_SIZE (1 << 31) diff --git a/src/vid_et4000w32.h b/src/VIDEO/vid_et4000w32.h similarity index 100% rename from src/vid_et4000w32.h rename to src/VIDEO/vid_et4000w32.h diff --git a/src/vid_et4000w32i.c b/src/VIDEO/vid_et4000w32i.c similarity index 100% rename from src/vid_et4000w32i.c rename to src/VIDEO/vid_et4000w32i.c diff --git a/src/vid_genius.c b/src/VIDEO/vid_genius.c similarity index 99% rename from src/vid_genius.c rename to src/VIDEO/vid_genius.c index 477d845d4..a0053cc93 100644 --- a/src/vid_genius.c +++ b/src/VIDEO/vid_genius.c @@ -1,17 +1,19 @@ /* MDSI Genius VHR emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_genius.h" + #define GENIUS_XSIZE 728 #define GENIUS_YSIZE 1008 + void updatewindowsize(int x, int y); extern uint8_t fontdat8x12[256][16]; diff --git a/src/vid_genius.h b/src/VIDEO/vid_genius.h similarity index 100% rename from src/vid_genius.h rename to src/VIDEO/vid_genius.h diff --git a/src/vid_hercules.c b/src/VIDEO/vid_hercules.c similarity index 99% rename from src/vid_hercules.c rename to src/VIDEO/vid_hercules.c index 4a9606b32..8eefb409f 100644 --- a/src/vid_hercules.c +++ b/src/VIDEO/vid_hercules.c @@ -3,17 +3,18 @@ */ /*Hercules emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "io.h" -#include "timer.h" +#include "../ibm.h" +#include "../mem.h" +#include "../io.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_hercules.h" #ifndef __unix -#include "win-cgapal.h" +#include "../win-cgapal.h" #endif + typedef struct hercules_t { mem_mapping_t mapping; diff --git a/src/vid_hercules.h b/src/VIDEO/vid_hercules.h similarity index 100% rename from src/vid_hercules.h rename to src/VIDEO/vid_hercules.h diff --git a/src/vid_herculesplus.c b/src/VIDEO/vid_herculesplus.c similarity index 99% rename from src/vid_herculesplus.c rename to src/VIDEO/vid_herculesplus.c index 7af5d4a9c..a2a004312 100644 --- a/src/vid_herculesplus.c +++ b/src/VIDEO/vid_herculesplus.c @@ -4,11 +4,11 @@ /*Hercules InColor emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "io.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_herculesplus.h" diff --git a/src/vid_herculesplus.h b/src/VIDEO/vid_herculesplus.h similarity index 100% rename from src/vid_herculesplus.h rename to src/VIDEO/vid_herculesplus.h diff --git a/src/vid_icd2061.c b/src/VIDEO/vid_icd2061.c similarity index 99% rename from src/vid_icd2061.c rename to src/VIDEO/vid_icd2061.c index bc75d4999..04c2db166 100644 --- a/src/vid_icd2061.c +++ b/src/VIDEO/vid_icd2061.c @@ -5,9 +5,10 @@ ICD2061 clock generator emulation Used by ET4000w32/p (Diamond Stealth 32)*/ -#include "ibm.h" +#include "../ibm.h" #include "vid_icd2061.h" + void icd2061_write(icd2061_t *icd2061, int val) { int q, p, m, a; diff --git a/src/vid_icd2061.h b/src/VIDEO/vid_icd2061.h similarity index 100% rename from src/vid_icd2061.h rename to src/VIDEO/vid_icd2061.h diff --git a/src/vid_ics2595.c b/src/VIDEO/vid_ics2595.c similarity index 98% rename from src/vid_ics2595.c rename to src/VIDEO/vid_ics2595.c index 15c397729..ffe6f504c 100644 --- a/src/vid_ics2595.c +++ b/src/VIDEO/vid_ics2595.c @@ -3,10 +3,10 @@ */ /*ICS2595 clock chip emulation Used by ATI Mach64*/ - -#include "ibm.h" +#include "../ibm.h" #include "vid_ics2595.h" + enum { ICS2595_IDLE = 0, @@ -14,8 +14,10 @@ enum ICS2595_READ }; + static int ics2595_div[4] = {8, 4, 2, 1}; + void ics2595_write(ics2595_t *ics2595, int strobe, int dat) { if (strobe) diff --git a/src/vid_ics2595.h b/src/VIDEO/vid_ics2595.h similarity index 100% rename from src/vid_ics2595.h rename to src/VIDEO/vid_ics2595.h diff --git a/src/vid_incolor.c b/src/VIDEO/vid_incolor.c similarity index 99% rename from src/vid_incolor.c rename to src/VIDEO/vid_incolor.c index 4185978b0..45cf15d41 100644 --- a/src/vid_incolor.c +++ b/src/VIDEO/vid_incolor.c @@ -2,13 +2,12 @@ see COPYING for more details */ /*Hercules InColor emulation*/ - #include -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "io.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_incolor.h" diff --git a/src/vid_incolor.h b/src/VIDEO/vid_incolor.h similarity index 100% rename from src/vid_incolor.h rename to src/VIDEO/vid_incolor.h diff --git a/src/vid_mda.c b/src/VIDEO/vid_mda.c similarity index 98% rename from src/vid_mda.c rename to src/VIDEO/vid_mda.c index 4b45debc3..689cc56ab 100644 --- a/src/vid_mda.c +++ b/src/VIDEO/vid_mda.c @@ -3,17 +3,18 @@ */ /*MDA emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_mda.h" #ifndef __unix -#include "win-cgapal.h" +#include "../win-cgapal.h" #endif + typedef struct mda_t { mem_mapping_t mapping; diff --git a/src/vid_mda.h b/src/VIDEO/vid_mda.h similarity index 100% rename from src/vid_mda.h rename to src/VIDEO/vid_mda.h diff --git a/src/vid_nv_riva128.c b/src/VIDEO/vid_nv_riva128.c similarity index 99% rename from src/vid_nv_riva128.c rename to src/VIDEO/vid_nv_riva128.c index ce8ff697c..d6bcd839b 100644 --- a/src/vid_nv_riva128.c +++ b/src/VIDEO/vid_nv_riva128.c @@ -3,20 +3,21 @@ */ /*nVidia RIVA 128 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "pic.h" -#include "rom.h" -#include "thread.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../pic.h" +#include "../rom.h" +#include "../thread.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_nv_riva128.h" #include "vid_svga.h" #include "vid_svga_render.h" + typedef struct riva128_t { mem_mapping_t linear_mapping; diff --git a/src/vid_nv_riva128.h b/src/VIDEO/vid_nv_riva128.h similarity index 100% rename from src/vid_nv_riva128.h rename to src/VIDEO/vid_nv_riva128.h diff --git a/src/vid_olivetti_m24.c b/src/VIDEO/vid_olivetti_m24.c similarity index 99% rename from src/vid_olivetti_m24.c rename to src/VIDEO/vid_olivetti_m24.c index 8b6e62983..f130c69fb 100644 --- a/src/vid_olivetti_m24.c +++ b/src/VIDEO/vid_olivetti_m24.c @@ -4,14 +4,15 @@ /*Olivetti M24 video emulation Essentially double-res CGA*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_olivetti_m24.h" + typedef struct m24_t { mem_mapping_t mapping; diff --git a/src/vid_olivetti_m24.h b/src/VIDEO/vid_olivetti_m24.h similarity index 100% rename from src/vid_olivetti_m24.h rename to src/VIDEO/vid_olivetti_m24.h diff --git a/src/vid_oti067.c b/src/VIDEO/vid_oti067.c similarity index 98% rename from src/vid_oti067.c rename to src/VIDEO/vid_oti067.c index dc3d94e6c..c04a43778 100644 --- a/src/vid_oti067.c +++ b/src/VIDEO/vid_oti067.c @@ -3,15 +3,16 @@ */ /*Oak OTI067 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_oti067.h" #include "vid_svga.h" + typedef struct oti067_t { svga_t svga; diff --git a/src/vid_oti067.h b/src/VIDEO/vid_oti067.h similarity index 100% rename from src/vid_oti067.h rename to src/VIDEO/vid_oti067.h diff --git a/src/vid_paradise.c b/src/VIDEO/vid_paradise.c similarity index 99% rename from src/vid_paradise.c rename to src/VIDEO/vid_paradise.c index 6a385611a..4527619fe 100644 --- a/src/vid_paradise.c +++ b/src/VIDEO/vid_paradise.c @@ -7,17 +7,18 @@ MegaPC uses W90C11A */ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_paradise.h" #include "vid_svga.h" #include "vid_svga_render.h" #include "vid_unk_ramdac.h" + typedef struct paradise_t { svga_t svga; diff --git a/src/vid_paradise.h b/src/VIDEO/vid_paradise.h similarity index 100% rename from src/vid_paradise.h rename to src/VIDEO/vid_paradise.h diff --git a/src/vid_pc1512.c b/src/VIDEO/vid_pc1512.c similarity index 99% rename from src/vid_pc1512.c rename to src/VIDEO/vid_pc1512.c index 466db6f8f..832bde2ea 100644 --- a/src/vid_pc1512.c +++ b/src/VIDEO/vid_pc1512.c @@ -10,14 +10,15 @@ The Technical Reference Manual lists the video waitstate time as between 12 and 46 cycles. PCem currently always uses the lower number.*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_pc1512.h" + typedef struct pc1512_t { mem_mapping_t mapping; diff --git a/src/vid_pc1512.h b/src/VIDEO/vid_pc1512.h similarity index 100% rename from src/vid_pc1512.h rename to src/VIDEO/vid_pc1512.h diff --git a/src/vid_pc1640.c b/src/VIDEO/vid_pc1640.c similarity index 97% rename from src/vid_pc1640.c rename to src/VIDEO/vid_pc1640.c index 68a2117a0..3db12e57d 100644 --- a/src/vid_pc1640.c +++ b/src/VIDEO/vid_pc1640.c @@ -4,17 +4,18 @@ /*PC1640 video emulation. Mostly standard EGA, but with CGA & Hercules emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_cga.h" #include "vid_ega.h" #include "vid_pc1640.h" + typedef struct pc1640_t { mem_mapping_t cga_mapping; diff --git a/src/vid_pc1640.h b/src/VIDEO/vid_pc1640.h similarity index 100% rename from src/vid_pc1640.h rename to src/VIDEO/vid_pc1640.h diff --git a/src/vid_pc200.c b/src/VIDEO/vid_pc200.c similarity index 97% rename from src/vid_pc200.c rename to src/VIDEO/vid_pc200.c index 99eeb3171..eef181c33 100644 --- a/src/vid_pc200.c +++ b/src/VIDEO/vid_pc200.c @@ -5,15 +5,16 @@ CGA with some NMI stuff. But we don't need that as it's only used for TV and LCD displays, and we're emulating a CRT*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_cga.h" #include "vid_pc200.h" + typedef struct pc200_t { mem_mapping_t mapping; diff --git a/src/vid_pc200.h b/src/VIDEO/vid_pc200.h similarity index 100% rename from src/vid_pc200.h rename to src/VIDEO/vid_pc200.h diff --git a/src/vid_pcjr.c b/src/VIDEO/vid_pcjr.c similarity index 99% rename from src/vid_pcjr.c rename to src/VIDEO/vid_pcjr.c index b10cb475c..0557967d9 100644 --- a/src/vid_pcjr.c +++ b/src/VIDEO/vid_pcjr.c @@ -1,18 +1,20 @@ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pic.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pic.h" +#include "../timer.h" +#include "../device.h" #include "video.h" -#include "dosbox/vid_cga_comp.h" +#include "vid_cga_comp.h" #include "vid_pcjr.h" + #define PCJR_RGB 0 #define PCJR_COMPOSITE 1 + typedef struct pcjr_t { mem_mapping_t mapping; diff --git a/src/vid_pcjr.h b/src/VIDEO/vid_pcjr.h similarity index 100% rename from src/vid_pcjr.h rename to src/VIDEO/vid_pcjr.h diff --git a/src/vid_ps1_svga.c b/src/VIDEO/vid_ps1_svga.c similarity index 98% rename from src/vid_ps1_svga.c rename to src/VIDEO/vid_ps1_svga.c index 86b10c8ec..9bb6acafc 100644 --- a/src/vid_ps1_svga.c +++ b/src/VIDEO/vid_ps1_svga.c @@ -8,15 +8,16 @@ it's just a VGA for now. */ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_vga.h" + typedef struct ps1_m2121_svga_t { svga_t svga; diff --git a/src/vid_ps1_svga.h b/src/VIDEO/vid_ps1_svga.h similarity index 100% rename from src/vid_ps1_svga.h rename to src/VIDEO/vid_ps1_svga.h diff --git a/src/vid_s3.c b/src/VIDEO/vid_s3.c similarity index 99% rename from src/vid_s3.c rename to src/VIDEO/vid_s3.c index cf2621698..9feac48de 100644 --- a/src/vid_s3.c +++ b/src/VIDEO/vid_s3.c @@ -1,18 +1,19 @@ /*S3 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../rom.h" +#include "../thread.h" +#include "../device.h" #include "video.h" #include "vid_s3.h" #include "vid_svga.h" #include "vid_svga_render.h" #include "vid_sdac_ramdac.h" + enum { S3_VISION864, diff --git a/src/vid_s3.h b/src/VIDEO/vid_s3.h similarity index 100% rename from src/vid_s3.h rename to src/VIDEO/vid_s3.h diff --git a/src/vid_s3_virge.c b/src/VIDEO/vid_s3_virge.c similarity index 99% rename from src/vid_s3_virge.c rename to src/VIDEO/vid_s3_virge.c index e11f1c7d0..21723de42 100644 --- a/src/vid_s3_virge.c +++ b/src/VIDEO/vid_s3_virge.c @@ -3,18 +3,19 @@ */ /*S3 ViRGE emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../rom.h" +#include "../device.h" +#include "../thread.h" #include "video.h" #include "vid_s3_virge.h" #include "vid_svga.h" #include "vid_svga_render.h" + static uint64_t virge_time = 0; static uint64_t status_time = 0; static int reg_writes = 0, reg_reads = 0; diff --git a/src/vid_s3_virge.h b/src/VIDEO/vid_s3_virge.h similarity index 100% rename from src/vid_s3_virge.h rename to src/VIDEO/vid_s3_virge.h diff --git a/src/vid_sdac_ramdac.c b/src/VIDEO/vid_sdac_ramdac.c similarity index 99% rename from src/vid_sdac_ramdac.c rename to src/VIDEO/vid_sdac_ramdac.c index c1dad85d2..3bff85104 100644 --- a/src/vid_sdac_ramdac.c +++ b/src/VIDEO/vid_sdac_ramdac.c @@ -3,12 +3,13 @@ */ /*87C716 'SDAC' true colour RAMDAC emulation*/ /*Misidentifies as AT&T 21C504*/ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_sdac_ramdac.h" + /* Returning divider * 2 */ int sdac_get_clock_divider(sdac_ramdac_t *ramdac) { diff --git a/src/vid_sdac_ramdac.h b/src/VIDEO/vid_sdac_ramdac.h similarity index 100% rename from src/vid_sdac_ramdac.h rename to src/VIDEO/vid_sdac_ramdac.h diff --git a/src/vid_stg_ramdac.c b/src/VIDEO/vid_stg_ramdac.c similarity index 99% rename from src/vid_stg_ramdac.c rename to src/VIDEO/vid_stg_ramdac.c index 2aa3fee19..2881fff91 100644 --- a/src/vid_stg_ramdac.c +++ b/src/VIDEO/vid_stg_ramdac.c @@ -2,15 +2,17 @@ see COPYING for more details */ /*STG1702 true colour RAMDAC emulation*/ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_stg_ramdac.h" + static int stg_state_read[2][8] = {{1,2,3,4,0,0,0,0}, {1,2,3,4,5,6,7,7}}; static int stg_state_write[8] = {0,0,0,0,0,6,7,7}; + void stg_ramdac_set_bpp(svga_t *svga, stg_ramdac_t *ramdac) { if (ramdac->command & 0x8) diff --git a/src/vid_stg_ramdac.h b/src/VIDEO/vid_stg_ramdac.h similarity index 100% rename from src/vid_stg_ramdac.h rename to src/VIDEO/vid_stg_ramdac.h diff --git a/src/vid_svga.c b/src/VIDEO/vid_svga.c similarity index 99% rename from src/vid_svga.c rename to src/VIDEO/vid_svga.c index 9db83a709..bb54d1498 100644 --- a/src/vid_svga.c +++ b/src/VIDEO/vid_svga.c @@ -5,16 +5,18 @@ /*This is intended to be used by another SVGA driver, and not as a card in it's own right*/ #include #include -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" -#include "io.h" -#include "timer.h" + #define svga_output 0 + void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga); extern uint8_t edatlookup[4][4]; @@ -1842,4 +1844,4 @@ void svga_add_status_info(char *s, int max_len, void *p) sprintf(temps, "SVGA DAC in %i-bit mode\n", (svga->attrregs[0x10] & 0x80) ? 8 : 6); strncat(s, temps, max_len); -} \ No newline at end of file +} diff --git a/src/vid_svga.h b/src/VIDEO/vid_svga.h similarity index 100% rename from src/vid_svga.h rename to src/VIDEO/vid_svga.h diff --git a/src/vid_svga_render.c b/src/VIDEO/vid_svga_render.c similarity index 99% rename from src/vid_svga_render.c rename to src/VIDEO/vid_svga_render.c index cf6caac68..fb8845a75 100644 --- a/src/vid_svga_render.c +++ b/src/VIDEO/vid_svga_render.c @@ -1,15 +1,17 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ -#include "ibm.h" -#include "mem.h" +#include +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" -#include + int invert_display = 0; + uint32_t svga_color_transform(uint32_t color) { uint32_t temp = 0; diff --git a/src/vid_svga_render.h b/src/VIDEO/vid_svga_render.h similarity index 100% rename from src/vid_svga_render.h rename to src/VIDEO/vid_svga_render.h diff --git a/src/vid_tandy.c b/src/VIDEO/vid_tandy.c similarity index 99% rename from src/vid_tandy.c rename to src/VIDEO/vid_tandy.c index e9deb6798..d6151e44e 100644 --- a/src/vid_tandy.c +++ b/src/VIDEO/vid_tandy.c @@ -1,17 +1,19 @@ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_tandy.h" -#include "dosbox/vid_cga_comp.h" +#include "vid_cga_comp.h" + #define TANDY_RGB 0 #define TANDY_COMPOSITE 1 + typedef struct tandy_t { mem_mapping_t mapping; diff --git a/src/vid_tandy.h b/src/VIDEO/vid_tandy.h similarity index 100% rename from src/vid_tandy.h rename to src/VIDEO/vid_tandy.h diff --git a/src/vid_tandysl.c b/src/VIDEO/vid_tandysl.c similarity index 99% rename from src/vid_tandysl.c rename to src/VIDEO/vid_tandysl.c index 0ad656aaf..0c4225525 100644 --- a/src/vid_tandysl.c +++ b/src/VIDEO/vid_tandysl.c @@ -3,14 +3,15 @@ */ #include #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_tandysl.h" + typedef struct tandysl_t { mem_mapping_t mapping; diff --git a/src/vid_tandysl.h b/src/VIDEO/vid_tandysl.h similarity index 100% rename from src/vid_tandysl.h rename to src/VIDEO/vid_tandysl.h diff --git a/src/vid_tgui9440.c b/src/VIDEO/vid_tgui9440.c similarity index 99% rename from src/vid_tgui9440.c rename to src/VIDEO/vid_tgui9440.c index 384f76a81..e365ed4ac 100644 --- a/src/vid_tgui9440.c +++ b/src/VIDEO/vid_tgui9440.c @@ -3,19 +3,20 @@ */ /*Trident TGUI9440 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../pci.h" +#include "../rom.h" +#include "../device.h" +#include "../thread.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" #include "vid_tkd8001_ramdac.h" #include "vid_tgui9440.h" + #define FIFO_SIZE 65536 #define FIFO_MASK (FIFO_SIZE - 1) #define FIFO_ENTRY_SIZE (1 << 31) diff --git a/src/vid_tgui9440.h b/src/VIDEO/vid_tgui9440.h similarity index 100% rename from src/vid_tgui9440.h rename to src/VIDEO/vid_tgui9440.h diff --git a/src/vid_tkd8001_ramdac.c b/src/VIDEO/vid_tkd8001_ramdac.c similarity index 97% rename from src/vid_tkd8001_ramdac.c rename to src/VIDEO/vid_tkd8001_ramdac.c index 3d22d987c..553bc489f 100644 --- a/src/vid_tkd8001_ramdac.c +++ b/src/VIDEO/vid_tkd8001_ramdac.c @@ -2,12 +2,13 @@ see COPYING for more details */ /*Trident TKD8001 RAMDAC emulation*/ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_tkd8001_ramdac.h" + void tkd8001_ramdac_out(uint16_t addr, uint8_t val, tkd8001_ramdac_t *ramdac, svga_t *svga) { switch (addr) diff --git a/src/vid_tkd8001_ramdac.h b/src/VIDEO/vid_tkd8001_ramdac.h similarity index 100% rename from src/vid_tkd8001_ramdac.h rename to src/VIDEO/vid_tkd8001_ramdac.h diff --git a/src/vid_tvga.c b/src/VIDEO/vid_tvga.c similarity index 99% rename from src/vid_tvga.c rename to src/VIDEO/vid_tvga.c index bbbf9d1ca..7c6c7f255 100644 --- a/src/vid_tvga.c +++ b/src/VIDEO/vid_tvga.c @@ -3,17 +3,18 @@ */ /*Trident TVGA (8900D) emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" #include "vid_tkd8001_ramdac.h" #include "vid_tvga.h" + typedef struct tvga_t { mem_mapping_t linear_mapping; diff --git a/src/vid_tvga.h b/src/VIDEO/vid_tvga.h similarity index 100% rename from src/vid_tvga.h rename to src/VIDEO/vid_tvga.h diff --git a/src/vid_unk_ramdac.c b/src/VIDEO/vid_unk_ramdac.c similarity index 98% rename from src/vid_unk_ramdac.c rename to src/VIDEO/vid_unk_ramdac.c index 0b6fc6aea..c2fb35bae 100644 --- a/src/vid_unk_ramdac.c +++ b/src/VIDEO/vid_unk_ramdac.c @@ -5,12 +5,13 @@ It is possibly a Sierra 1502x It's addressed by the TLIVESA1 driver for ET4000*/ /* Note by Tenshi: Not possibly, this *IS* a Sierra 1502x. */ -#include "ibm.h" -#include "mem.h" +#include "../ibm.h" +#include "../mem.h" #include "video.h" #include "vid_svga.h" #include "vid_unk_ramdac.h" + void unk_ramdac_out(uint16_t addr, uint8_t val, unk_ramdac_t *ramdac, svga_t *svga) { int oldbpp = 0; diff --git a/src/vid_unk_ramdac.h b/src/VIDEO/vid_unk_ramdac.h similarity index 100% rename from src/vid_unk_ramdac.h rename to src/VIDEO/vid_unk_ramdac.h diff --git a/src/vid_vga.c b/src/VIDEO/vid_vga.c similarity index 98% rename from src/vid_vga.c rename to src/VIDEO/vid_vga.c index a69b6f60c..e1570b3c4 100644 --- a/src/vid_vga.c +++ b/src/VIDEO/vid_vga.c @@ -3,15 +3,16 @@ */ /*IBM VGA emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "io.h" -#include "mem.h" -#include "rom.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_vga.h" + typedef struct vga_t { svga_t svga; diff --git a/src/vid_vga.h b/src/VIDEO/vid_vga.h similarity index 100% rename from src/vid_vga.h rename to src/VIDEO/vid_vga.h diff --git a/src/vid_voodoo.c b/src/VIDEO/vid_voodoo.c similarity index 99% rename from src/vid_voodoo.c rename to src/VIDEO/vid_voodoo.c index eef3df1e8..815d071a6 100644 --- a/src/vid_voodoo.c +++ b/src/VIDEO/vid_voodoo.c @@ -1,17 +1,19 @@ #include #include -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "pci.h" -#include "rom.h" -#include "thread.h" -#include "timer.h" +#include "../ibm.h" +#include "../cpu/cpu.h" +#include "../mem.h" +#include "../rom.h" +#include "../pci.h" +#include "../thread.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_svga.h" #include "vid_voodoo.h" #include "vid_voodoo_dither.h" + #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define CLAMP(x) (((x) < 0) ? 0 : (((x) > 0xff) ? 0xff : (x))) diff --git a/src/vid_voodoo.h b/src/VIDEO/vid_voodoo.h similarity index 100% rename from src/vid_voodoo.h rename to src/VIDEO/vid_voodoo.h diff --git a/src/vid_voodoo_codegen_x86-64.h b/src/VIDEO/vid_voodoo_codegen_x86-64.h similarity index 100% rename from src/vid_voodoo_codegen_x86-64.h rename to src/VIDEO/vid_voodoo_codegen_x86-64.h diff --git a/src/vid_voodoo_codegen_x86.h b/src/VIDEO/vid_voodoo_codegen_x86.h similarity index 100% rename from src/vid_voodoo_codegen_x86.h rename to src/VIDEO/vid_voodoo_codegen_x86.h diff --git a/src/vid_voodoo_dither.h b/src/VIDEO/vid_voodoo_dither.h similarity index 100% rename from src/vid_voodoo_dither.h rename to src/VIDEO/vid_voodoo_dither.h diff --git a/src/vid_wy700.c b/src/VIDEO/vid_wy700.c similarity index 99% rename from src/vid_wy700.c rename to src/VIDEO/vid_wy700.c index 4519a293e..a7b612e09 100644 --- a/src/vid_wy700.c +++ b/src/VIDEO/vid_wy700.c @@ -1,16 +1,18 @@ /* Wyse-700 emulation*/ #include -#include "ibm.h" -#include "device.h" -#include "mem.h" -#include "io.h" -#include "timer.h" +#include "../ibm.h" +#include "../io.h" +#include "../mem.h" +#include "../timer.h" +#include "../device.h" #include "video.h" #include "vid_wy700.h" + #define WY700_XSIZE 1280 #define WY700_YSIZE 800 + void updatewindowsize(int x, int y); diff --git a/src/vid_wy700.h b/src/VIDEO/vid_wy700.h similarity index 100% rename from src/vid_wy700.h rename to src/VIDEO/vid_wy700.h diff --git a/src/video.c b/src/VIDEO/video.c similarity index 97% rename from src/video.c rename to src/VIDEO/video.c index 798981c71..20352cdb5 100644 --- a/src/video.c +++ b/src/VIDEO/video.c @@ -5,21 +5,22 @@ #include #include #include -#include "ibm.h" -#include "config.h" -#include "device.h" -#include "mem.h" +#include "../ibm.h" +#include "../cpu/cpu.h" +#include "../io.h" +#include "../mem.h" +#include "../rom.h" +#include "../config.h" +#include "../device.h" +#include "../thread.h" +#include "../timer.h" #include "video.h" #include "vid_svga.h" -#include "io.h" -#include "cpu.h" -#include "rom.h" -#include "thread.h" -#include "timer.h" #ifndef __unix -#include "win-cgapal.h" +#include "../win-cgapal.h" #endif + #include "vid_ati18800.h" #include "vid_ati28800.h" #include "vid_ati_mach64.h" @@ -57,6 +58,7 @@ #include "vid_vga.h" #include "vid_wy700.h" + int cga_palette = 0; typedef struct @@ -686,20 +688,20 @@ void take_screenshot() #else time_t now; struct tm *info; -char screenshot_fn_partial[2048]; -char screenshot_fn[4096]; +wchar_t screenshot_fn_partial[2048]; +wchar_t screenshot_fn[4096]; void take_screenshot() { if ((vid_api < 0) || (vid_api > 1)) return; time(&now); info = localtime(&now); - memset(screenshot_fn, 0, 4096); - memset(screenshot_fn_partial, 0, 2048); + memset(screenshot_fn, 0, 8192); + memset(screenshot_fn_partial, 0, 4096); pclog("Video API is: %i\n", vid_api); if (vid_api == 1) { - strftime(screenshot_fn_partial, 2048, "screenshots\\%Y%m%d_%H%M%S.png", info); + wcsftime(screenshot_fn_partial, 2048, L"screenshots\\%Y%m%d_%H%M%S.png", info); append_filename(screenshot_fn, pcempath, screenshot_fn_partial, 4095); if (video_fullscreen) { diff --git a/src/video.h b/src/VIDEO/video.h similarity index 93% rename from src/video.h rename to src/VIDEO/video.h index 234bb81ad..83e50bc1d 100644 --- a/src/video.h +++ b/src/VIDEO/video.h @@ -103,10 +103,10 @@ extern "C" { #endif void take_screenshot(); -void d3d_take_screenshot(char *fn); -void d3d_fs_take_screenshot(char *fn); -void ddraw_take_screenshot(char *fn); -void ddraw_fs_take_screenshot(char *fn); +void d3d_take_screenshot(wchar_t *fn); +void d3d_fs_take_screenshot(wchar_t *fn); +void ddraw_take_screenshot(wchar_t *fn); +void ddraw_fs_take_screenshot(wchar_t *fn); #ifdef __cplusplus } #endif diff --git a/src/acer386sx.c b/src/acer386sx.c index ea3bfe74d..4f6ce5eed 100644 --- a/src/acer386sx.c +++ b/src/acer386sx.c @@ -2,14 +2,15 @@ see COPYING for more details */ #include "ibm.h" +#include "cpu/cpu.h" #include "io.h" -#include "cpu.h" - #include "acer386sx.h" + static int acer_index = 0; static uint8_t acer_regs[256]; + void acer386sx_write(uint16_t addr, uint8_t val, void *priv) { if (addr & 1) diff --git a/src/ali1429.c b/src/ali1429.c index f1fa8fa3f..e0c348829 100644 --- a/src/ali1429.c +++ b/src/ali1429.c @@ -3,9 +3,9 @@ */ #include #include "ibm.h" +#include "cpu/cpu.h" #include "io.h" #include "mem.h" -#include "cpu.h" #include "ali1429.h" diff --git a/src/buslogic.h b/src/buslogic.h deleted file mode 100644 index c4b6805f0..000000000 --- a/src/buslogic.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef BUSLOGIC_H -# define BUSLOGIC_H - - -typedef struct { - uint8_t flags; /* local flags */ - uint8_t bid; /* board ID */ - char fwl, fwh; /* firmware info */ -} aha_info; -#define AHA_GLAG_MEMEN 0x01 /* BIOS Shadow RAM enabled */ - - -extern device_t aha1540b_device; -extern device_t aha1542cf_device; -extern device_t buslogic_device; -extern device_t buslogic_pci_device; - - -extern int buslogic_dev_present(uint8_t id, uint8_t lun); - -extern void aha154x_init(uint16_t, uint32_t, aha_info *); -extern uint8_t aha154x_shram(uint8_t); -extern uint8_t aha154x_eeprom(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t *); -extern uint8_t aha154x_memory(uint8_t); - - -#endif /*BUSLOGIC_H*/ diff --git a/src/cdrom.c b/src/cdrom.c index 8cf6e3174..09f55ac4d 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -978,16 +978,16 @@ void cdrom_mode_sense_load(uint8_t id) switch(id) { case 0: - f = fopen(nvr_concat("cdrom_1_mode_sense.bin"), "rb"); + f = _wfopen(nvr_concat(L"cdrom_1_mode_sense.bin"), L"rb"); break; case 1: - f = fopen(nvr_concat("cdrom_2_mode_sense.bin"), "rb"); + f = _wfopen(nvr_concat(L"cdrom_2_mode_sense.bin"), L"rb"); break; case 2: - f = fopen(nvr_concat("cdrom_3_mode_sense.bin"), "rb"); + f = _wfopen(nvr_concat(L"cdrom_3_mode_sense.bin"), L"rb"); break; case 3: - f = fopen(nvr_concat("cdrom_4_mode_sense.bin"), "rb"); + f = _wfopen(nvr_concat(L"cdrom_4_mode_sense.bin"), L"rb"); break; default: return; @@ -1006,16 +1006,16 @@ void cdrom_mode_sense_save(uint8_t id) switch(id) { case 0: - f = fopen(nvr_concat("cdrom_1_mode_sense.bin"), "wb"); + f = _wfopen(nvr_concat(L"cdrom_1_mode_sense.bin"), L"wb"); break; case 1: - f = fopen(nvr_concat("cdrom_2_mode_sense.bin"), "wb"); + f = _wfopen(nvr_concat(L"cdrom_2_mode_sense.bin"), L"wb"); break; case 2: - f = fopen(nvr_concat("cdrom_3_mode_sense.bin"), "wb"); + f = _wfopen(nvr_concat(L"cdrom_3_mode_sense.bin"), L"wb"); break; case 3: - f = fopen(nvr_concat("cdrom_4_mode_sense.bin"), "wb"); + f = _wfopen(nvr_concat(L"cdrom_4_mode_sense.bin"), L"wb"); break; default: return; diff --git a/src/config.c b/src/config.c index 55b4fec72..c72de4da8 100644 --- a/src/config.c +++ b/src/config.c @@ -470,7 +470,7 @@ void config_save(wchar_t *fn) if (current_section->name[0]) { mbstowcs(wname, current_section->name, strlen(current_section->name) + 1); - _fwprintf_p(f, L"\n[%ws]\n", wname); + fwprintf(f, L"\n[%ws]\n", wname); } current_entry = (entry_t *)current_section->entry_head.next; @@ -480,11 +480,11 @@ void config_save(wchar_t *fn) mbstowcs(wname, current_entry->name, strlen(current_entry->name) + 1); if (current_entry->wdata[0] == L'\0') { - _fwprintf_p(f, L"%ws = \n", wname); + fwprintf(f, L"%ws = \n", wname); } else { - _fwprintf_p(f, L"%ws = %ws\n", wname, current_entry->wdata); + fwprintf(f, L"%ws = %ws\n", wname, current_entry->wdata); } current_entry = (entry_t *)current_entry->list.next; diff --git a/src/config.h b/src/config.h index b51585b52..feab20d60 100644 --- a/src/config.h +++ b/src/config.h @@ -19,7 +19,7 @@ wchar_t *get_extension_w(wchar_t *s); void config_load(wchar_t *fn); void config_save(wchar_t *fn); -void config_dump(); -void config_free(); +void config_dump(void); +void config_free(void); extern wchar_t config_file_default[256]; diff --git a/src/device.c b/src/device.c index 39a4c0c32..ec63744d5 100644 --- a/src/device.c +++ b/src/device.c @@ -1,9 +1,10 @@ #include "ibm.h" +#include "cpu/cpu.h" #include "config.h" -#include "cpu.h" #include "device.h" #include "model.h" -#include "sound.h" +#include "sound/sound.h" + static void *device_priv[256]; static device_t *devices[256]; diff --git a/src/dma.c b/src/dma.c index c1c039ffa..259401dee 100644 --- a/src/dma.c +++ b/src/dma.c @@ -1,16 +1,19 @@ +/* Copyright holders: Sarah Walker + see COPYING for more details +*/ #include "ibm.h" - -#include "dma.h" -#include "io.h" +#include "cpu/x86.h" #include "mem.h" -#include "video.h" -#include "x86.h" +#include "io.h" +#include "dma.h" + static uint8_t dmaregs[16]; static uint8_t dma16regs[16]; static uint8_t dmapages[16]; -void dma_reset() + +void dma_reset(void) { int c; dma.wp = 0; @@ -447,30 +450,30 @@ uint8_t dma_page_read(uint16_t addr, void *priv) return dmapages[addr & 0xf]; } -void dma_init() +void dma_init(void) { io_sethandler(0x0000, 0x0010, dma_read, NULL, NULL, dma_write, NULL, NULL, NULL); io_sethandler(0x0080, 0x0008, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); dma.is_ps2 = 0; } -void dma16_init() +void dma16_init(void) { io_sethandler(0x00C0, 0x0020, dma16_read, NULL, NULL, dma16_write, NULL, NULL, NULL); io_sethandler(0x0088, 0x0008, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); } -void dma_alias_set() +void dma_alias_set(void) { io_sethandler(0x0090, 0x0010, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); } -void dma_alias_remove() +void dma_alias_remove(void) { io_removehandler(0x0090, 0x0010, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); } -void dma_alias_remove_piix() +void dma_alias_remove_piix(void) { io_removehandler(0x0090, 0x0001, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); io_removehandler(0x0094, 0x0003, dma_page_read, NULL, NULL, dma_page_write, NULL, NULL, NULL); diff --git a/src/dma.h b/src/dma.h index 3cf611ea2..515f02f87 100644 --- a/src/dma.h +++ b/src/dma.h @@ -1,29 +1,29 @@ /* Copyright holders: Sarah Walker, SA1988 see COPYING for more details */ -void dma_init(); -void dma16_init(); -void ps2_dma_init(); -void dma_reset(); +void dma_init(void); +void dma16_init(void); +void ps2_dma_init(void); +void dma_reset(void); int dma_mode(int channel); #define DMA_NODATA -1 #define DMA_OVER 0x10000 #define DMA_VERIFY 0x20000 -void readdma0(); -int readdma1(); -uint8_t readdma2(); -int readdma3(); +void readdma0(void); +int readdma1(void); +uint8_t readdma2(void); +int readdma3(void); void writedma2(uint8_t temp); int dma_channel_read(int channel); int dma_channel_write(int channel, uint16_t val); -void dma_alias_set(); -void dma_alias_remove(); -void dma_alias_remove_piix(); +void dma_alias_set(void); +void dma_alias_remove(void); +void dma_alias_remove_piix(void); void DMAPageRead(uint32_t PhysAddress, char *DataRead, uint32_t TotalSize); -void DMAPageWrite(uint32_t PhysAddress, const char *DataWrite, uint32_t TotalSize); \ No newline at end of file +void DMAPageWrite(uint32_t PhysAddress, const char *DataWrite, uint32_t TotalSize); diff --git a/src/gameport.c b/src/gameport.c index 45e2cb8d8..b75e9f6ce 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -4,19 +4,21 @@ #include #include #include "ibm.h" +#include "cpu/cpu.h" #include "device.h" #include "io.h" -#include "plat-joystick.h" #include "timer.h" - +#include "plat-joystick.h" #include "gameport.h" #include "joystick_ch_flightstick_pro.h" #include "joystick_standard.h" #include "joystick_sw_pad.h" #include "joystick_tm_fcs.h" + int joystick_type; + joystick_if_t joystick_none = { "No joystick", diff --git a/src/headland.c b/src/headland.c index b100b85c8..62e6dd076 100644 --- a/src/headland.c +++ b/src/headland.c @@ -2,9 +2,9 @@ see COPYING for more details */ #include "ibm.h" +#include "cpu/cpu.h" #include "io.h" #include "mem.h" -#include "cpu.h" #include "headland.h" diff --git a/src/intel.c b/src/intel.c index 2eb47939b..01560852f 100644 --- a/src/intel.c +++ b/src/intel.c @@ -2,14 +2,14 @@ see COPYING for more details */ #include "ibm.h" -#include "cpu.h" +#include "cpu/cpu.h" #include "io.h" #include "mem.h" #include "pit.h" #include "timer.h" - #include "intel.h" + uint8_t batman_brdconfig(uint16_t port, void *p) { switch (port) diff --git a/src/intel_flash.c b/src/intel_flash.c index dae940086..1ccb225a9 100644 --- a/src/intel_flash.c +++ b/src/intel_flash.c @@ -159,61 +159,61 @@ void *intel_flash_init(uint8_t type) switch(romset) { case ROM_REVENGE: - wcscpy(flash_path, nvr_concat(L"revenge.bin")); + wcscpy(flash_path, L"revenge.bin"); break; case ROM_586MC1: - wcscpy(flash_path, nvr_concat(L"586mc1.bin")); + wcscpy(flash_path, L"586mc1.bin"); break; case ROM_PLATO: - wcscpy(flash_path, nvr_concat(L"plato.bin")); + wcscpy(flash_path, L"plato.bin"); break; case ROM_ENDEAVOR: - wcscpy(flash_path, nvr_concat(L"endeavor.bin")); + wcscpy(flash_path, L"endeavor.bin"); break; case ROM_MB500N: - wcscpy(flash_path, nvr_concat(L"mb500n.bin")); + wcscpy(flash_path, L"mb500n.bin"); break; case ROM_P54TP4XE: - wcscpy(flash_path, nvr_concat(L"p54tp4xe.bin")); + wcscpy(flash_path, L"p54tp4xe.bin"); break; case ROM_AP53: - wcscpy(flash_path, nvr_concat(L"ap53.bin")); + wcscpy(flash_path, L"ap53.bin"); break; case ROM_P55T2S: - wcscpy(flash_path, nvr_concat(L"p55t2s.bin")); + wcscpy(flash_path, L"p55t2s.bin"); break; case ROM_ACERM3A: - wcscpy(flash_path, nvr_concat(L"acerm3a.bin")); + wcscpy(flash_path, L"acerm3a.bin"); break; case ROM_ACERV35N: - wcscpy(flash_path, nvr_concat(L"acerv35n.bin")); + wcscpy(flash_path, L"acerv35n.bin"); break; case ROM_430VX: - wcscpy(flash_path, nvr_concat(L"430vx.bin")); + wcscpy(flash_path, L"430vx.bin"); break; case ROM_P55VA: - wcscpy(flash_path, nvr_concat(L"p55va.bin")); + wcscpy(flash_path, L"p55va.bin"); break; case ROM_P55T2P4: - wcscpy(flash_path, nvr_concat(L"p55t2p4.bin")); + wcscpy(flash_path, L"p55t2p4.bin"); break; case ROM_P55TVP4: - wcscpy(flash_path, nvr_concat(L"p55tvp4.bin")); + wcscpy(flash_path, L"p55tvp4.bin"); break; case ROM_440FX: - wcscpy(flash_path, nvr_concat(L"440fx.bin")); + wcscpy(flash_path, L"440fx.bin"); break; case ROM_THOR: - wcscpy(flash_path, nvr_concat(L"thor.bin")); + wcscpy(flash_path, L"thor.bin"); break; case ROM_MRTHOR: - wcscpy(flash_path, nvr_concat(L"mrthor.bin")); + wcscpy(flash_path, L"mrthor.bin"); break; case ROM_ZAPPA: - wcscpy(flash_path, nvr_concat(L"zappa.bin")); + wcscpy(flash_path, L"zappa.bin"); break; case ROM_S1668: - wcscpy(flash_path, nvr_concat(L"tpatx.bin")); + wcscpy(flash_path, L"tpatx.bin"); break; default: fatal("intel_flash_init on unsupported ROM set %i\n", romset); diff --git a/src/io.c b/src/io.c index da9e3318a..ca9259e75 100644 --- a/src/io.c +++ b/src/io.c @@ -2,10 +2,8 @@ see COPYING for more details */ #include "ibm.h" -#include "ide.h" #include "io.h" -#include "video.h" -#include "cpu.h" + uint8_t (*port_inb[0x10000][2])(uint16_t addr, void *priv); uint16_t (*port_inw[0x10000][2])(uint16_t addr, void *priv); @@ -17,6 +15,7 @@ void (*port_outl[0x10000][2])(uint16_t addr, uint32_t val, void *priv); void *port_priv[0x10000][2]; + void io_init() { int c; diff --git a/src/keyboard_amstrad.c b/src/keyboard_amstrad.c index 6ec66001f..3765b43ca 100644 --- a/src/keyboard_amstrad.c +++ b/src/keyboard_amstrad.c @@ -7,13 +7,13 @@ #include "mem.h" #include "pic.h" #include "pit.h" -#include "sound.h" -#include "sound_speaker.h" #include "timer.h" - +#include "sound/sound.h" +#include "sound/snd_speaker.h" #include "keyboard.h" #include "keyboard_amstrad.h" + #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 #define STAT_TTIMEOUT 0x20 diff --git a/src/keyboard_at.c b/src/keyboard_at.c index 4cf084829..4e6c7f7e9 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -2,21 +2,20 @@ see COPYING for more details */ #include - #include "ibm.h" -#include "disc.h" -#include "fdc.h" #include "io.h" #include "mem.h" #include "pic.h" #include "pit.h" -#include "sound.h" -#include "sound_speaker.h" #include "timer.h" - +#include "disc.h" +#include "fdc.h" +#include "sound/sound.h" +#include "sound/snd_speaker.h" #include "keyboard.h" #include "keyboard_at.h" + #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 #define STAT_TTIMEOUT 0x20 diff --git a/src/keyboard_olim24.c b/src/keyboard_olim24.c index 498640777..e031bafad 100644 --- a/src/keyboard_olim24.c +++ b/src/keyboard_olim24.c @@ -2,16 +2,16 @@ #include "ibm.h" #include "io.h" #include "mem.h" -#include "mouse.h" #include "pic.h" #include "pit.h" -#include "sound.h" -#include "sound_speaker.h" #include "timer.h" - +#include "mouse.h" +#include "sound/sound.h" +#include "sound/snd_speaker.h" #include "keyboard.h" #include "keyboard_olim24.h" + #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 #define STAT_TTIMEOUT 0x20 @@ -21,6 +21,7 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 + struct { int wantirq; diff --git a/src/keyboard_pcjr.c b/src/keyboard_pcjr.c index 38142dd14..a7005d77b 100644 --- a/src/keyboard_pcjr.c +++ b/src/keyboard_pcjr.c @@ -2,22 +2,21 @@ see COPYING for more details */ #include - #include "ibm.h" -#include "device.h" #include "io.h" #include "mem.h" #include "nmi.h" #include "pic.h" #include "pit.h" -#include "sound.h" -#include "sound_sn76489.h" -#include "sound_speaker.h" #include "timer.h" - +#include "device.h" +#include "sound/sound.h" +#include "sound/snd_speaker.h" +#include "sound/snd_sn76489.h" #include "keyboard.h" #include "keyboard_pcjr.h" + #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 #define STAT_TTIMEOUT 0x20 diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index 0541b2692..c4497f9b9 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -2,21 +2,20 @@ see COPYING for more details */ #include - #include "ibm.h" -#include "device.h" #include "io.h" #include "mem.h" #include "pic.h" #include "pit.h" -#include "sound.h" -#include "sound_speaker.h" -#include "tandy_eeprom.h" #include "timer.h" - +#include "device.h" +#include "tandy_eeprom.h" +#include "sound/sound.h" +#include "sound/snd_speaker.h" #include "keyboard.h" #include "keyboard_xt.h" + #define STAT_PARITY 0x80 #define STAT_RTIMEOUT 0x40 #define STAT_TTIMEOUT 0x20 @@ -26,6 +25,7 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 + struct { int blocked; diff --git a/src/mem.c b/src/mem.c index 59b94136e..2e087651f 100644 --- a/src/mem.c +++ b/src/mem.c @@ -7,20 +7,19 @@ - pc2386 video BIOS is underdumped (16k instead of 24k) - c386sx16 BIOS fails checksum */ - #include #include #include "ibm.h" - +#include "cpu/cpu.h" +#include "cpu/x86_ops.h" +#include "cpu/x86.h" #include "config.h" #include "io.h" #include "mem.h" -#include "video.h" -#include "x86.h" -#include "cpu.h" #include "rom.h" -#include "x86_ops.h" -#include "codegen.h" +#include "cpu/codegen.h" +#include "video/video.h" + page_t *pages; page_t **page_lookup; diff --git a/src/model.c b/src/model.c index f92f0ea92..6410737d9 100644 --- a/src/model.c +++ b/src/model.c @@ -3,16 +3,15 @@ */ #include #include - #include "ibm.h" -#include "cdrom.h" -#include "cpu.h" +#include "cpu/cpu.h" +#include "io.h" #include "mem.h" +#include "rom.h" #include "model.h" #include "mouse.h" #include "mouse_ps2.h" -#include "io.h" -#include "rom.h" +#include "cdrom.h" #include "acerm3a.h" #include "ali1429.h" @@ -64,14 +63,14 @@ #include "sis496.h" #include "sis85c471.h" #include "sio.h" -#include "sound_ps1.h" -#include "sound_pssj.h" -#include "sound_sn76489.h" +#include "sound/snd_ps1.h" +#include "sound/snd_pssj.h" +#include "sound/snd_sn76489.h" #include "tandy_eeprom.h" #include "tandy_rom.h" #include "um8669f.h" -#include "vid_pcjr.h" -#include "vid_tandy.h" +#include "video/vid_pcjr.h" +#include "video/vid_tandy.h" #include "w83877f.h" #include "wd76c10.h" #include "xtide.h" diff --git a/src/mouse.c b/src/mouse.c index 9fb10ccf2..3e11903dc 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1,40 +1,22 @@ #include "ibm.h" #include "mouse.h" #include "mouse_serial.h" -#ifdef INPORT_MOUSE -# include "mouse_inport.h" -#endif #include "mouse_ps2.h" #include "mouse_bus.h" #include "amstrad.h" #include "keyboard_olim24.h" -#ifndef INPORTMOUSE -static mouse_t mouse_notimp = { - "Microsoft InPort Mouse", - "msinport", - MOUSE_TYPE_INPORT, - NULL, NULL, NULL -}; -#endif - - static mouse_t *mouse_list[] = { &mouse_serial_microsoft, /* 0 Microsoft Serial Mouse */ -#ifdef INPORTMOUSE - &mouse_inport, /* 1 Microsoft InPort Bus Mouse */ -#else - &mouse_notimp, /* 1 (not implemented) */ -#endif - &mouse_ps2_2_button, /* 2 PS/2 Mouse 2-button */ + &mouse_ps2_2_button, /* 1 PS/2 Mouse 2-button */ + &mouse_intellimouse, /* 2 PS/2 Intellimouse 3-button */ &mouse_bus, /* 3 Logitech Bus Mouse 2-button */ - &mouse_intellimouse, /* 4 PS/2 Intellimouse 3-button */ - &mouse_amstrad, /* 5 Amstrad PC System Mouse */ - &mouse_olim24, /* 6 Olivetti M24 System Mouse */ + &mouse_amstrad, /* 4 Amstrad PC System Mouse */ + &mouse_olim24, /* 5 Olivetti M24 System Mouse */ #if 0 - &mouse_msystems, /* 7 Mouse Systems */ - &mouse_genius, /* 8 Genius Bus Mouse */ + &mouse_msystems, /* 6 Mouse Systems */ + &mouse_genius, /* 7 Genius Bus Mouse */ #endif NULL }; @@ -44,14 +26,16 @@ static void *mouse_p; int mouse_type = 0; -void mouse_emu_init(void) +void +mouse_emu_init(void) { cur_mouse = mouse_list[mouse_type]; mouse_p = cur_mouse->init(); } -void mouse_emu_close(void) +void +mouse_emu_close(void) { if (cur_mouse) cur_mouse->close(mouse_p); @@ -59,14 +43,16 @@ void mouse_emu_close(void) } -void mouse_poll(int x, int y, int z, int b) +void +mouse_poll(int x, int y, int z, int b) { if (cur_mouse) cur_mouse->poll(x, y, z, b, mouse_p); } -char *mouse_get_name(int mouse) +char * +mouse_get_name(int mouse) { if (!mouse_list[mouse]) return(NULL); @@ -74,18 +60,19 @@ char *mouse_get_name(int mouse) } -char *mouse_get_internal_name(int mouse) +char * +mouse_get_internal_name(int mouse) { return(mouse_list[mouse]->internal_name); } -int mouse_get_from_internal_name(char *s) +int +mouse_get_from_internal_name(char *s) { int c = 0; - while (mouse_list[c] != NULL) - { + while (mouse_list[c] != NULL) { if (!strcmp(mouse_list[c]->internal_name, s)) return(c); c++; @@ -95,14 +82,16 @@ int mouse_get_from_internal_name(char *s) } -int mouse_get_type(int mouse) +int +mouse_get_type(int mouse) { return(mouse_list[mouse]->type); } /* Return number of MOUSE types we know about. */ -int mouse_get_ndev(void) +int +mouse_get_ndev(void) { return(sizeof(mouse_list)/sizeof(mouse_t *) - 1); } diff --git a/src/mouse.h b/src/mouse.h index 701d5de9a..4ae2d8d76 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -3,14 +3,13 @@ #define MOUSE_TYPE_SERIAL 0 /* Serial Mouse */ -#define MOUSE_TYPE_INPORT 1 /* Microsoft InPort Bus Mouse */ -#define MOUSE_TYPE_PS2 2 /* IBM PS/2 series Bus Mouse */ +#define MOUSE_TYPE_PS2 1 /* IBM PS/2 series Bus Mouse */ +#define MOUSE_TYPE_PS2_MS 2 /* Microsoft Intellimouse PS/2 */ #define MOUSE_TYPE_BUS 3 /* Logitech/ATI Bus Mouse */ -#define MOUSE_TYPE_PS2_MS 4 -#define MOUSE_TYPE_AMSTRAD 5 /* Amstrad PC system mouse */ -#define MOUSE_TYPE_OLIM24 6 /* Olivetti M24 system mouse */ -#define MOUSE_TYPE_MSYSTEMS 7 /* Mouse Systems mouse */ -#define MOUSE_TYPE_GENIUS 8 /* Genius Bus Mouse */ +#define MOUSE_TYPE_AMSTRAD 4 /* Amstrad PC system mouse */ +#define MOUSE_TYPE_OLIM24 5 /* Olivetti M24 system mouse */ +#define MOUSE_TYPE_MSYSTEMS 6 /* Mouse Systems mouse */ +#define MOUSE_TYPE_GENIUS 7 /* Genius Bus Mouse */ #define MOUSE_TYPE_MASK 0x0f #define MOUSE_TYPE_3BUTTON (1<<7) /* device has 3+ buttons */ diff --git a/src/mouse_bus.c b/src/mouse_bus.c index 19ddb98cb..9112e2c3e 100644 --- a/src/mouse_bus.c +++ b/src/mouse_bus.c @@ -8,16 +8,19 @@ * * Implementation of Bus Mouse devices. * - * These mice devices were made by both Microsoft (InPort) and - * Logitech. Sadly, they did not use the same I/O protocol, but - * they were close enough to fit into a single implementation. + * These devices were made by both Microsoft and Logitech. At + * first, Microsoft used the same protocol as Logitech, but did + * switch to their new protocol for their InPort interface. So, + * although alike enough to be handled in the same driver, they + * are not the same. * - * Although the Minix driver blindly took IRQ5, the board seems - * to be able to tell the driver what IRQ it is set for. When - * testing on MS-DOS (6.22), the 'mouse.exe' driver did not want - * to start, and only after disassembling it and inspecting the - * code it was discovered that driver actually does use the IRQ - * reporting feature. In a really, really weird way, too: it + * This code is based on my Minix driver for the Logitech(-mode) + * interface. Although that driver blindly took IRQ5, the board + * seems to be able to tell the driver what IRQ it is set for. + * When testing on MS-DOS (6.22), the 'mouse.exe' driver did not + * want to start, and only after disassembling it and inspecting + * the code it was discovered that driver actually does use the + * IRQ reporting feature. In a really, really weird way, too: it * sets up the board, and then reads the CTRL register which is * supposed to return that IRQ value. Depending on whether or * not the FREEZE bit is set, it has to return either the two's @@ -29,10 +32,7 @@ * Based on an early driver for MINIX 1.5. * Based on the 86Box PS/2 mouse driver as a framework. * - * NOTE: Still have to add the code for the MS InPort mouse, which - * is very similar. Almost done, but not ready for release. - * - * Version: @(#)mouse_bus.c 1.0.3 2017/04/22 + * Version: @(#)mouse_bus.c 1.0.4 2017/05/01 * * Author: Fred N. van Kempen, * Copyright 1989-2017 Fred N. van Kempen. @@ -50,13 +50,11 @@ #define ENABLE_3BTN 1 /* enable 3-button mode */ -/* Register definitions (based on Logitech info.) */ +/* Register definitions for Logitech mode. */ #define LTMOUSE_DATA 0 /* DATA register */ #define LTMOUSE_MAGIC 1 /* signature magic register */ # define MAGIC_BYTE1 0xa5 /* most drivers use this */ # define MAGIC_BYTE2 0x5a /* some drivers use this */ -# define MAGIC_MSBYTE1 0xde /* indicates MS InPort */ -# define MAGIC_MSBYTE2 0xad #define LTMOUSE_CTRL 2 /* CTRL register */ # define CTRL_FREEZE 0x80 /* do not sample when set */ # define CTRL_RD_Y_HI 0x60 /* plus FREEZE */ @@ -64,15 +62,25 @@ # define CTRL_RD_X_HI 0x20 /* plus FREEZE */ # define CTRL_RD_X_LO 0x00 /* plus FREEZE */ # define CTRL_RD_MASK 0x60 -# define CTRL_IDISABLE 0x10 -# define CTRL_IENABLE 0x00 -# define CTRL_DFLT (CTRL_IDISABLE) +# define CTRL_IDIS 0x10 +# define CTRL_IENB 0x00 +# define CTRL_DFLT (CTRL_IDIS) #define LTMOUSE_CONFIG 3 /* CONFIG register */ # define CONFIG_DFLT 0x91 /* 8255 controller config */ +/* Register definitions for Microsoft mode. */ #define MSMOUSE_CTRL 0 /* CTRL register */ +# define MSCTRL_RESET 0x80 +# define MSCTRL_MODE 0x07 +# define MSCTRL_RD_Y 0x02 +# define MSCTRL_RD_X 0x01 +# define MSCTRL_RD_BUT 0x00 #define MSMOUSE_DATA 1 /* DATA register */ +# define MSDATA_BASE 0x10 +# define MSDATA_IRQ 0x01 #define MSMOUSE_MAGIC 2 /* MAGIC register */ +# define MAGIC_MSBYTE1 0xde /* indicates MS InPort */ +# define MAGIC_MSBYTE2 0xad #define MSMOUSE_CONFIG 3 /* CONFIG register */ @@ -92,47 +100,62 @@ typedef struct { uint8_t but; } mouse_bus_t; #define MOUSE_ENABLED 0x80 /* device is enabled for use */ -#define MOUSE_LOGITECH 0x40 /* running as Logitech mode */ -#define MOUSE_CMDFLAG 0x01 /* next wr is a command (MS) */ +#define MOUSE_LOGITECH 0x40 /* running in Logitech mode */ +#define MOUSE_MICROSOFT 0x20 /* running in Microsoft mode */ -/* Handle a write to the control register. */ +/* Handle a WRITE to a Microsoft-mode register. */ static void -wctrl(mouse_bus_t *ms, uint8_t val) +ms_write(mouse_bus_t *ms, uint16_t port, uint8_t val) { - uint8_t b = (ms->r_ctrl ^ val); +#if 1 + pclog("BUSMOUSE: ms_write(%d,%02x)\n", port, val); +#endif - if (b & CTRL_FREEZE) { - /* Hold the sampling while we do something. */ - if (! (val & CTRL_FREEZE)) { - /* Reset current state. */ - ms->x = ms->y = 0; - if (ms->but) /* allow one more POLL for button-release */ - ms->but = 0x80; - } + switch (port) { + case MSMOUSE_CTRL: /* [00] control register */ + if (val & MSCTRL_RESET) { + /* Reset the interface. */ + ms->r_magic = MAGIC_MSBYTE1; + ms->r_conf = 0x00; + } + + /* Save new register value. */ + ms->r_ctrl = val; + break; + + case MSMOUSE_DATA: /* [01] data register */ + if (ms->r_ctrl == MSCTRL_MODE) { + ms->r_conf = val; + } + break; + + case MSMOUSE_MAGIC: /* [02] magic data register */ + break; + + case MSMOUSE_CONFIG: /* [03] config register */ + ms->r_conf = val; + ms->flags &= ~MOUSE_MICROSOFT; + ms->flags |= MOUSE_LOGITECH; + break; + + default: + break; } - - if (b & CTRL_IDISABLE) { - /* Disable or enable interrupts. */ - /* (we don't do anything for that here..) */ - } - - /* Save new register value. */ - ms->r_ctrl = val; } -/* Handle a WRITE operation to one of our registers. */ +/* Handle a WRITE to a LOGITECH-mode register. */ static void -busmouse_write(uint16_t port, uint8_t val, void *priv) +lt_write(mouse_bus_t *ms, uint16_t port, uint8_t val) { - mouse_bus_t *ms = (mouse_bus_t *)priv; + uint8_t b = (ms->r_ctrl ^ val); -#if 0 - pclog("BUSMOUSE: write(%d,%02x)\n", port-ms->port, val); +#if 1 + pclog("BUSMOUSE: lt_write(%d,%02x)\n", port, val); #endif - switch (port-ms->port) { + switch (port) { case LTMOUSE_DATA: /* [00] data register */ break; @@ -144,7 +167,24 @@ busmouse_write(uint16_t port, uint8_t val, void *priv) break; case LTMOUSE_CTRL: /* [02] control register */ - wctrl(ms, val); + if (b & CTRL_FREEZE) { + /* Hold the sampling while we do something. */ + if (! (val & CTRL_FREEZE)) { + /* Reset current state. */ + ms->x = ms->y = 0; + if (ms->but) + /* One more POLL for button-release. */ + ms->but = 0x80; + } + } + + if (b & CTRL_IDIS) { + /* Disable or enable interrupts. */ + /* (we don't do anything for that here..) */ + } + + /* Save new register value. */ + ms->r_ctrl = val; break; case LTMOUSE_CONFIG: /* [03] config register */ @@ -157,6 +197,20 @@ busmouse_write(uint16_t port, uint8_t val, void *priv) } +/* Handle a WRITE operation to one of our registers. */ +static void +bm_write(uint16_t port, uint8_t val, void *priv) +{ + mouse_bus_t *ms = (mouse_bus_t *)priv; + + if (ms->flags & MOUSE_LOGITECH) + lt_write(ms, port - ms->port, val); + + if (ms->flags & MOUSE_MICROSOFT) + ms_write(ms, port - ms->port, val); +} + + /* Handle a READ from a Microsoft-mode register. */ static uint8_t ms_read(mouse_bus_t *ms, uint16_t port) @@ -194,8 +248,8 @@ ms_read(mouse_bus_t *ms, uint16_t port) break; } -#if 0 - pclog("BUSMOUSE: msread(%d): %02x\n", port, r); +#if 1 + pclog("BUSMOUSE: ms_read(%d): %02x\n", port, r); #endif return(r); @@ -285,7 +339,7 @@ lt_read(mouse_bus_t *ms, uint16_t port) * first value is assumed to be the 2's complement of the * actual IRQ value. * Next, it does this a second time, but now with the - * IDISABLE bit clear (so, interrupts enabled), which is + * IDIS bit clear (so, interrupts enabled), which is * our cue to return the regular (not complemented) value * to them. * @@ -297,10 +351,10 @@ lt_read(mouse_bus_t *ms, uint16_t port) */ if (ms->r_intr++ < 250) /* Still settling, return invalid data. */ - r = (ms->r_ctrl&CTRL_IDISABLE)?0xff:0x00; + r = (ms->r_ctrl&CTRL_IDIS)?0xff:0x00; else { /* OK, all good, return correct data. */ - r = (ms->r_ctrl&CTRL_IDISABLE)?-ms->irq:ms->irq; + r = (ms->r_ctrl&CTRL_IDIS)?-ms->irq:ms->irq; ms->r_intr = 0; } break; @@ -313,8 +367,8 @@ lt_read(mouse_bus_t *ms, uint16_t port) break; } -#if 0 - pclog("BUSMOUSE: ltread(%d): %02x\n", port, r); +#if 1 + pclog("BUSMOUSE: lt_read(%d): %02x\n", port, r); #endif return(r); @@ -323,14 +377,15 @@ lt_read(mouse_bus_t *ms, uint16_t port) /* Handle a READ operation from one of our registers. */ static uint8_t -busmouse_read(uint16_t port, void *priv) +bm_read(uint16_t port, void *priv) { mouse_bus_t *ms = (mouse_bus_t *)priv; uint8_t r; if (ms->flags & MOUSE_LOGITECH) r = lt_read(ms, port - ms->port); - else + + if (ms->flags & MOUSE_MICROSOFT) r = ms_read(ms, port - ms->port); return(r); @@ -339,14 +394,10 @@ busmouse_read(uint16_t port, void *priv) /* The emulator calls us with an update on the host mouse device. */ static uint8_t -busmouse_poll(int x, int y, int z, int b, void *priv) +bm_poll(int x, int y, int z, int b, void *priv) { mouse_bus_t *ms = (mouse_bus_t *)priv; -#if 0 - pclog("BUSMOUSE: poll(%d,%d,%d, %02x)\n", x, y, z, b); -#endif - /* Return early if nothing to do. */ if (!x && !y && !z && (ms->but == b)) return(1); @@ -354,6 +405,10 @@ busmouse_poll(int x, int y, int z, int b, void *priv) if (!(ms->flags & MOUSE_ENABLED) || (ms->r_ctrl & CTRL_FREEZE)) return(0); +#if 0 + pclog("BUSMOUSE: poll(%d,%d,%d, %02x)\n", x, y, z, b); +#endif + /* Add the delta to our state. */ x += ms->x; if (x > 127) @@ -372,7 +427,7 @@ busmouse_poll(int x, int y, int z, int b, void *priv) ms->but = b; /* All set, generate an interrupt. */ - if (! (ms->r_ctrl & CTRL_IDISABLE)) + if (! (ms->r_ctrl & CTRL_IDIS)) picint(1 << ms->irq); return(0); @@ -381,14 +436,13 @@ busmouse_poll(int x, int y, int z, int b, void *priv) /* Release all resources held by the device. */ static void -busmouse_close(void *priv) +bm_close(void *priv) { mouse_bus_t *ms = (mouse_bus_t *)priv; /* Release our I/O range. */ io_removehandler(ms->port, ms->portlen, - busmouse_read, NULL, NULL, busmouse_write, NULL, NULL, - ms); + bm_read, NULL, NULL, bm_write, NULL, NULL, ms); free(ms); } @@ -396,7 +450,7 @@ busmouse_close(void *priv) /* Initialize the device for use by the user. */ static void * -busmouse_init(void) +bm_init(void) { mouse_bus_t *ms; @@ -417,17 +471,12 @@ busmouse_init(void) ms->r_conf = CONFIG_DFLT; ms->r_ctrl = CTRL_DFLT; - /* - * Technically this is not possible, but we fake that we - * did a power-up initialization with default config as - * set in the "conf" register. Emulators rock! --FvK - */ - ms->flags = MOUSE_ENABLED; + /* Initialize with Microsoft-mode being default. */ + ms->flags = (MOUSE_ENABLED | MOUSE_MICROSOFT); /* Request an I/O range. */ io_sethandler(ms->port, ms->portlen, - busmouse_read, NULL, NULL, busmouse_write, NULL, NULL, - ms); + bm_read, NULL, NULL, bm_write, NULL, NULL, ms); /* Return our private data to the I/O layer. */ return(ms); @@ -438,7 +487,7 @@ mouse_t mouse_bus = { "Bus Mouse", "msbus", MOUSE_TYPE_BUS, - busmouse_init, - busmouse_close, - busmouse_poll + bm_init, + bm_close, + bm_poll }; diff --git a/src/mouse_serial.c b/src/mouse_serial.c index 84e85a673..46ebbbb1e 100644 --- a/src/mouse_serial.c +++ b/src/mouse_serial.c @@ -85,9 +85,13 @@ sermouse_init(void) memset(ms, 0x00, sizeof(mouse_serial_t)); /* Attach a serial port to the mouse. */ - ms->serial = &serial1; - serial1.rcr_callback = sermouse_rcr; - serial1.rcr_callback_p = ms; +#if 1 + ms->serial = serial_attach(0, sermouse_rcr, ms); +#else + ms->serial = &serial1; + serial1.rcr_callback = sermouse_rcr; + serial1.rcr_callback_p = ms; +#endif timer_add(sermouse_timer, &ms->delay, &ms->delay, ms); @@ -101,7 +105,11 @@ sermouse_close(void *priv) mouse_serial_t *ms = (mouse_serial_t *)priv; /* Detach serial port from the mouse. */ +#if 1 + serial_attach(0, NULL, NULL); +#else serial1.rcr_callback = NULL; +#endif free(ms); } diff --git a/src/ne2000.h b/src/ne2000.h deleted file mode 100644 index 218685e88..000000000 --- a/src/ne2000.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright holders: SA1988 - see COPYING for more details -*/ -void ne2000_generate_maclocal(int mac); -void ne2000_generate_maclocal_pci(int mac); -int net2000_get_maclocal(); -int net2000_get_maclocal_pci(); - -extern device_t ne2000_device; -extern device_t rtl8029as_device; diff --git a/src/ne2000.c b/src/net_ne2000.c similarity index 99% rename from src/ne2000.c rename to src/net_ne2000.c index a88f8ee45..30a1553bd 100644 --- a/src/ne2000.c +++ b/src/net_ne2000.c @@ -21,27 +21,22 @@ #include #include #include - +#include #include "slirp/slirp.h" #include "slirp/queue.h" -#include - #include "ibm.h" -#include "device.h" -#include "disc_random.h" - -#include "config.h" -#include "nethandler.h" - #include "io.h" #include "mem.h" -#include "nethandler.h" #include "rom.h" - -#include "ne2000.h" #include "pci.h" #include "pic.h" #include "timer.h" +#include "device.h" +#include "config.h" +#include "disc_random.h" +#include "network.h" +#include "net_ne2000.h" + /* THIS IS THE DEFAULT MAC ADDRESS .... so it wont place nice with multiple VMs. YET. */ uint8_t maclocal[6] = {0xac, 0xde, 0x48, 0x88, 0xbb, 0xaa}; @@ -229,6 +224,7 @@ void ne2000_rx_frame(void *p, const void *buf, int io_len); int ne2000_do_log = 0; + void ne2000_log(const char *format, ...) { #ifdef ENABLE_NE2000_LOG @@ -243,7 +239,7 @@ void ne2000_log(const char *format, ...) #endif } -static uint8_t *ne2000_mac() +static uint8_t *ne2000_mac(void) { if (network_card_current == 2) { @@ -255,7 +251,7 @@ static uint8_t *ne2000_mac() } } -void ne2000_generate_maclocal(int mac) +void ne2000_generate_maclocal(uint32_t mac) { maclocal[0] = 0x00; /* 00:00:D8 (NE2000 ISA vendor prefix). */ maclocal[1] = 0x00; @@ -276,7 +272,7 @@ void ne2000_generate_maclocal(int mac) } } -void ne2000_generate_maclocal_pci(int mac) +void ne2000_generate_maclocal_pci(uint32_t mac) { maclocal_pci[0] = 0x00; /* 00:20:18 (RTL 8029AS PCI vendor prefix). */ maclocal_pci[1] = 0x20; @@ -297,18 +293,18 @@ void ne2000_generate_maclocal_pci(int mac) } } -int net2000_get_maclocal() +uint32_t net2000_get_maclocal() { - int temp; + uint32_t temp; temp = (((int) maclocal[3]) << 16); temp |= (((int) maclocal[4]) << 8); temp |= ((int) maclocal[5]); return temp; } -int net2000_get_maclocal_pci() +uint32_t net2000_get_maclocal_pci() { - int temp; + uint32_t temp; temp = (((int) maclocal_pci[3]) << 16); temp |= (((int) maclocal_pci[4]) << 8); temp |= ((int) maclocal_pci[5]); @@ -1957,7 +1953,7 @@ void ne2000_pci_write(int func, int addr, uint8_t val, void *p) void ne2000_rom_init(ne2000_t *ne2000, wchar_t *s) { - FILE *f = romfopen(s, "rb"); + FILE *f = romfopen(s, L"rb"); uint32_t temp; if(!f) { @@ -1989,7 +1985,8 @@ void ne2000_rom_init(ne2000_t *ne2000, wchar_t *s) static char errbuf[32768]; -void *ne2000_init() + +void *ne2000_init(void) { int rc; int config_net_type; @@ -2093,7 +2090,7 @@ void *ne2000_init() } ne2000_reset(ne2000, BX_RESET_HARDWARE); - vlan_handler(ne2000_poller, ne2000); + network_add_handler(ne2000_poller, ne2000); ne2000_log("ne2000 %s init 0x%X %d\tnet_is_pcap is %d\n",is_rtl8029as ? "pci" : "isa",ne2000->base_address,device_get_config_int("irq"),net_is_pcap); diff --git a/src/net_ne2000.h b/src/net_ne2000.h new file mode 100644 index 000000000..550219dac --- /dev/null +++ b/src/net_ne2000.h @@ -0,0 +1,19 @@ +/* Copyright holders: SA1988 + see COPYING for more details +*/ +#ifndef NET_NE2000_H +# define NET_NE2000_H + + +extern device_t ne2000_device; +extern device_t rtl8029as_device; + + +extern void ne2000_generate_maclocal(uint32_t mac); +extern uint32_t net2000_get_maclocal(void); + +extern void ne2000_generate_maclocal_pci(uint32_t mac); +extern uint32_t net2000_get_maclocal_pci(void); + + +#endif /*NET_NE2000_H*/ diff --git a/src/nethandler.c b/src/nethandler.c deleted file mode 100644 index ddf1677af..000000000 --- a/src/nethandler.c +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#include -#include -#include -#include "nethandler.h" - -#include "ibm.h" -#include "device.h" - -#include "ne2000.h" -#include "timer.h" -#include "thread.h" - -int network_card_current = 0; -static int network_card_last = 0; - -typedef struct -{ - char name[64]; - char internal_name[32]; - device_t *device; -} NETWORK_CARD; - -static NETWORK_CARD network_cards[] = -{ - {"None", "none", NULL}, - {"Novell NE2000", "ne2k", &ne2000_device}, - {"Realtek RTL8029AS", "ne2kpci", &rtl8029as_device}, - {"", "", NULL} -}; - -int network_card_available(int card) -{ - if (network_cards[card].device) - return device_available(network_cards[card].device); - - return 1; -} - -char *network_card_getname(int card) -{ - return network_cards[card].name; -} - -device_t *network_card_getdevice(int card) -{ - return network_cards[card].device; -} - -int network_card_has_config(int card) -{ - if (!network_cards[card].device) - return 0; - return network_cards[card].device->config ? 1 : 0; -} - -char *network_card_get_internal_name(int card) -{ - return network_cards[card].internal_name; -} - -int network_card_get_from_internal_name(char *s) -{ - int c = 0; - - while (strlen(network_cards[c].internal_name)) - { - if (!strcmp(network_cards[c].internal_name, s)) - return c; - c++; - } - - return 0; -} - -void network_card_init() -{ - if (network_cards[network_card_current].device) - device_add(network_cards[network_card_current].device); - network_card_last = network_card_current; - - if (network_card_current != 0) - { - vlan_reset(); /* NETWORK */ - } -} - -static struct -{ - void (*poller)(void *p); - void *priv; -} vlan_handlers[8]; - -static int vlan_handlers_num; - -static int vlan_poller_time = 0; - -void vlan_handler(void (*poller)(void *p), void *p) -{ - vlan_handlers[vlan_handlers_num].poller = poller; - vlan_handlers[vlan_handlers_num].priv = p; - vlan_handlers_num++; -} - -static void network_thread(void *param) -{ - int c; - - for (c = 0; c < vlan_handlers_num; c++) - { - vlan_handlers[c].poller(vlan_handlers[c].priv); - } -} - -void vlan_poller(void *priv) -{ - vlan_poller_time += (int)((double)TIMER_USEC * (1000000.0 / 8.0 / 3000.0)); - - if (vlan_handlers_num) - { - network_thread(priv); - } -} - -void vlan_reset() -{ - pclog("vlan_reset()\n"); - - if (network_card_current) - { - pclog("Adding timer...\n"); - - timer_add(vlan_poller, &vlan_poller_time, TIMER_ALWAYS_ENABLED, NULL); - } - - vlan_handlers_num = 0; -} diff --git a/src/nethandler.h b/src/nethandler.h deleted file mode 100644 index 623dec93b..000000000 --- a/src/nethandler.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#include - -void vlan_handler(void (*poller)(void *p), void *p); - -extern int network_card_current; - -int network_card_available(int card); -char *network_card_getname(int card); -struct device_t *network_card_getdevice(int card); -int network_card_has_config(int card); -char *network_card_get_internal_name(int card); -int network_card_get_from_internal_name(char *s); -void network_card_init(); -void vlan_reset(); - -void initpcap(); -void closepcap(); diff --git a/src/network.c b/src/network.c new file mode 100644 index 000000000..5f4a3f95e --- /dev/null +++ b/src/network.c @@ -0,0 +1,154 @@ +/* Copyright holders: Sarah Walker, Tenshi + see COPYING for more details +*/ +#include +#include +#include +#include +#include "ibm.h" +#include "device.h" +#include "network.h" +#include "timer.h" +#include "thread.h" + +#include "net_ne2000.h" + + +typedef struct { + char name[64]; + char internal_name[32]; + device_t *device; +} NETCARD; + +typedef struct { + void (*poller)(void *p); + void *priv; +} NETPOLL; + + +static int net_handlers_num; +static int net_card_last = 0; +static uint32_t net_poll_time = 0; +static NETPOLL net_handlers[8]; +static NETCARD net_cards[] = { + { "None", "none", NULL }, + { "Novell NE2000", "ne2k", &ne2000_device }, + { "Realtek RTL8029AS", "ne2kpci", &rtl8029as_device }, + { "", "", NULL } +}; + +int network_card_current = 0; + + +static void +net_poll(void *priv) +{ + int c; + + /* Reset the poll timer. */ + net_poll_time += (uint32_t)((double)TIMER_USEC * (1000000.0/8.0/3000.0)); + + /* If we have active cards.. */ + if (net_handlers_num) { + /* .. poll each of them. */ + for (c=0; cconfig ? 1 : 0); +} + + +char * +network_card_get_internal_name(int card) +{ + return(net_cards[card].internal_name); +} + + +int +network_card_get_from_internal_name(char *s) +{ + int c = 0; + + while (strlen(net_cards[c].internal_name)) { + if (! strcmp(net_cards[c].internal_name, s)) + return(c); + c++; + } + + return(0); +} diff --git a/src/network.h b/src/network.h new file mode 100644 index 000000000..59c379a64 --- /dev/null +++ b/src/network.h @@ -0,0 +1,31 @@ +/* Copyright holders: Sarah Walker, Tenshi + see COPYING for more details +*/ +#ifndef NETWORK_H +# define NETWORK_H +# include + + +#define NE2000 1 +#define RTL8029AS 2 + + +extern int network_card_current; + + +extern void network_init(void); +extern void network_reset(void); +extern void network_add_handler(void (*poller)(void *p), void *p); + +extern int network_card_available(int card); +extern char *network_card_getname(int card); +extern int network_card_has_config(int card); +extern char *network_card_get_internal_name(int card); +extern int network_card_get_from_internal_name(char *s); +extern struct device_t *network_card_getdevice(int card); + +extern void initpcap(void); +extern void closepcap(void); + + +#endif /*NETWORK_H*/ diff --git a/src/opti495.c b/src/opti495.c index 2567782bd..9bf55d854 100644 --- a/src/opti495.c +++ b/src/opti495.c @@ -1,7 +1,7 @@ /*OPTi 82C495 emulation This is the chipset used in the AMI386 model*/ #include "ibm.h" -#include "cpu.h" +#include "cpu/cpu.h" #include "io.h" #include "mem.h" diff --git a/src/pc.c b/src/pc.c index abfb59c38..b4bf2b942 100644 --- a/src/pc.c +++ b/src/pc.c @@ -4,11 +4,62 @@ #include #include #include - #include "86box.h" #include "ibm.h" +#include "mem.h" +#include "cpu/cpu.h" +#include "cpu/x86_ops.h" +#include "cpu/codegen.h" +#include "dma.h" +#include "nvr.h" +#include "pic.h" +#include "pit.h" +#include "timer.h" #include "device.h" +#include "ali1429.h" +#include "cdrom.h" +#include "cdrom-ioctl.h" +#include "disc.h" +#include "disc_86f.h" +#include "disc_fdi.h" +#include "disc_imd.h" +#include "disc_img.h" +#include "disc_td0.h" +#include "disc_random.h" +#include "config.h" +#include "fdc.h" +#include "fdd.h" +#include "gameport.h" +#include "plat-joystick.h" +#include "plat-midi.h" +#include "hdd.h" +#include "ide.h" +#include "cdrom.h" +#include "cdrom-iso.h" +#include "cdrom-null.h" +#include "scsi.h" +#include "keyboard.h" +#include "plat-keyboard.h" +#include "keyboard_at.h" +#include "model.h" +#include "mouse.h" +#include "plat-mouse.h" +#include "network.h" +#include "net_ne2000.h" +#include "serial.h" +#include "sound/sound.h" +#include "sound/snd_cms.h" +#include "sound/snd_dbopl.h" +#include "sound/snd_opl.h" +#include "sound/snd_gus.h" +#include "sound/snd_sb.h" +#include "sound/snd_speaker.h" +#include "sound/snd_ssi2001.h" +#include "video/video.h" +#include "video/vid_voodoo.h" +#include "amstrad.h" + #ifndef __unix #define UNICODE #define BITMAP WINDOWS_BITMAP @@ -18,61 +69,7 @@ #include "win-language.h" #endif -#include "ali1429.h" -#include "cdrom.h" -#include "cdrom-ioctl.h" -#include "disc.h" -#include "disc_86f.h" -#include "disc_fdi.h" -#include "disc_imd.h" -#include "disc_img.h" -#include "disc_random.h" -#include "disc_td0.h" -#include "mem.h" -#include "x86_ops.h" -#include "codegen.h" -#include "cdrom-iso.h" -#include "cdrom-null.h" -#include "config.h" -#include "cpu.h" -#include "dma.h" -#include "fdc.h" -#include "fdd.h" -#include "gameport.h" -#include "sound_gus.h" -#include "ide.h" -#include "cdrom.h" -#include "scsi.h" -#include "keyboard.h" -#include "keyboard_at.h" -#include "mem.h" -#include "model.h" -#include "mouse.h" -#include "ne2000.h" -#include "nethandler.h" -#include "nvr.h" -#include "pic.h" -#include "pit.h" -#include "plat-joystick.h" -#include "plat-midi.h" -#include "plat-mouse.h" -#include "plat-keyboard.h" -#include "serial.h" -#include "sound.h" -#include "sound_cms.h" -#include "sound_dbopl.h" -#include "sound_opl.h" -#include "sound_sb.h" -#include "sound_speaker.h" -#include "sound_ssi2001.h" -#include "timer.h" -#include "vid_voodoo.h" -#include "video.h" -#include "amstrad.h" -#include "hdd.h" -#include "nethandler.h" -#define NE2000 1 -#define RTL8029AS 2 + uint8_t ethif; int inum; @@ -318,7 +315,6 @@ void initpc(int argc, wchar_t *argv[]) } } - keyboard_init(); mouse_init(); midi_init(); @@ -498,8 +494,8 @@ void resetpchard() ide_qua_init(); } - network_card_init(); - + network_init(); + for (i = 0; i < CDROM_NUM; i++) { if (cdrom_drives[i].bus_type) @@ -594,7 +590,6 @@ void runpc() execx86(models[model].cpu[cpu_manufacturer].cpus[cpu].rspeed / 100); } - keyboard_poll_host(); keyboard_process(); pollmouse(); if (joystick_type != 7) joystick_poll(); diff --git a/src/pit.c b/src/pit.c index e9e4cb090..b735656a5 100644 --- a/src/pit.c +++ b/src/pit.c @@ -5,17 +5,18 @@ #include #include "ibm.h" - -#include "cpu.h" -#include "device.h" +#include "cpu/cpu.h" #include "dma.h" #include "io.h" #include "pic.h" #include "pit.h" -#include "sound_speaker.h" +#include "device.h" #include "timer.h" -#include "video.h" #include "model.h" +#include "sound/snd_speaker.h" +#include "video/video.h" + + /*B0 to 40, two writes to 43, then two reads - value does not change!*/ /*B4 to 40, two writes to 43, then two reads - value _does_ change!*/ int displine; diff --git a/src/ps2_mca.c b/src/ps2_mca.c index fd3201ac3..74183a8ed 100644 --- a/src/ps2_mca.c +++ b/src/ps2_mca.c @@ -1,15 +1,16 @@ #include "ibm.h" -#include "cpu.h" -#include "device.h" +#include "cpu/cpu.h" +#include "cpu/x86.h" #include "io.h" -#include "lpt.h" #include "mca.h" #include "mem.h" +#include "rom.h" +#include "device.h" +#include "lpt.h" #include "ps2_mca.h" #include "ps2_nvr.h" -#include "rom.h" #include "serial.h" -#include "x86.h" + static struct { diff --git a/src/resource.h b/src/resource.h index 9bfe518b4..fec4d83b9 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,10 +1,9 @@ /* Copyright holders: Tenshi see COPYING for more details */ - /* {{NO_DEPENDENCIES}} Microsoft Developer Studio generated include file. - Used by pc_new2.rc + Used by 86Box.rc */ #define IDHDCONFIG 3 #define IDCDCONFIG 4 @@ -195,27 +194,27 @@ #define IDM_IDE_QUA_IRQ15 44035 #ifdef ENABLE_LOG_TOGGLES -#ifdef ENABLE_BUSLOGIC_LOG -#define IDM_LOG_BUSLOGIC 51200 -#endif -#ifdef ENABLE_CDROM_LOG -#define IDM_LOG_CDROM 51201 -#endif -#ifdef ENABLE_D86F_LOG -#define IDM_LOG_D86F 51202 -#endif -#ifdef ENABLE_FDC_LOG -#define IDM_LOG_FDC 51203 -#endif -#ifdef ENABLE_IDE_LOG -#define IDM_LOG_IDE 51204 -#endif -#ifdef ENABLE_NE2000_LOG -#define IDM_LOG_NE2000 51205 -#endif +# ifdef ENABLE_BUSLOGIC_LOG +# define IDM_LOG_BUSLOGIC 51200 +# endif +# ifdef ENABLE_CDROM_LOG +# define IDM_LOG_CDROM 51201 +# endif +# ifdef ENABLE_D86F_LOG +# define IDM_LOG_D86F 51202 +# endif +# ifdef ENABLE_FDC_LOG +# define IDM_LOG_FDC 51203 +# endif +# ifdef ENABLE_IDE_LOG +# define IDM_LOG_IDE 51204 +# endif +# ifdef ENABLE_NE2000_LOG +# define IDM_LOG_NE2000 51205 +# endif #endif #ifdef ENABLE_LOG_BREAKPOINT -#define IDM_LOG_BREAKPOINT 51206 +# define IDM_LOG_BREAKPOINT 51206 #endif #define IDC_COMBO1 1000 @@ -413,13 +412,12 @@ #define IDC_STATIC 1792 /* Next default values for new objects */ - #ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 110 -#define _APS_NEXT_COMMAND_VALUE 40002 -#define _APS_NEXT_CONTROL_VALUE 1055 -#define _APS_NEXT_SYMED_VALUE 101 -#endif +# ifndef APSTUDIO_READONLY_SYMBOLS +# define _APS_NO_MFC 1 +# define _APS_NEXT_RESOURCE_VALUE 110 +# define _APS_NEXT_COMMAND_VALUE 40002 +# define _APS_NEXT_CONTROL_VALUE 1055 +# define _APS_NEXT_SYMED_VALUE 101 +# endif #endif diff --git a/src/scsi.c b/src/scsi.c index 3dbefdf37..3b88ed36b 100644 --- a/src/scsi.c +++ b/src/scsi.c @@ -6,10 +6,10 @@ #include #include "86box.h" #include "ibm.h" +#include "timer.h" #include "device.h" #include "cdrom.h" #include "scsi.h" -#include "timer.h" #include "scsi_buslogic.h" @@ -106,7 +106,7 @@ void SCSIReset(uint8_t id, uint8_t lun) if (hdc_id != 0xff) { scsi_hd_reset(cdrom_id); - SCSIDevices[id][lun].LunType = SCSI_HDD; + SCSIDevices[id][lun].LunType = SCSI_DISK; } else { if (cdrom_id != 0xff) { diff --git a/src/scsi.h b/src/scsi.h index 61c8f1bf5..788dcb7f3 100644 --- a/src/scsi.h +++ b/src/scsi.h @@ -208,7 +208,7 @@ extern int cd_status; extern int prev_status; #define SCSI_NONE 0 -#define SCSI_HDD 1 +#define SCSI_DISK 1 #define SCSI_CDROM 2 #define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f) @@ -266,4 +266,4 @@ void scsi_hd_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_l void scsi_hd_command(uint8_t id, uint8_t *cdb); void scsi_hd_callback(uint8_t id); -#endif \ No newline at end of file +#endif diff --git a/src/scsi_aha154x.c b/src/scsi_aha154x.c index 99fcd8cb9..2161fa934 100644 --- a/src/scsi_aha154x.c +++ b/src/scsi_aha154x.c @@ -8,10 +8,10 @@ * * Implementation of several low-level support functions for * the AHA-154x series of ISA Host Adapters made by Adaptec. - * These functions implement the support needed by the ROM BIOS - * of these cards. + * These functions implement the support needed by the ROM + * BIOS of these cards. * - * Version: @(#)aha154x.c 1.0.4 2017/04/21 + * Version: @(#)scsi_aha154x.c 1.0.5 2017/05/05 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. @@ -40,35 +40,35 @@ #if AHA == AHA154xC # define ROMFILE L"roms/adaptec/aha1542c101.bin" -# define AHA_BID 'D' /* AHA-154x C */ -# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ -# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ -# define ROM_SHRAMSZ 128 /* size of shadow RAM */ -# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ -# define EEP_SIZE 32 /* 32 bytes of storage */ +# define AHA_BID 'D' /* AHA-154x C */ +# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ #endif #if AHA == AHA154xCF # define ROMFILE L"roms/adaptec/aha1542cf201.bin" -# define AHA_BID 'E' /* AHA-154x CF */ -# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ -# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ -# define ROM_SHRAMSZ 128 /* size of shadow RAM */ -# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ -# define EEP_SIZE 32 /* 32 bytes of storage */ +# define AHA_BID 'E' /* AHA-154x CF */ +# define ROM_FWHIGH 0x0022 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ #endif #if AHA == AHA154xCP # define ROMFILE L"roms/adaptec/aha1542cp102.bin" -# define AHA_BID 'F' /* AHA-154x CP */ -# define ROM_FWHIGH 0x0055 /* firmware version (hi/lo) */ -# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ -# define ROM_SHRAMSZ 128 /* size of shadow RAM */ -# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ -# define EEP_SIZE 32 /* 32 bytes of storage */ +# define AHA_BID 'F' /* AHA-154x CP */ +# define ROM_FWHIGH 0x0055 /* firmware version (hi/lo) */ +# define ROM_SHRAM 0x3F80 /* shadow RAM address base */ +# define ROM_SHRAMSZ 128 /* size of shadow RAM */ +# define ROM_IOADDR 0x3F7E /* [2:0] idx into addr table */ +# define EEP_SIZE 32 /* 32 bytes of storage */ #endif -#define ROM_SIZE 16384 /* one ROM is 16K */ +#define ROM_SIZE 16384 /* one ROM is 16K */ /* EEPROM map and bit definitions. */ @@ -198,14 +198,14 @@ aha154x_init(uint16_t ioaddr, uint32_t memaddr, aha_info *aha) uint32_t bios_size; uint32_t bios_addr; uint32_t bios_mask; - char *bios_path; + wchar_t *bios_path; uint32_t temp; FILE *f; /* Set BIOS load address. */ bios_addr = memaddr; bios_path = ROMFILE; - pclog("AHA154x: loading BIOS from '%s'\n", bios_path); + pclog_w(L"AHA154x: loading BIOS from '%s'\n", bios_path); /* Open the BIOS image file and make sure it exists. */ if ((f = romfopen(bios_path, L"rb")) == NULL) { diff --git a/src/scsi_buslogic.c b/src/scsi_buslogic.c index 9675cfe88..39da63367 100644 --- a/src/scsi_buslogic.c +++ b/src/scsi_buslogic.c @@ -2055,7 +2055,7 @@ static void BuslogicSCSIRequestSetup(Buslogic_t *bl, uint32_t CCBPointer, Mailbo req->CmdBlock.common.ControlByte); } - BuslogicInOperation = (SCSIDevices[Id][Lun].LunType == SCSI_HDD) ? 0x11 : 1; + BuslogicInOperation = (SCSIDevices[Id][Lun].LunType == SCSI_DISK) ? 0x11 : 1; pclog("SCSI (%i:%i) -> %i\n", Id, Lun, SCSIDevices[Id][Lun].LunType); } } @@ -2424,7 +2424,7 @@ void *AdaptecInit(int has_bios, int chip) { if (scsi_hard_disks[i][j] != 0xff) { - SCSIDevices[i][j].LunType = SCSI_HDD; + SCSIDevices[i][j].LunType = SCSI_DISK; } } } @@ -2509,7 +2509,7 @@ void *BuslogicInit(int chip) { if (scsi_hard_disks[i][j] != 0xff) { - SCSIDevices[i][j].LunType = SCSI_HDD; + SCSIDevices[i][j].LunType = SCSI_DISK; } } } diff --git a/src/scsi_buslogic.h b/src/scsi_buslogic.h index c4b6805f0..46ec9bf3b 100644 --- a/src/scsi_buslogic.h +++ b/src/scsi_buslogic.h @@ -14,8 +14,8 @@ extern device_t aha1540b_device; extern device_t aha1542cf_device; extern device_t buslogic_device; extern device_t buslogic_pci_device; - - + + extern int buslogic_dev_present(uint8_t id, uint8_t lun); extern void aha154x_init(uint16_t, uint32_t, aha_info *); diff --git a/src/scsi_hd.c b/src/scsi_disk.c similarity index 100% rename from src/scsi_hd.c rename to src/scsi_disk.c diff --git a/src/serial.c b/src/serial.c index 4eb78e821..a80912ddf 100644 --- a/src/serial.c +++ b/src/serial.c @@ -1,295 +1,639 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of NS8250-series UART devices. + * + * The original IBM-PC design did not have any serial ports of + * any kind. Rather, these were offered as add-on devices, most + * likely because a) most people did not need one at the time, + * and, b) this way, IBM could make more money off them. + * + * So, for the PC, the offerings were for an IBM Asynchronous + * Communications Adapter, and, later, a model for synchronous + * communications. + * + * The "Async Adapter" was based on the NS8250 UART chip, and + * is what we now call the "serial" or "com" port of the PC. + * + * Of course, many system builders came up with similar boards, + * and even more boards were designed where several I/O functions + * were combined into a single board: the Multi-I/O adapters. + * Initially, these had all the chips as-is, but later many of + * these functions were integrated into a single MIO chip. + * + * This file implements the standard NS8250 series of chips, with + * support for the later (16450 and 16550) FIFO additions. On the + * lower half of the driver, we interface to the host system's + * serial ports for real-world access. + * + * Based on the 86Box serial port driver as a framework. + * + * Version: @(#)serial.c 1.0.2 2017/05/05 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ #include "ibm.h" #include "io.h" #include "mouse.h" #include "pic.h" #include "serial.h" #include "timer.h" +#include "win-serial.h" -enum -{ - SERIAL_INT_LSR = 1, - SERIAL_INT_RECEIVE = 2, - SERIAL_INT_TRANSMIT = 4, - SERIAL_INT_MSR = 8 + +enum { + SERINT_LSR = 1, + SERINT_RECEIVE = 2, + SERINT_TRANSMIT = 4, + SERINT_MSR = 8 }; -SERIAL serial1, serial2; -void serial_reset() -{ - serial1.iir = serial1.ier = serial1.lcr = serial1.mctrl = 0; - serial2.iir = serial2.ier = serial2.lcr = serial2.mctrl = 0; - serial1.fifo_read = serial1.fifo_write = 0; - serial2.fifo_read = serial2.fifo_write = 0; -} +/* IER register bits. */ +#define IER_RDAIE (0x01) +#define IER_THREIE (0x02) +#define IER_RXLSIE (0x04) +#define IER_MSIE (0x08) +#define IER_SLEEP (0x10) /* NS16750 */ +#define IER_LOWPOWER (0x20) /* NS16750 */ +#define IER_MASK (0x0f) /* not including SLEEP|LOWP */ -void serial_update_ints(SERIAL *serial) +/* IIR register bits. */ +#define IIR_IP (0x01) +#define IIR_IID (0x0e) +# define IID_IDMDM (0x00) +# define IID_IDTX (0x02) +# define IID_IDRX (0x04) +# define IID_IDERR (0x06) +# define IID_IDTMO (0x0c) +#define IIR_IIRFE (0xc0) +# define IIR_FIFO64 (0x20) +# define IIR_FIFOBAD (0x80) /* 16550 */ +# define IIR_FIFOENB (0xc0) + +/* FCR register bits. */ +#define FCR_FCRFE (0x01) +#define FCR_RFR (0x02) +#define FCR_TFR (0x04) +#define FCR_SELDMA1 (0x08) +#define FCR_FENB64 (0x20) /* 16750 */ +#define FCR_RTLS (0xc0) +# define FCR_RTLS1 (0x00) +# define FCR_RTLS4 (0x40) +# define FCR_RTLS8 (0x80) +# define FCR_RTLS14 (0xc0) + +/* LCR register bits. */ +#define LCR_WLS (0x03) +# define WLS_BITS5 (0x00) +# define WLS_BITS6 (0x01) +# define WLS_BITS7 (0x02) +# define WLS_BITS8 (0x03) +#define LCR_SBS (0x04) +#define LCR_PE (0x08) +#define LCR_EP (0x10) +#define LCR_PS (0x20) +# define PAR_NONE (0x00) +# define PAR_EVEN (LCR_PE | LCR_EP) +# define PAR_ODD (LCR_PE) +# define PAR_MARK (LCR_PE | LCR_PS) +# define PAR_SPACE (LCR_PE | LCR_PS | LCR_EP) +#define LCR_BC (0x40) +#define LCR_DLAB (0x80) + +/* MCR register bits. */ +#define MCR_DTR (0x01) +#define MCR_RTS (0x02) +#define MCR_OUT1 (0x04) /* 8250 */ +#define MCR_OUT2 (0x08) /* 8250, INTEN on IBM-PC */ +#define MCR_LMS (0x10) +#define MCR_AUTOFLOW (0x20) /* 16750 + +/* LSR register bits. */ +#define LSR_DR (0x01) +#define LSR_OE (0x02) +#define LSR_PE (0x04) +#define LSR_FE (0x08) +#define LSR_BI (0x10) +#define LSR_THRE (0x20) +#define LSR_TEMT (0x40) +#define LSR_RXFE (0x80) + +/* MSR register bits. */ +#define MSR_DCTS (0x01) +#define MSR_DDSR (0x02) +#define MSR_TERI (0x04) +#define MSR_DDCD (0x08) +#define MSR_CTS (0x10) +#define MSR_DSR (0x20) +#define MSR_RI (0x40) +#define MSR_DCD (0x80) +#define MSR_MASK (0x0f) + + +static uint16_t serial_addr[2] = { 0x3f8, 0x2f8 }; +static int serial_irq[2] = { 4, 3 }; +static SERIAL serial1, serial2; + + +static void +update_ints(SERIAL *sp) { - int stat = 0; + int stat = 0; - serial->iir = 1; + sp->iir = IIR_IP; + if ((sp->ier & IER_RXLSIE) && (sp->int_status & SERINT_LSR)) { + /* Line Status interrupt. */ + stat = 1; + sp->iir = IID_IDERR; + } else if ((sp->ier & IER_RDAIE) && (sp->int_status & SERINT_RECEIVE)) { + /* Received Data available. */ + stat = 1; + sp->iir = IID_IDRX; + } else if ((sp->ier & IER_THREIE) && (sp->int_status & SERINT_TRANSMIT)) { + /* Transmit Data empty. */ + stat = 1; + sp->iir = IID_IDTX; + } else if ((sp->ier & IER_MSIE) && (sp->int_status & SERINT_MSR)) { + /* Modem Status interrupt. */ + stat = 1; + sp->iir = IID_IDMDM; + } - if ((serial->ier & 4) && (serial->int_status & SERIAL_INT_LSR)) /*Line status interrupt*/ - { - stat = 1; - serial->iir = 6; - } - else if ((serial->ier & 1) && (serial->int_status & SERIAL_INT_RECEIVE)) /*Recieved data available*/ - { - stat = 1; - serial->iir = 4; - } - else if ((serial->ier & 2) && (serial->int_status & SERIAL_INT_TRANSMIT)) /*Transmit data empty*/ - { - stat = 1; - serial->iir = 2; - } - else if ((serial->ier & 8) && (serial->int_status & SERIAL_INT_MSR)) /*Modem status interrupt*/ - { - stat = 1; - serial->iir = 0; - } - - if (stat && ((serial->mctrl & 8) || PCJR)) - picintlevel(1 << serial->irq); - else - picintc(1 << serial->irq); + /* Raise or clear the level-based IRQ. */ + if (stat && ((sp->mctrl & MCR_OUT2) || PCJR)) + picintlevel(1 << sp->irq); + else + picintc(1 << sp->irq); } -void serial_write_fifo(SERIAL *serial, uint8_t dat) + +/* Write data to the (input) FIFO. Used by MOUSE driver. */ +void +serial_write_fifo(SERIAL *sp, uint8_t dat) { - serial->fifo[serial->fifo_write] = dat; - serial->fifo_write = (serial->fifo_write + 1) & 0xFF; - if (!(serial->lsr & 1)) - { - serial->lsr |= 1; - serial->int_status |= SERIAL_INT_RECEIVE; - serial_update_ints(serial); - } + /* Stuff data into FIFO. */ + sp->fifo[sp->fifo_write] = dat; + sp->fifo_write = (sp->fifo_write + 1) & 0xFF; + + if (! (sp->lsr & LSR_DR)) { + sp->lsr |= LSR_DR; + sp->int_status |= SERINT_RECEIVE; + update_ints(sp); + } } -uint8_t serial_read_fifo(SERIAL *serial) + +static uint8_t +read_fifo(SERIAL *sp) { - if (serial->fifo_read != serial->fifo_write) - { - serial->dat = serial->fifo[serial->fifo_read]; - serial->fifo_read = (serial->fifo_read + 1) & 0xFF; - } - return serial->dat; + if (sp->fifo_read != sp->fifo_write) { + sp->dat = sp->fifo[sp->fifo_read]; + sp->fifo_read = (sp->fifo_read + 1) & 0xFF; + } + + return(sp->dat); } -void serial_write(uint16_t addr, uint8_t val, void *p) + +/* BHTTY WRITE COMPLETE handler. */ +static void +serial_wr_done(void *arg) { - SERIAL *serial = (SERIAL *)p; - switch (addr&7) - { - case 0: - if (serial->lcr & 0x80) - { - serial->dlab1 = val; - return; - } - serial->thr = val; - serial->lsr |= 0x20; - serial->int_status |= SERIAL_INT_TRANSMIT; - serial_update_ints(serial); - if (serial->mctrl & 0x10) - { - serial_write_fifo(serial, val); - } - break; - case 1: - if (serial->lcr & 0x80) - { - serial->dlab2 = val; - return; - } - serial->ier = val & 0xf; - serial_update_ints(serial); - break; - case 2: - serial->fcr = val; - break; - case 3: - serial->lcr = val; - break; - case 4: - if ((val & 2) && !(serial->mctrl & 2)) - { - if (serial->rcr_callback) - serial->rcr_callback(serial, serial->rcr_callback_p); - } - serial->mctrl = val; - if (val & 0x10) - { - uint8_t new_msr; - - new_msr = (val & 0x0c) << 4; - new_msr |= (val & 0x02) ? 0x10: 0; - new_msr |= (val & 0x01) ? 0x20: 0; - - if ((serial->msr ^ new_msr) & 0x10) - new_msr |= 0x01; - if ((serial->msr ^ new_msr) & 0x20) - new_msr |= 0x02; - if ((serial->msr ^ new_msr) & 0x80) - new_msr |= 0x08; - if ((serial->msr & 0x40) && !(new_msr & 0x40)) - new_msr |= 0x04; - - serial->msr = new_msr; - } - break; - case 5: - serial->lsr = val; - if (serial->lsr & 0x01) - serial->int_status |= SERIAL_INT_RECEIVE; - if (serial->lsr & 0x1e) - serial->int_status |= SERIAL_INT_LSR; - if (serial->lsr & 0x20) - serial->int_status |= SERIAL_INT_TRANSMIT; - serial_update_ints(serial); - break; - case 6: - serial->msr = val; - if (serial->msr & 0x0f) - serial->int_status |= SERIAL_INT_MSR; - serial_update_ints(serial); - break; - case 7: - serial->scratch = val; - break; - } + SERIAL *sp = (SERIAL *)arg; + + /* The WRITE completed, we are ready for more. */ + sp->lsr |= LSR_THRE; + sp->int_status |= SERINT_TRANSMIT; + update_ints(sp); } -uint8_t serial_read(uint16_t addr, void *p) + +/* Handle a WRITE operation to one of our registers. */ +static void +serial_write(uint16_t addr, uint8_t val, void *priv) { - SERIAL *serial = (SERIAL *)p; - uint8_t temp = 0; - switch (addr&7) - { - case 0: - if (serial->lcr & 0x80) - { - temp = serial->dlab1; - break; - } + SERIAL *sp = (SERIAL *)priv; + uint8_t wl, sb, pa; + uint16_t baud; + long speed; - serial->lsr &= ~1; - serial->int_status &= ~SERIAL_INT_RECEIVE; - serial_update_ints(serial); - temp = serial_read_fifo(serial); - if (serial->fifo_read != serial->fifo_write) - serial->recieve_delay = 1000 * TIMER_USEC; - break; - case 1: - if (serial->lcr & 0x80) - temp = serial->dlab2; - else - temp = serial->ier; - break; - case 2: - temp = serial->iir; - if ((temp & 0xe) == 2) - { - serial->int_status &= ~SERIAL_INT_TRANSMIT; - serial_update_ints(serial); - } - if (serial->fcr & 1) - temp |= 0xc0; - break; - case 3: - temp = serial->lcr; - break; - case 4: - temp = serial->mctrl; - break; - case 5: - if (serial->lsr & 0x20) - serial->lsr |= 0x40; - serial->lsr |= 0x20; - temp = serial->lsr; - if (serial->lsr & 0x1f) - serial->lsr &= ~0x1e; - serial->int_status &= ~SERIAL_INT_LSR; - serial_update_ints(serial); - break; - case 6: - temp = serial->msr; - serial->msr &= ~0x0f; - serial->int_status &= ~SERIAL_INT_MSR; - serial_update_ints(serial); - break; - case 7: - temp = serial->scratch; - break; - } - return temp; + switch (addr & 0x07) { + case 0: /* DATA / DLAB1 */ + if (sp->lcr & LCR_DLAB) { + sp->dlab1 = val; + return; + } + sp->thr = val; +#if 0 + bhtty_write((BHTTY *)sp->bh, sp->thr, serial_wrdone, sp); +#else + bhtty_write((BHTTY *)sp->bh, sp->thr); + serial_wr_done(sp); +#endif + if (sp->mctrl & MCR_LMS) { + /* Echo data back to RX. */ + serial_write_fifo(sp, val); + } + break; + + case 1: /* IER / DLAB2 */ + if (sp->lcr & LCR_DLAB) { + sp->dlab2 = val; + return; + } + sp->ier = (val & IER_MASK); + update_ints(sp); + break; + + case 2: /* FCR */ + sp->fcr = val; + break; + + case 3: /* LCR */ + if ((sp->lcr & LCR_DLAB) && !(val & LCR_DLAB)) { + /* We dropped DLAB, so handle baudrate. */ + baud = ((sp->dlab2 << 8) | sp->dlab1); + speed = 115200UL/baud; +#if 1 + pclog("Serial: new divisor %u, baudrate %ld\n", + baud, speed); +#endif + bhtty_speed((BHTTY *)sp->bh, speed); + } + wl = (val & LCR_WLS) + 5; /* databits */ + sb = (val & LCR_SBS) ? 2 : 1; /* stopbits */ + pa = (val & (LCR_PE|LCR_EP|LCR_PS)) >> 3; +#if 1 + pclog("Serial: WL=%d SB=%d PA=%d\n", wl, sb, pa); +#endif + bhtty_params((BHTTY *)sp->bh, wl, pa, sb); + sp->lcr = val; + break; + + case 4: + if ((val & MCR_RTS) && !(sp->mctrl & MCR_RTS)) { + /* + * This is old code for use by the Serial Mouse + * driver. If the user toggles RTS, any serial + * mouse is expected to send an 'M' character, + * to inform any enumerator there 'is' something. + */ + if (sp->rcr_callback) { + sp->rcr_callback(sp, sp->rcr_callback_p); +#if 0 + pclog("RTS raised; sending M\n"); +#endif + } + } + + if ((val & MCR_OUT2) && !(sp->mctrl & MCR_OUT2)) { + /* Start up reading from the real port. */ + (void)bhtty_read((BHTTY *)sp->bh, &sp->hold, 1); + } + sp->mctrl = val; + if (val & MCR_LMS) { /* loopback mode */ + uint8_t new_msr; + + /*FIXME: WTF does this do?? --FvK */ + new_msr = (val & 0x0c) << 4; + new_msr |= (val & MCR_RTS) ? MCR_LMS : 0; + new_msr |= (val & MCR_DTR) ? MCR_AUTOFLOW : 0; + + if ((sp->msr ^ new_msr) & 0x10) + new_msr |= MCR_DTR; + if ((sp->msr ^ new_msr) & 0x20) + new_msr |= MCR_RTS; + if ((sp->msr ^ new_msr) & 0x80) + new_msr |= 0x08; + if ((sp->msr & 0x40) && !(new_msr & 0x40)) + new_msr |= 0x04; + + sp->msr = new_msr; + } + break; + + case 5: + sp->lsr = val; + if (sp->lsr & LSR_DR) + sp->int_status |= SERINT_RECEIVE; + if (sp->lsr & 0x1e) + sp->int_status |= SERINT_LSR; + if (sp->lsr & LSR_THRE) + sp->int_status |= SERINT_TRANSMIT; + update_ints(sp); + break; + + case 6: + sp->msr = val; + if (sp->msr & MSR_MASK) + sp->int_status |= SERINT_MSR; + update_ints(sp); + break; + + case 7: + sp->scratch = val; + break; + } } -void serial_recieve_callback(void *p) + +/* BHTTY READ COMPLETE handler. */ +static void +serial_rd_done(void *arg, int num) { - SERIAL *serial = (SERIAL *)p; - - serial->recieve_delay = 0; - - if (serial->fifo_read != serial->fifo_write) - { - serial->lsr |= 1; - serial->int_status |= SERIAL_INT_RECEIVE; - serial_update_ints(serial); - } + SERIAL *sp = (SERIAL *)arg; +//pclog("%04x: %d bytes available: %02x (%c)\n",sp->port,num,sp->hold,sp->hold); + + /* Stuff the byte in the FIFO and set intr. */ + serial_write_fifo(sp, sp->hold); + + /* Start up the next read from the real port. */ + (void)bhtty_read((BHTTY *)sp->bh, &sp->hold, 1); +} + + +/* Handle a READ operation from one of our registers. */ +static uint8_t +serial_read(uint16_t addr, void *priv) +{ + SERIAL *sp = (SERIAL *)priv; + uint8_t ret = 0x00; + + switch (addr&0x07) { + case 0: /* DATA / DLAB1 */ + if (sp->lcr & LCR_DLAB) { + ret = sp->dlab1; + break; + } + sp->lsr &= ~LSR_DR; + sp->int_status &= ~SERINT_RECEIVE; + update_ints(sp); + ret = read_fifo(sp); +#if 0 + if (sp->fifo_read != sp->fifo_write) + sp->receive_delay = 1000 * TIMER_USEC; +#endif + break; + + case 1: /* LCR / DLAB2 */ + if (sp->lcr & LCR_DLAB) + ret = sp->dlab2; + else + ret = sp->ier; + break; + + case 2: /* IIR */ + ret = sp->iir; + if ((ret & IIR_IID) == IID_IDTX) { + sp->int_status &= ~SERINT_TRANSMIT; + update_ints(sp); + } + if (sp->fcr & 1) + { + ret |= 0xc0; + } + break; + + case 3: /* LCR */ + ret = sp->lcr; + break; + + case 4: /* MCR */ + ret = sp->mctrl; + break; + + case 5: /* LSR */ + if (sp->lsr & LSR_THRE) + sp->lsr |= LSR_TEMT; + sp->lsr |= LSR_THRE; + ret = sp->lsr; + if (sp->lsr & 0x1f) + sp->lsr &= ~0x1e; +#if 0 + sp->lsr |= (LSR_THRE | LSR_TEMT); +#endif + sp->int_status &= ~SERINT_LSR; + update_ints(sp); + break; + + case 6: + ret = sp->msr; + sp->msr &= ~0x0f; + sp->int_status &= ~SERINT_MSR; + update_ints(sp); + break; + + case 7: + ret = sp->scratch; + break; + } + + return(ret); } -uint16_t serial_addr[2] = { 0x3f8, 0x2f8 }; -int serial_irq[2] = { 4, 3 }; /*Tandy might need COM1 at 2f8*/ -void serial1_init(uint16_t addr, int irq) +void +serial1_init(uint16_t addr, int irq) { - memset(&serial1, 0, sizeof(serial1)); - io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); - serial1.irq = irq; - serial1.rcr_callback = NULL; - timer_add(serial_recieve_callback, &serial1.recieve_delay, &serial1.recieve_delay, &serial1); - serial_addr[0] = addr; - serial_irq[0] = irq; -} -void serial1_set(uint16_t addr, int irq) -{ - serial1_remove(); - io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); - serial1.irq = irq; - serial_addr[0] = addr; - serial_irq[0] = irq; -} -void serial1_remove() -{ - io_removehandler(serial_addr[0], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); + BHTTY *bh; + + memset(&serial1, 0x00, sizeof(serial1)); + + pclog("Serial1, I/O=%04x, IRQ=%d, host ", addr, irq); + + /* Request a port from the host system. */ + bh = bhtty_open(BHTTY_PORT1, 0); /*FIXME: from config! --FvK */ + if (bh == NULL) { + return; + } + serial1.bh = bh; + serial1.port = addr; + serial1.irq = irq; + serial1.rcr_callback = NULL; + pclog("'%s'\n", bh->name); + + /* Set up bottom-half I/O callback info. */ + bh->rd_done = serial_rd_done; + bh->rd_arg = &serial1; + + /* Request an I/O range. */ + io_sethandler(addr, 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); + +#if 0 + timer_add(serial_receive_callback, + &serial1.receive_delay, &serial1.receive_delay, &serial1); +#endif + + serial_addr[0] = addr; + serial_irq[0] = irq; } -void serial2_init(uint16_t addr, int irq) + +/* Release all resources held by the device. */ +void +serial1_remove(void) { - memset(&serial2, 0, sizeof(serial2)); - io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); - serial2.irq = irq; - serial2.rcr_callback = NULL; - timer_add(serial_recieve_callback, &serial2.recieve_delay, &serial2.recieve_delay, &serial2); - serial_addr[1] = addr; - serial_irq[1] = irq; + /* Close the host device. */ + if (serial1.bh != NULL) + bhtty_close((BHTTY *)serial1.bh); + + /* Release our I/O range. */ + io_removehandler(serial_addr[0], 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); } -void serial2_set(uint16_t addr, int irq) + + +void +serial1_set(uint16_t addr, int irq) { - serial2_remove(); - io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); - serial2.irq = irq; - serial_addr[1] = addr; - serial_irq[1] = irq; + void *temp; + +#if 0 + pclog("serial1_set(%04X, %02X)\n", addr, irq); +#endif + temp = serial1.bh; + serial1.bh = NULL; + serial1_remove(); + serial1.bh = temp; + serial1.port = addr; + serial1.irq = irq; + + io_sethandler(addr, 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1); + serial_addr[0] = addr; + serial_irq[0] = irq; } -void serial2_remove() + + +void +serial2_init(uint16_t addr, int irq) { - io_removehandler(serial_addr[1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); + BHTTY *bh; + + memset(&serial2, 0x00, sizeof(serial2)); + + pclog("Serial2, I/O=%04x, IRQ=%d, host ", addr, irq); + + /* Request a port from the host system. */ + bh = bhtty_open(BHTTY_PORT2, 0); /*FIXME: from config! --FvK */ + if (bh == NULL) { + return; + } + serial2.bh = bh; + serial2.port = addr; + serial2.irq = irq; + serial2.rcr_callback = NULL; + pclog("'%s'\n", bh->name); + + /* Set up bottom-half I/O callback info. */ + bh->rd_done = serial_rd_done; + bh->rd_arg = &serial2; + + /* Request an I/O range. */ + io_sethandler(addr, 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); + + serial_addr[1] = addr; + serial_irq[1] = irq; +} + + +/* Release all resources held by the device. */ +void +serial2_remove(void) +{ + /* Close the host device. */ + if (serial2.bh != NULL) + bhtty_close((BHTTY *)serial2.bh); + + /* Release our I/O range. */ + io_removehandler(serial_addr[1], 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); +} + + +void +serial2_set(uint16_t addr, int irq) +{ + void *temp; + +#if 0 + pclog("serial2_set(%04X, %02X)\n", addr, irq); +#endif + temp = serial2.bh; + serial2.bh = NULL; + serial2_remove(); + serial2.bh = temp; + serial2.port = addr; + serial2.irq = irq; + + io_sethandler(addr, 8, + serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2); + + serial_addr[1] = addr; + serial_irq[1] = irq; +} + + +/* + * Reset the serial ports. + * + * This should be a per-port function. + */ +void +serial_reset(void) +{ + serial1.iir = serial1.ier = serial1.lcr = serial1.mctrl = 0; + serial1.fifo_read = serial1.fifo_write = 0; + + serial2.iir = serial2.ier = serial2.lcr = serial2.mctrl = 0; + serial2.fifo_read = serial2.fifo_write = 0; +} + + +/* Fake interrupt generator, needed for Serial Mouse. */ +static void +serial_timer(void *priv) +{ + SERIAL *sp = (SERIAL *)priv; + + sp->receive_delay = 0; + + if (sp->fifo_read != sp->fifo_write) { + sp->lsr |= LSR_DR; + sp->int_status |= SERINT_RECEIVE; + update_ints(sp); + } +} + + +/* Attach another device (MOUSE) to a serial port. */ +SERIAL * +serial_attach(int port, void *func, void *arg) +{ + SERIAL *sp; + + if (port == 0) + sp = &serial1; + else + sp = &serial2; + + /* Set up callback info. */ + sp->rcr_callback = func; + sp->rcr_callback_p = arg; + + /* Create a timer to fake RX interrupts for mouse data. */ + timer_add(serial_timer, + &sp->receive_delay, &sp->receive_delay, sp); + + return(sp); } diff --git a/src/serial.h b/src/serial.h index 96104068e..05a5c7ff5 100644 --- a/src/serial.h +++ b/src/serial.h @@ -1,35 +1,56 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ -void serial1_init(uint16_t addr, int irq); -void serial2_init(uint16_t addr, int irq); -void serial1_set(uint16_t addr, int irq); -void serial2_set(uint16_t addr, int irq); -void serial1_remove(); -void serial2_remove(); -void serial_reset(); +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Definitions for the SERIAL card. + * + * Version: @(#)serial.h 1.0.1 2017/04/14 + * + * Author: Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef SERIAL_H +# define SERIAL_H -struct SERIAL; -typedef struct -{ - uint8_t lsr,thr,mctrl,rcr,iir,ier,lcr,msr; - uint8_t dlab1,dlab2; - uint8_t dat; - uint8_t int_status; - uint8_t scratch; - uint8_t fcr; - - int irq; +typedef struct _serial_ { + uint16_t port; + int16_t irq; - void (*rcr_callback)(struct SERIAL *serial, void *p); - void *rcr_callback_p; - uint8_t fifo[256]; - int fifo_read, fifo_write; - - int recieve_delay; + uint8_t lsr, thr, mctrl, rcr, iir, ier, lcr, msr; + uint8_t dlab1, dlab2; + uint8_t dat; + uint8_t int_status; + uint8_t scratch; + uint8_t fcr; + + void (*rcr_callback)(struct _serial_ *, void *); + void *rcr_callback_p; + + uint8_t hold; + uint8_t fifo[256]; + int fifo_read, fifo_write; + + int receive_delay; + + void *bh; } SERIAL; -extern SERIAL serial1, serial2; -void serial_write_fifo(SERIAL *serial, uint8_t dat); +extern void serial1_init(uint16_t addr, int irq); +extern void serial2_init(uint16_t addr, int irq); +extern void serial1_set(uint16_t addr, int irq); +extern void serial2_set(uint16_t addr, int irq); +extern void serial1_remove(); +extern void serial2_remove(); + +extern void serial_reset(); +extern SERIAL *serial_attach(int, void *, void *); +extern void serial_write_fifo(SERIAL *, uint8_t); + + +#endif /*SERIAL_H*/ diff --git a/src/sio.c b/src/sio.c index a5303935e..9092e0c2e 100644 --- a/src/sio.c +++ b/src/sio.c @@ -7,10 +7,9 @@ word 1 - bits 1 - 15 = byte count, bit 31 = end of transfer */ #include - #include "ibm.h" +#include "cpu/cpu.h" #include "cdrom.h" -#include "cpu.h" #include "disc.h" #include "dma.h" #include "fdc.h" diff --git a/src/timer.h b/src/timer.h index 50c83e55c..b2e7fec93 100644 --- a/src/timer.h +++ b/src/timer.h @@ -1,7 +1,6 @@ #ifndef _TIMER_H_ #define _TIMER_H_ -#include "cpu.h" extern int timer_start; diff --git a/src/win-d3d-fs.cc b/src/win-d3d-fs.cc index b44097898..9c0c7f557 100644 --- a/src/win-d3d-fs.cc +++ b/src/win-d3d-fs.cc @@ -9,23 +9,25 @@ #undef BITMAP #include #include "86box.h" -#include "resource.h" -#include "video.h" +#include "video/video.h" #include "win-d3d-fs.h" #include "win.h" #include "win-cgapal.h" +#include "resource.h" + extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); -extern "C" void device_force_redraw(); +extern "C" void device_force_redraw(void); -static void d3d_fs_init_objects(); -static void d3d_fs_close_objects(); +static void d3d_fs_init_objects(void); +static void d3d_fs_close_objects(void); static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h); -extern "C" void video_blit_complete(); +extern "C" void video_blit_complete(void); + static LPDIRECT3D9 d3d = NULL; static LPDIRECT3DDEVICE9 d3ddev = NULL; @@ -108,7 +110,7 @@ static CUSTOMVERTEX d3d_verts[] = {2048.0f, 2048.0f, 1.0f, 1.0f, 1.0f, 1.0f}, }; -void cgapal_rebuild() +void cgapal_rebuild(void) { int c; for (c = 0; c < 256; c++) @@ -195,7 +197,7 @@ int d3d_fs_init(HWND h) return 1; } -static void d3d_fs_close_objects() +static void d3d_fs_close_objects(void) { if (d3dTexture) { @@ -209,7 +211,7 @@ static void d3d_fs_close_objects() } } -static void d3d_fs_init_objects() +static void d3d_fs_init_objects(void) { D3DLOCKED_RECT dr; RECT r; @@ -256,7 +258,7 @@ static void d3d_fs_init_objects() d3d_reset(); }*/ -void d3d_fs_reset() +void d3d_fs_reset(void) { HRESULT hr; @@ -291,7 +293,7 @@ void d3d_fs_reset() device_force_redraw(); } -void d3d_fs_close() +void d3d_fs_close(void) { if (d3dTexture) { @@ -571,17 +573,14 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h) PostMessage(ghwnd, WM_RESETD3D, 0, 0); } -void d3d_fs_take_screenshot(char *fn) +void d3d_fs_take_screenshot(wchar_t *fn) { - WCHAR wfn[512]; LPDIRECT3DSURFACE9 d3dSurface = NULL; if (!d3dTexture) return; - mbstowcs(wfn, fn, strlen(fn) + 1); - d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); - D3DXSaveSurfaceToFile(wfn, D3DXIFF_PNG, d3dSurface, NULL, NULL); + D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); d3dSurface->Release(); d3dSurface = NULL; diff --git a/src/win-d3d.cc b/src/win-d3d.cc index a30fe1795..abfce0bfb 100644 --- a/src/win-d3d.cc +++ b/src/win-d3d.cc @@ -9,17 +9,19 @@ #include #include "resource.h" #include "win-d3d.h" -#include "video.h" +#include "video/video.h" #include "win-cgapal.h" + extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); -extern "C" void device_force_redraw(); -extern "C" void video_blit_complete(); +extern "C" void device_force_redraw(void); +extern "C" void video_blit_complete(void); -void d3d_init_objects(); -void d3d_close_objects(); + +void d3d_init_objects(void); +void d3d_close_objects(void); void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); void d3d_blit_memtoscreen_8(int x, int y, int w, int h); @@ -92,7 +94,7 @@ int d3d_init(HWND h) return 1; } -void d3d_close_objects() +void d3d_close_objects(void) { if (d3dTexture) { @@ -106,7 +108,7 @@ void d3d_close_objects() } } -void d3d_init_objects() +void d3d_init_objects(void) { D3DLOCKED_RECT dr; RECT r; @@ -150,7 +152,7 @@ void d3d_resize(int x, int y) d3d_reset(); } -void d3d_reset() +void d3d_reset(void) { HRESULT hr; @@ -185,7 +187,7 @@ void d3d_reset() device_force_redraw(); } -void d3d_close() +void d3d_close(void) { if (d3dTexture) { @@ -381,17 +383,14 @@ void d3d_blit_memtoscreen_8(int x, int y, int w, int h) PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0); } -void d3d_take_screenshot(char *fn) +void d3d_take_screenshot(wchar_t *fn) { - WCHAR wfn[512]; LPDIRECT3DSURFACE9 d3dSurface = NULL; if (!d3dTexture) return; - mbstowcs(wfn, fn, strlen(fn) + 1); - d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dSurface); - D3DXSaveSurfaceToFile(wfn, D3DXIFF_PNG, d3dSurface, NULL, NULL); + D3DXSaveSurfaceToFile(fn, D3DXIFF_PNG, d3dSurface, NULL, NULL); d3dSurface->Release(); d3dSurface = NULL; diff --git a/src/win-ddraw-fs.cc b/src/win-ddraw-fs.cc index 811c69f37..ed458af7a 100644 --- a/src/win-ddraw-fs.cc +++ b/src/win-ddraw-fs.cc @@ -8,18 +8,19 @@ #undef BITMAP #include "win-ddraw-fs.h" #include "win-ddraw-screenshot.h" -#include "video.h" +#include "video/video.h" #include "win-cgapal.h" + extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); -extern "C" void device_force_redraw(); +extern "C" void device_force_redraw(void); extern "C" int ddraw_fs_init(HWND h); -extern "C" void ddraw_fs_close(); +extern "C" void ddraw_fs_close(void); -extern "C" void video_blit_complete(); +extern "C" void video_blit_complete(void); static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h); @@ -91,7 +92,7 @@ int ddraw_fs_init(HWND h) return 1; } -void ddraw_fs_close() +void ddraw_fs_close(void) { if (lpdds_back2) { @@ -331,7 +332,7 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h) lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC); } -void ddraw_fs_take_screenshot(char *fn) +void ddraw_fs_take_screenshot(wchar_t *fn) { ddraw_common_take_screenshot(fn, lpdds_back2); } diff --git a/src/win-ddraw-screenshot.cc b/src/win-ddraw-screenshot.cc index c49c6170d..e8a891fe9 100644 --- a/src/win-ddraw-screenshot.cc +++ b/src/win-ddraw-screenshot.cc @@ -10,15 +10,16 @@ #include "win.h" #include "win-ddraw-screenshot.h" #include "win-language.h" -#include "video.h" +#include "video/video.h" + extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); -extern "C" void device_force_redraw(); +extern "C" void device_force_redraw(void); extern "C" void ddraw_init(HWND h); -extern "C" void ddraw_close(); +extern "C" void ddraw_close(void); HBITMAP hbitmap; @@ -69,7 +70,7 @@ void DoubleLines(uint8_t *dst, uint8_t *src) static WCHAR szMessage[2048]; -void SaveBitmap(char *szFilename,HBITMAP hBitmap) +void SaveBitmap(wchar_t *szFilename,HBITMAP hBitmap) { HDC hdc=NULL; FILE* fp=NULL; @@ -106,7 +107,7 @@ void SaveBitmap(char *szFilename,HBITMAP hBitmap) GetDIBits(hdc,hBitmap,0,bmpInfo.bmiHeader.biHeight,pBuf, &bmpInfo, DIB_RGB_COLORS); - if((fp = fopen(szFilename,"wb"))==NULL) + if((fp = _wfopen(szFilename,L"wb"))==NULL) { _swprintf(szMessage, win_language_get_string_from_id(2194), szFilename); msgbox_error_wstr(ghwnd, szMessage); @@ -154,7 +155,7 @@ void SaveBitmap(char *szFilename,HBITMAP hBitmap) if(fp) fclose(fp); } -void ddraw_common_take_screenshot(char *fn, IDirectDrawSurface7 *pDDSurface) +void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSurface) { xs = xsize; ys = ys2 = ysize; diff --git a/src/win-ddraw-screenshot.h b/src/win-ddraw-screenshot.h index 7c56e5f96..4739174a1 100644 --- a/src/win-ddraw-screenshot.h +++ b/src/win-ddraw-screenshot.h @@ -1,4 +1,4 @@ /* Copyright holders: Tenshi see COPYING for more details */ -void ddraw_common_take_screenshot(char *fn, IDirectDrawSurface7 *pDDSurface); +void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSurface); diff --git a/src/win-ddraw.cc b/src/win-ddraw.cc index 7842f16b6..509124205 100644 --- a/src/win-ddraw.cc +++ b/src/win-ddraw.cc @@ -9,18 +9,19 @@ #undef BITMAP #include "win-ddraw.h" #include "win-ddraw-screenshot.h" -#include "video.h" +#include "video/video.h" #include "win-cgapal.h" + extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); -extern "C" void device_force_redraw(); +extern "C" void device_force_redraw(void); extern "C" int ddraw_init(HWND h); -extern "C" void ddraw_close(); +extern "C" void ddraw_close(void); -extern "C" void video_blit_complete(); +extern "C" void video_blit_complete(void); static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h); static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h); @@ -96,7 +97,7 @@ int ddraw_init(HWND h) return 1; } -void ddraw_close() +void ddraw_close(void) { if (lpdds_back2) { @@ -311,7 +312,7 @@ static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h) } } -void ddraw_take_screenshot(char *fn) +void ddraw_take_screenshot(wchar_t *fn) { ddraw_common_take_screenshot(fn, lpdds_back2); } diff --git a/src/win-keyboard.cc b/src/win-keyboard.cc deleted file mode 100644 index 16381cd4c..000000000 --- a/src/win-keyboard.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright holders: Sarah Walker, Tenshi - see COPYING for more details -*/ -#define UNICODE -#include -#include -#include -#define BITMAP WINDOWS_BITMAP -#include -#undef BITMAP -#include "plat-keyboard.h" -#include "win.h" -#include "video.h" - -extern "C" int recv_key[272]; - -extern "C" void fatal(const char *format, ...); -extern "C" void pclog(const char *format, ...); - -extern "C" void keyboard_init(); -extern "C" void keyboard_close(); -extern "C" void keyboard_poll(); - -int recv_key[272]; - -void keyboard_init() -{ - atexit(keyboard_close); - - memset(recv_key, 0, sizeof(recv_key)); - pclog("Keyboard initialized!\n"); -} - -void keyboard_close() -{ -} - -void keyboard_poll_host() -{ -#if 0 - int c; - - for (c = 0; c < 272; c++) - recv_key[c] = rawinputkey[c]; - - if ((rawinputkey[0x1D] || rawinputkey[0x9D]) && - (rawinputkey[0x38] || rawinputkey[0xB8]) && - (rawinputkey[0x51] || rawinputkey[0xD1]) && - video_fullscreen) - leave_fullscreen(); - - if ((rawinputkey[0x1D] || rawinputkey[0x9D]) && -// (rawinputkey[0x38] || rawinputkey[0xB8]) && - (rawinputkey[0x57] || rawinputkey[0x57])) - { - pclog("Taking screenshot...\n"); - take_screenshot(); - } -#endif -} diff --git a/src/serial_bh.c b/src/win-serial.c similarity index 99% rename from src/serial_bh.c rename to src/win-serial.c index 23ec556e8..e49ebc09f 100644 --- a/src/serial_bh.c +++ b/src/win-serial.c @@ -12,7 +12,7 @@ * Windows and UNIX systems, with support for FTDI and Prolific * USB ports. Support for these has been removed. * - * Version: @(#)serial_bh.c 1.0.1 2017/04/14 + * Version: @(#)win-serial.c 1.0.2 2017/05/05 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. @@ -22,7 +22,7 @@ #include #include #define BHTTY_C -#include "serial_bh.h" +#include "win-serial.h" extern void pclog(char *__fmt, ...); diff --git a/src/serial_bh.h b/src/win-serial.h similarity index 96% rename from src/serial_bh.h rename to src/win-serial.h index a3f42a1ba..6c77fbe75 100644 --- a/src/serial_bh.h +++ b/src/win-serial.h @@ -8,7 +8,7 @@ * * Definitions for the Bottom Half of the SERIAL card. * - * Version: @(#)serial_bh.h 1.0.1 2017/04/14 + * Version: @(#)win-serial.h 1.0.2 2017/05/05 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. diff --git a/src/win-settings.c b/src/win-settings.c index 58229df82..035a554d5 100644 --- a/src/win-settings.c +++ b/src/win-settings.c @@ -8,35 +8,35 @@ #undef BITMAP #include - #include - -#include "nethandler.h" #include "ibm.h" -#include "ide.h" -#include "cdrom.h" -#include "cpu.h" +#include "mem.h" +#include "cpu/cpu.h" +#include "nvr.h" +#include "model.h" #include "device.h" -#include "scsi_buslogic.h" +#include "cdrom.h" #include "disc.h" #include "fdd.h" -#include "gameport.h" #include "hdd.h" -#include "mem.h" -#include "model.h" -#include "mouse.h" -#include "nvr.h" -#include "resource.h" +#include "ide.h" #include "scsi.h" -#include "sound.h" -#include "sound_dbopl.h" -#include "video.h" -#include "vid_voodoo.h" +#include "scsi_buslogic.h" +#include "network.h" +#include "sound/sound.h" +#include "sound/snd_dbopl.h" +#include "video/video.h" +#include "video/vid_voodoo.h" +#include "gameport.h" +#include "mouse.h" #include "win.h" #include "win-language.h" +#include "resource.h" + #define WM_SAVESETTINGS 0x8888 /* 86Box-specific message, used to tell the child dialog to save the currently specified settings. */ + /* Machine category */ int temp_model, temp_cpu_m, temp_cpu, temp_wait_states, temp_mem_size, temp_dynarec, temp_fpu, temp_sync; @@ -825,29 +825,26 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa default: str_id = 2139; break; - case 1: /* MS InPort Bus */ - str_id = 2177; - break; - case 2: /* PS2 2b */ - str_id = 2140; - break; - case 3: /* MS/logi bus 2b */ - str_id = 2161; - break; - case 4: /* PS2 intelli 3b */ + case 1: /* PS2 2b */ str_id = 2141; break; - case 5: /* Amstrad */ + case 2: /* PS2 intelli 3b */ str_id = 2142; break; - case 6: /* Olivetti M24 */ + case 3: /* MS/logi bus 2b */ str_id = 2143; break; - case 7: /* MouseSystems */ + case 4: /* Amstrad */ str_id = 2162; break; - case 8: /* Genius Bus */ - str_id = 2178; + case 5: /* Olivetti M24 */ + str_id = 2177; + break; + case 6: /* MouseSystems */ + str_id = 2140; + break; + case 7: /* Genius Bus */ + str_id = 2161; break; } diff --git a/src/win-status.c b/src/win-status.c index b907d6942..858a3646c 100644 --- a/src/win-status.c +++ b/src/win-status.c @@ -7,22 +7,24 @@ #undef BITMAP #include "ibm.h" +#include "mem.h" +#include "cpu/x86_ops.h" +#include "cpu/codegen.h" #include "device.h" -#include "video.h" #include "resource.h" #include "win.h" -#include "x86_ops.h" -#include "mem.h" -#include "codegen.h" + HWND status_hwnd; int status_is_open = 0; + extern int sreadlnum, swritelnum, segareads, segawrites, scycles_lost; extern uint64_t main_time; static uint64_t status_time; + static BOOL CALLBACK status_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char device_s[4096]; diff --git a/src/win-video.c b/src/win-video.c index dd6b3788f..15aec3785 100644 --- a/src/win-video.c +++ b/src/win-video.c @@ -4,11 +4,13 @@ #include #include #include -#include "video.h" +#include "video/video.h" #include "win-cgapal.h" + BITMAP *screen; + void hline(BITMAP *b, int x1, int y, int x2, uint32_t col) { if (y < 0 || y >= buffer->h) diff --git a/src/win.c b/src/win.c index ac112aed4..ee792c5d8 100644 --- a/src/win.c +++ b/src/win.c @@ -10,9 +10,7 @@ #include #include - #include - #include #include #include @@ -24,29 +22,26 @@ #include "fdd.h" #include "hdd.h" #include "ibm.h" +#include "cpu/cpu.h" +#include "mem.h" +#include "rom.h" +#include "nvr.h" +#include "thread.h" +#include "config.h" +#include "model.h" #include "ide.h" +#include "cdrom.h" #include "cdrom-null.h" #include "cdrom-ioctl.h" #include "cdrom-iso.h" -#include "config.h" -#include "video.h" -#include "resource.h" -#include "cpu.h" -#include "cdrom.h" -#include "mem.h" -#include "model.h" -#include "mouse.h" -#include "nethandler.h" -#include "nvr.h" -#include "sound.h" -#include "sound_dbopl.h" -#include "thread.h" -#include "rom.h" -#include "vid_ega.h" - +#include "video/video.h" +#include "video/vid_ega.h" +#include "plat-keyboard.h" #include "plat-mouse.h" #include "plat-midi.h" -#include "plat-keyboard.h" +#include "mouse.h" +#include "sound/sound.h" +#include "sound/snd_dbopl.h" #include "win.h" #include "win-ddraw.h" @@ -54,6 +49,8 @@ #include "win-d3d.h" #include "win-d3d-fs.h" #include "win-language.h" +#include "resource.h" + #ifndef MAPVK_VK_TO_VSC #define MAPVK_VK_TO_VSC 0 @@ -1087,6 +1084,8 @@ void win_menu_update() #endif } +int recv_key[272]; + int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, @@ -1101,6 +1100,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, LARGE_INTEGER qpc_freq; HACCEL haccel; /* Handle to accelerator table */ + memset(recv_key, 0, sizeof(recv_key)); + process_command_line(); win_language_load_common_strings(); diff --git a/src/xtide.c b/src/xtide.c index db6f1dca3..ce827151b 100644 --- a/src/xtide.c +++ b/src/xtide.c @@ -1,20 +1,20 @@ #include - #include "ibm.h" - -#include "device.h" #include "io.h" -#include "ide.h" #include "mem.h" #include "rom.h" +#include "device.h" +#include "ide.h" #include "xtide.h" + typedef struct xtide_t { uint8_t data_high; rom_t bios_rom; } xtide_t; + static void xtide_write(uint16_t port, uint8_t val, void *p) { xtide_t *xtide = (xtide_t *)p; @@ -40,6 +40,7 @@ static void xtide_write(uint16_t port, uint8_t val, void *p) } } + static uint8_t xtide_read(uint16_t port, void *p) { xtide_t *xtide = (xtide_t *)p; @@ -67,7 +68,8 @@ static uint8_t xtide_read(uint16_t port, void *p) } } -static void *xtide_init() + +static void *xtide_init(void) { xtide_t *xtide = malloc(sizeof(xtide_t)); memset(xtide, 0, sizeof(xtide_t)); @@ -81,7 +83,8 @@ static void *xtide_init() return xtide; } -static void *xtide_at_init() + +static void *xtide_at_init(void) { xtide_t *xtide = malloc(sizeof(xtide_t)); memset(xtide, 0, sizeof(xtide_t)); @@ -92,7 +95,8 @@ static void *xtide_at_init() return xtide; } -static void *xtide_ps2_init() + +static void *xtide_ps2_init(void) { xtide_t *xtide = malloc(sizeof(xtide_t)); memset(xtide, 0, sizeof(xtide_t)); @@ -106,7 +110,8 @@ static void *xtide_ps2_init() return xtide; } -static void *xtide_at_ps2_init() + +static void *xtide_at_ps2_init(void) { xtide_t *xtide = malloc(sizeof(xtide_t)); memset(xtide, 0, sizeof(xtide_t)); @@ -117,6 +122,7 @@ static void *xtide_at_ps2_init() return xtide; } + static void xtide_close(void *p) { xtide_t *xtide = (xtide_t *)p; @@ -124,26 +130,31 @@ static void xtide_close(void *p) free(xtide); } -static int xtide_available() + +static int xtide_available(void) { return rom_present(L"roms/ide_xt.bin"); } -static int xtide_at_available() + +static int xtide_at_available(void) { return rom_present(L"roms/ide_at.bin"); } -static int xtide_ps2_available() + +static int xtide_ps2_available(void) { return rom_present(L"roms/SIDE1V12.BIN"); } -static int xtide_at_ps2_available() + +static int xtide_at_ps2_available(void) { return rom_present(L"roms/ide_at_1_1_5.bin"); } + device_t xtide_device = { "XTIDE",