├── src ├── interface │ └── win32 │ │ ├── hard86_win32 │ │ ├── src │ │ │ ├── test │ │ │ │ ├── test │ │ │ │ ├── test.com │ │ │ │ ├── test.fas │ │ │ │ ├── test.h86 │ │ │ │ ├── project.h86 │ │ │ │ ├── test.asm_ │ │ │ │ └── test.asm │ │ │ ├── examples │ │ │ │ ├── lcd_screen │ │ │ │ │ ├── lcd_screen.asm │ │ │ │ │ ├── DosCom.com │ │ │ │ │ ├── lcd_screen.h86 │ │ │ │ │ ├── DOSCom.wap │ │ │ │ │ └── COMBuild16.bat │ │ │ │ ├── fib │ │ │ │ │ ├── DosCom.com │ │ │ │ │ ├── fib.h86 │ │ │ │ │ ├── DOSCom.wap │ │ │ │ │ ├── COMBuild16.bat │ │ │ │ │ └── DosCom.asm │ │ │ │ ├── kb_input │ │ │ │ │ ├── kb_input.com │ │ │ │ │ ├── kb_input.h86 │ │ │ │ │ └── kb_input.asm │ │ │ │ ├── led_board │ │ │ │ │ ├── led_board.com │ │ │ │ │ ├── led_board.asm │ │ │ │ │ └── led_board.h86 │ │ │ │ └── hello_world │ │ │ │ │ ├── hello_world.com │ │ │ │ │ ├── hello_world.asm │ │ │ │ │ └── hello_world.h86 │ │ │ ├── vdev │ │ │ │ ├── lcd_screen │ │ │ │ │ ├── kb_video.opensdf │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── kb_video.aps │ │ │ │ │ ├── lcd_screen.aps │ │ │ │ │ ├── lcd_screen.rc │ │ │ │ │ ├── stdafx.cpp │ │ │ │ │ ├── targetver.h │ │ │ │ │ ├── stdafx.h │ │ │ │ │ ├── dllmain.cpp │ │ │ │ │ ├── lcd_screen.sln │ │ │ │ │ └── kb_video.vcxproj.filters │ │ │ │ ├── 8bit_led │ │ │ │ │ ├── on1.bmp │ │ │ │ │ ├── bitmap1.bmp │ │ │ │ │ ├── kb_video.rc │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── kb_video.aps │ │ │ │ │ ├── stdafx.cpp │ │ │ │ │ ├── targetver.h │ │ │ │ │ ├── stdafx.h │ │ │ │ │ ├── dllmain.cpp │ │ │ │ │ ├── 8bit_led.sln │ │ │ │ │ └── kb_video.vcxproj.filters │ │ │ │ ├── kb_video │ │ │ │ │ ├── kb_video.rc │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── kb_video.aps │ │ │ │ │ ├── stdafx.cpp │ │ │ │ │ ├── targetver.h │ │ │ │ │ ├── stdafx.h │ │ │ │ │ ├── dllmain.cpp │ │ │ │ │ ├── kb_video.sln │ │ │ │ │ └── kb_video.vcxproj.filters │ │ │ │ └── io_port_watcher │ │ │ │ │ └── io_port_watcher │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── io_port_watcher.rc │ │ │ │ │ ├── io_port_watcher.aps │ │ │ │ │ ├── stdafx.cpp │ │ │ │ │ ├── targetver.h │ │ │ │ │ ├── dllmain.cpp │ │ │ │ │ ├── stdafx.h │ │ │ │ │ ├── io_port_watcher.sln │ │ │ │ │ ├── io_port_watcher.vcxproj.filters │ │ │ │ │ └── io_port_watcher.cpp │ │ │ ├── bios │ │ │ │ └── h86bios.bin │ │ │ ├── resource │ │ │ │ ├── appicon.ico │ │ │ │ ├── resource.h │ │ │ │ ├── resource.rc │ │ │ │ ├── resource.aps │ │ │ │ └── toolbar1.bmp │ │ │ ├── objwin32_gui_static.cpp │ │ │ ├── hard86.ini │ │ │ ├── windows │ │ │ │ ├── toolwindow.cpp │ │ │ │ ├── toolwindow.h │ │ │ │ ├── statusbar.h │ │ │ │ ├── bp_list.h │ │ │ │ ├── stack_watcher.h │ │ │ │ ├── winmanager.cpp │ │ │ │ ├── mem_watcher.h │ │ │ │ ├── dasmview.h │ │ │ │ └── statusbar.cpp │ │ │ ├── frontend_global.cpp │ │ │ ├── global.h │ │ │ ├── winmain.cpp │ │ │ └── application.h │ │ └── vs2010 │ │ │ └── hard86_win32 │ │ │ ├── hard86_win32.aps │ │ │ ├── application.manifest │ │ │ ├── hard86_win32.sln │ │ │ └── hard86_win32_vs2013.sln │ │ └── objwin32 │ │ ├── src │ │ ├── gui │ │ │ ├── userwindow.cpp │ │ │ ├── common_control.cpp │ │ │ ├── editbox.cpp │ │ │ ├── scrollbar.cpp │ │ │ ├── listbox.cpp │ │ │ ├── frame.h │ │ │ ├── editbox.h │ │ │ ├── scrollbar.h │ │ │ ├── common_control.h │ │ │ ├── frame.cpp │ │ │ ├── button.cpp │ │ │ ├── userwindow.h │ │ │ ├── static.cpp │ │ │ ├── dialog.cpp │ │ │ ├── listbox.h │ │ │ ├── global.h │ │ │ ├── static.h │ │ │ ├── main.cpp │ │ │ ├── global.cpp │ │ │ ├── dialog.h │ │ │ ├── button.h │ │ │ ├── progressbar.h │ │ │ └── window.cpp │ │ └── file │ │ │ ├── main.1.cpp │ │ │ └── main.cpp │ │ └── vs2010 │ │ └── win32_generic_unit │ │ ├── win32_generic_unit │ │ ├── resource.h │ │ ├── bitmap1.1.bmp │ │ ├── bitmap1.bmp │ │ ├── resource.1.h │ │ ├── resource.1.rc │ │ ├── resource.aps │ │ ├── resource.rc │ │ ├── resource1.1.h │ │ ├── resource1.h │ │ └── resource.1.aps │ │ ├── win32_file_lib │ │ ├── win32_file_lib.vcxproj.filters │ │ └── win32_file_lib.vcxproj.1.filters │ │ ├── win32_generic_unit.1.sln │ │ └── win32_generic_unit.sln ├── lib │ ├── inih │ │ ├── tests │ │ │ ├── bad_multi.ini │ │ │ ├── bad_comment.ini │ │ │ ├── bom.ini │ │ │ ├── user_error.ini │ │ │ ├── bad_section.ini │ │ │ ├── unittest.bat │ │ │ ├── multi_line.ini │ │ │ ├── normal.ini │ │ │ └── unittest.c │ │ ├── examples │ │ │ ├── config.def │ │ │ ├── test.ini │ │ │ ├── ini_dump.c │ │ │ ├── ini_example.c │ │ │ └── ini_xmacros.c │ │ ├── extra │ │ │ └── Makefile.static │ │ ├── cpp │ │ │ ├── INIReaderTest.cpp │ │ │ ├── INIReader.h │ │ │ └── INIReader.cpp │ │ └── ini.h │ ├── rapidxml │ │ ├── test │ │ │ ├── test.xml │ │ │ └── main.cpp │ │ └── license.txt │ └── stickywindows │ │ └── StickyDragManager.h ├── emulator │ ├── emulator_unit │ │ ├── src │ │ │ ├── test │ │ │ │ ├── test.com │ │ │ │ ├── test.fas │ │ │ │ ├── test.asm │ │ │ │ └── test.asm_ │ │ │ └── bios │ │ │ │ └── h86bios.bin │ │ └── vs2010 │ │ │ └── hard86_emulator_unit │ │ │ └── hard86_emulator_unit.sln │ ├── symbols_loader │ │ ├── src │ │ │ └── main.cpp │ │ └── vs2013 │ │ │ └── symbols_loader │ │ │ ├── symbols_loader.sln │ │ │ └── symbols_loader.vcxproj.filters │ ├── debugger_engine │ │ ├── vs2013 │ │ │ └── debugger_engine │ │ │ │ └── debugger_engine.sln │ │ └── src │ │ │ ├── device_test │ │ │ ├── device_test.h │ │ │ └── device_test.cpp │ │ │ └── main.cpp │ └── emulator_engine │ │ └── src │ │ ├── main.c │ │ ├── global.h │ │ ├── global.c │ │ ├── dasm │ │ └── dasm.h │ │ └── flags.h ├── system │ ├── multithreading │ │ ├── event │ │ │ ├── c │ │ │ │ ├── main.c │ │ │ │ ├── event.depend │ │ │ │ ├── event.layout │ │ │ │ ├── event.h │ │ │ │ ├── event.c │ │ │ │ └── event.cbp │ │ │ └── cpp │ │ │ │ ├── main.cpp │ │ │ │ ├── event.depend │ │ │ │ ├── event.layout │ │ │ │ ├── event.h │ │ │ │ ├── event.cbp │ │ │ │ └── event.cpp │ │ ├── thread │ │ │ ├── c │ │ │ │ ├── thread.depend │ │ │ │ ├── main.c │ │ │ │ ├── thread.layout │ │ │ │ ├── thread.h │ │ │ │ ├── thread.cbp │ │ │ │ └── thread.c │ │ │ └── cpp │ │ │ │ ├── main.cpp │ │ │ │ ├── thread.layout │ │ │ │ ├── thread.depend │ │ │ │ ├── thread.h │ │ │ │ ├── thread.cpp │ │ │ │ └── thread.cbp │ │ └── mutex │ │ │ ├── cpp │ │ │ ├── main.cpp │ │ │ ├── mutex.layout │ │ │ ├── mutex.depend │ │ │ ├── mutex.h │ │ │ ├── mutex.cbp │ │ │ └── mutex.cpp │ │ │ └── c │ │ │ ├── cmutex.h │ │ │ ├── mutex.layout │ │ │ ├── cmutex.c │ │ │ ├── main.c │ │ │ └── mutex.depend │ └── datastruct │ │ └── clist │ │ ├── clist.h │ │ ├── clist.cbp │ │ └── clist.c ├── ext_itoa │ ├── test.cpp │ └── ext_itoa.h └── global │ ├── typedefs.h │ └── defines.h ├── clean-repo.bat ├── .gitignore ├── README.md └── .gitattributes /src/interface/win32/hard86_win32/src/test/test: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/lib/inih/tests/bad_multi.ini: -------------------------------------------------------------------------------- 1 | indented 2 | -------------------------------------------------------------------------------- /src/lib/inih/tests/bad_comment.ini: -------------------------------------------------------------------------------- 1 | This is an error 2 | -------------------------------------------------------------------------------- /src/lib/inih/tests/bom.ini: -------------------------------------------------------------------------------- 1 | [bom_section] 2 | bom_name=bom_value 3 | key“ = value“ 4 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/lcd_screen/lcd_screen.asm: -------------------------------------------------------------------------------- 1 | .486 2 | 3 | 4 | end -------------------------------------------------------------------------------- /src/lib/inih/tests/user_error.ini: -------------------------------------------------------------------------------- 1 | [section] 2 | a = b 3 | user = parse_error 4 | c = d 5 | -------------------------------------------------------------------------------- /src/lib/rapidxml/test/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/kb_video.opensdf: -------------------------------------------------------------------------------- 1 | StephenSTEPHEN-PC -------------------------------------------------------------------------------- /src/lib/inih/tests/bad_section.ini: -------------------------------------------------------------------------------- 1 | [section1] 2 | name1=value1 3 | [section2 4 | [section3 ; comment ] 5 | name2=value2 6 | -------------------------------------------------------------------------------- /src/emulator/emulator_unit/src/test/test.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/emulator/emulator_unit/src/test/test.com -------------------------------------------------------------------------------- /src/emulator/emulator_unit/src/test/test.fas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/emulator/emulator_unit/src/test/test.fas -------------------------------------------------------------------------------- /src/emulator/emulator_unit/src/bios/h86bios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/emulator/emulator_unit/src/bios/h86bios.bin -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/test/test.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/test/test.com -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/test/test.fas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/test/test.fas -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/userwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "userwindow.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/bios/h86bios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/bios/h86bios.bin -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/resource/appicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/resource/appicon.ico -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/resource/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/resource/resource.h -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/resource/resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/resource/resource.rc -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/resource/resource.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/resource/resource.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/resource/toolbar1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/resource/toolbar1.bmp -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/on1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/8bit_led/on1.bmp -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/fib/DosCom.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/examples/fib/DosCom.com -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/bitmap1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/8bit_led/bitmap1.bmp -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/kb_video.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/8bit_led/kb_video.rc -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/8bit_led/resource.h -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.rc -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/kb_video/resource.h -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/kb_video.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/8bit_led/kb_video.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/lcd_screen/resource.h -------------------------------------------------------------------------------- /src/system/multithreading/event/c/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "event.h" 5 | 6 | int main() 7 | { 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/kb_input/kb_input.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/examples/kb_input/kb_input.com -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/lcd_screen/DosCom.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/examples/lcd_screen/DosCom.com -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/kb_video.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/lcd_screen/kb_video.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/lcd_screen.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/lcd_screen/lcd_screen.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/lcd_screen.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/lcd_screen/lcd_screen.rc -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/led_board/led_board.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/examples/led_board/led_board.com -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/vs2010/hard86_win32/hard86_win32.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/vs2010/hard86_win32/hard86_win32.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/hello_world/hello_world.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/examples/hello_world/hello_world.com -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/common_control.cpp: -------------------------------------------------------------------------------- 1 | #include "common_control.h" 2 | #include 3 | 4 | namespace nsObjWin32{ 5 | 6 | namespace nsGUI{ 7 | 8 | } 9 | 10 | } -------------------------------------------------------------------------------- /src/ext_itoa/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ext_itoa.h" 3 | 4 | using namespace std; 5 | 6 | int main(){ 7 | wcout << ext_itow(1, 16, 4) << endl; 8 | 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/lib/inih/examples/config.def: -------------------------------------------------------------------------------- 1 | // CFG(section, name, default) 2 | 3 | CFG(protocol, version, "0") 4 | 5 | CFG(user, name, "Fatty Lumpkin") 6 | CFG(user, email, "fatty@lumpkin.com") 7 | 8 | #undef CFG 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/resource.h -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.h -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/bitmap1.1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/bitmap1.1.bmp -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/bitmap1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/bitmap1.bmp -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.h -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.rc -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.aps -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.rc -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource1.1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource1.1.h -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource1.h -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit/resource.1.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.rc -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsteve/hard86/HEAD/src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.aps -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/led_board/led_board.asm: -------------------------------------------------------------------------------- 1 | org 100h 2 | 3 | ; LED board data port is 0x40 4 | 5 | xor ax, ax 6 | @@cont: 7 | inc al 8 | out 0x40, al 9 | cmp ax, 0xff 10 | jne @@cont 11 | 12 | int 20h ; return to system -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/fib/fib.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/lib/inih/tests/unittest.bat: -------------------------------------------------------------------------------- 1 | @call tcc ..\ini.c -I..\ -run unittest.c > baseline_multi.txt 2 | @call tcc ..\ini.c -I..\ -DINI_ALLOW_MULTILINE=0 -run unittest.c > baseline_single.txt 3 | @call tcc ..\ini.c -I..\ -DINI_STOP_ON_FIRST_ERROR=1 -run unittest.c > baseline_stop_on_first_error.txt 4 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/objwin32_gui_static.cpp: -------------------------------------------------------------------------------- 1 | /* Required because __declspec(dllexport) wants local definitions of 2 | static class data members 3 | */ 4 | 5 | #include "../../objwin32/src/gui/window.h" 6 | #include "../../objwin32/src/gui/userwindow.h" 7 | 8 | HINSTANCE nsObjWin32::nsGUI::Window::m_hInstance=NULL; -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "event.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | Event myEvent(false); 9 | cout << myEvent.TryWaitFor() << endl; 10 | myEvent.Set(); 11 | cout << myEvent.TryWaitFor() << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /clean-repo.bat: -------------------------------------------------------------------------------- 1 | echo "Cleaning repository" 2 | cd src 3 | del /S *.exe 4 | del /S *.txt 5 | del /S *.ncb 6 | del /S *.sdf 7 | del /S *.ipch 8 | del /S *.tlog 9 | del /S *.obj 10 | del /S *.res 11 | del /S *.pdb 12 | del /S *.idb 13 | del /S *.log 14 | del /S *.lastbuildstate 15 | del /S *.cache 16 | del /S *.o 17 | del /S *.ilk 18 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/thread.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1393752694 source:c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\c\thread.c 3 | 4 | "thread.h" 5 | 6 | 1393752672 c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\c\thread.h 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/hello_world/hello_world.asm: -------------------------------------------------------------------------------- 1 | org 100h 2 | 3 | jmp start 4 | msg1 db "Hello World!" 5 | start: 6 | mov al, 1 7 | mov bh, 0 8 | mov bl, 0eh 9 | mov cx, start - msg1 10 | mov dl, 0 11 | mov dh, 0 12 | push cs 13 | pop es 14 | mov bp, msg1 15 | mov ah, 13h 16 | int 10h 17 | 18 | int 20h -------------------------------------------------------------------------------- /src/lib/inih/tests/multi_line.ini: -------------------------------------------------------------------------------- 1 | [section1] 2 | single1 = abc 3 | multi = this is a 4 | multi-line value 5 | single2 = xyz 6 | [section2] 7 | multi = a 8 | b 9 | c 10 | [section3] 11 | single: ghi 12 | multi: the quick 13 | brown fox 14 | name = bob smith ; comment line 1 15 | ; comment line 2 16 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/test/test.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/editbox.cpp: -------------------------------------------------------------------------------- 1 | #include "editbox.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | HWND EditBox::Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID) 8 | { 9 | return Window::Create(m_exStyle, lpName, m_style, x, y, w, h, hwndParent, (HMENU)ID); 10 | } 11 | 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/scrollbar.cpp: -------------------------------------------------------------------------------- 1 | #include "scrollbar.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | HWND ScrollBar::Create(int x, int y, int w, int h, HWND hwndParent, int ID, int range, int pos){ 8 | return Window::Create(m_exStyle, L"", m_style, x, y, w, h, hwndParent, (HMENU)ID); 9 | } 10 | 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/kb_input/kb_input.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/led_board/led_board.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // kb_video.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // kb_video.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // kb_video.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/lcd_screen/lcd_screen.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/listbox.cpp: -------------------------------------------------------------------------------- 1 | #include "listbox.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | HWND ListBox::Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID){ 8 | Window::Create(m_exStyle, lpName, m_style, x, y, w, h, hwndParent, (HMENU)ID); 9 | Show(); 10 | return m_hWnd; 11 | } 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "mutex.h" 6 | 7 | using namespace std; 8 | 9 | int main(){ 10 | Mutex mutex; 11 | cout << mutex.Lock() << endl; 12 | cout << mutex.Unlock() << endl; 13 | cout << mutex.Unlock() << endl; 14 | cout << mutex.Lock() << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // io_port_watcher.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/global/typedefs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file global typedefs 3 | * Stephen Zhang, 2014 4 | */ 5 | 6 | #ifndef TYPEDEFS_H 7 | #define TYPEDEFS_H 8 | 9 | typedef long int32; 10 | typedef unsigned long uint32; 11 | typedef short int16; 12 | typedef unsigned short uint16; 13 | typedef char int8; 14 | typedef unsigned char uint8; 15 | 16 | typedef unsigned long long uint64; 17 | typedef long long int64; 18 | 19 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/hello_world/hello_world.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/lib/inih/examples/test.ini: -------------------------------------------------------------------------------- 1 | ; Test config file for ini_example.c and INIReaderTest.cpp 2 | 3 | [protocol] ; Protocol configuration 4 | version=6 ; IPv6 5 | 6 | [user] 7 | name = Bob Smith ; Spaces around '=' are stripped 8 | email = bob@smith.com ; And comments (like this) ignored 9 | active = true ; Test a boolean 10 | pi = 3.14159 ; Test a floating point number 11 | -------------------------------------------------------------------------------- /src/lib/inih/extra/Makefile.static: -------------------------------------------------------------------------------- 1 | # Simple makefile to build inih as a static library using g++ 2 | 3 | SRC = ../ini.c 4 | OBJ = $(SRC:.c=.o) 5 | OUT = libinih.a 6 | INCLUDES = -I.. 7 | CCFLAGS = -g -O2 8 | CC = g++ 9 | 10 | default: $(OUT) 11 | 12 | .c.o: 13 | $(CC) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@ 14 | 15 | $(OUT): $(OBJ) 16 | ar rcs $(OUT) $(OBJ) $(EXTRAARFLAGS) 17 | 18 | clean: 19 | rm -f $(OBJ) $(OUT) 20 | -------------------------------------------------------------------------------- /src/emulator/emulator_unit/src/test/test.asm: -------------------------------------------------------------------------------- 1 | org 100h 2 | 3 | jmp start 4 | 5 | ; computes n! 6 | factorial: 7 | cmp ax, 1 8 | jz @@r 9 | push ax 10 | dec ax 11 | call factorial 12 | mov bx, ax 13 | pop ax 14 | mul bx 15 | @@r: 16 | ret 17 | 18 | 19 | start: 20 | ; parameter : ax = n 21 | ; calculate 5! 22 | mov cx, 1 23 | mov ah, 9h 24 | mov al, 'a' 25 | int 10h 26 | mov ax, 100 27 | call factorial 28 | ret -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "thread.h" 4 | 5 | using namespace std; 6 | 7 | DWORD WINAPI PrintLine(LPVOID lpParam){ 8 | for(int i=0; i<20; i++){ 9 | cout << "a"; 10 | } 11 | cout << endl; 12 | return 0; 13 | } 14 | 15 | int main() 16 | { 17 | Thread myThread(&PrintLine, 0); 18 | myThread.Start(); 19 | _getch(); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/fib/DOSCom.wap: -------------------------------------------------------------------------------- 1 | [PROJECT] 2 | Type=6 3 | ReleaseCommandLine= 4 | DebugCommandLine= 5 | AutoIncFileVersion=0 6 | RCSilent=0 7 | PellesTools=0 8 | 9 | [MAKE] 10 | CompileRC= 11 | RCToObj= 12 | Assemble=/c 13 | Link=/tiny 14 | Out= 15 | ActiveBuild=0 16 | DebAssemble= 17 | DebLink= 18 | DebOut= 19 | 20 | 21 | [FILES] 22 | 1=DosCom.asm 23 | [SHOWFILE] 24 | 1=1900000019000000900100006E00000000000000030000000000000034 25 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/hard86.ini: -------------------------------------------------------------------------------- 1 | ; Hard86 Config File 2 | 3 | [colors] 4 | 5 | ; general 6 | 7 | sel_color = 0x007ACC 8 | inactive_sel_color = 0xaaaaaa 9 | bk_color = 0xffffff 10 | 11 | ; codelist 12 | codelist_item_color = 0xffffff 13 | codelist_currentline_color = 0x009900 14 | 15 | [paths] 16 | 17 | bios_path = bios/h86bios.bin 18 | 19 | [numbers] 20 | animate_speed = 0 21 | step_into_extern_int = 0 22 | step_into_int = 0 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | *.dll 10 | *.lib 11 | *.exp 12 | 13 | # Compiled Static libraries 14 | *.lai 15 | *.la 16 | *.a 17 | 18 | # Visual Studio 19 | *.ncb 20 | *.sdf 21 | *.ipch 22 | *.user 23 | *.tlog 24 | *.obj 25 | *.res 26 | *.pdb 27 | *.idb 28 | *.log 29 | *.lastbuildstate 30 | *.cache 31 | *.suo 32 | *.svlMVSymbolCache2 33 | 34 | # Compiled Executables 35 | *.exe -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/lcd_screen/DOSCom.wap: -------------------------------------------------------------------------------- 1 | [PROJECT] 2 | Type=6 3 | ReleaseCommandLine= 4 | DebugCommandLine= 5 | AutoIncFileVersion=0 6 | RCSilent=0 7 | PellesTools=0 8 | 9 | [MAKE] 10 | CompileRC= 11 | RCToObj= 12 | Assemble=/c 13 | Link=/tiny 14 | Out= 15 | ActiveBuild=0 16 | DebAssemble= 17 | DebLink= 18 | DebOut= 19 | 20 | 21 | [FILES] 22 | 1=DosCom.asm 23 | [SHOWFILE] 24 | 1=0000000000000000EE03000003020000000000000300000000000000F9 25 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/test/project.h86: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "thread.h" 7 | 8 | DWORD WINAPI PrintStuff(LPVOID param){ 9 | printf("hello world!"); 10 | return 0; 11 | } 12 | 13 | int main() 14 | { 15 | THREAD thread; 16 | thread_create(&PrintStuff, NULL, &thread); 17 | thread_start(&thread); 18 | 19 | _getch(); 20 | thread_close(&thread); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /src/system/multithreading/event/c/event.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1189872156 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\c\main.c 3 | 4 | 5 | 6 | 1394269781 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\c\event.c 7 | 8 | "event.h" 9 | 10 | 1394269772 g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\c\event.h 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/kb_input/kb_input.asm: -------------------------------------------------------------------------------- 1 | org 100h 2 | 3 | jmp start 4 | 5 | in_buf db 40 dup(0) 6 | 7 | start: 8 | lea di, [in_buf] 9 | mov bx, 0 10 | @@cont: 11 | xor ah, ah 12 | int 16h 13 | cmp al, 0dh 14 | je @@stop 15 | mov [di+bx], al 16 | mov ah, 09h 17 | xor bh, bh 18 | mov bl, 0fh 19 | mov cx, 1 20 | int 10h 21 | 22 | mov ah, 3h 23 | int 10h 24 | 25 | inc dl 26 | 27 | mov ah, 2h 28 | int 10h 29 | 30 | inc bx 31 | cmp bx, 40 32 | jne @@cont 33 | @@stop: 34 | 35 | int 20h -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/event.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1394269092 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\cpp\event\main.cpp 3 | 4 | "event.h" 5 | 6 | 1394269134 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\cpp\event\event.cpp 7 | 8 | "event.h" 9 | 10 | 1394269149 g:\code\projects\repositories\hard86\hard86\src\system\multithreading\event\cpp\event\event.h 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/system/multithreading/event/c/event.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/thread.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/fib/COMBuild16.bat: -------------------------------------------------------------------------------- 1 | : This batch file is an example of how to assemble and link at the dos prompt. 2 | : It is not required. You can assemble and link from within WinAsm Studio. 3 | : To link, you must use a 16-bit linker, such as the one in the archive at 4 | : this URL- http://win32assembly.online.fr/files/Lnk563.exe 5 | : Rename the Link.exe file to Link16.exe and copy it into the \masm32\bin folder. 6 | 7 | \masm32\bin\ml /c DosCom.asm 8 | \masm32\bin\link16 /tiny DosCom.obj; 9 | 10 | pause -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/event.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/mutex.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/lcd_screen/COMBuild16.bat: -------------------------------------------------------------------------------- 1 | : This batch file is an example of how to assemble and link at the dos prompt. 2 | : It is not required. You can assemble and link from within WinAsm Studio. 3 | : To link, you must use a 16-bit linker, such as the one in the archive at 4 | : this URL- http://win32assembly.online.fr/files/Lnk563.exe 5 | : Rename the Link.exe file to Link16.exe and copy it into the \masm32\bin folder. 6 | 7 | \masm32\bin\ml /c DosCom.asm 8 | \masm32\bin\link16 /tiny DosCom.obj; 9 | 10 | pause -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/thread.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/frame.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAME_H 2 | #define FRAME_H 3 | 4 | #include 5 | #include "userwindow.h" 6 | 7 | namespace nsObjWin32{ 8 | 9 | namespace nsGUI{ 10 | 11 | class DLLEXPORT Frame : public UserWindow{ 12 | 13 | public: 14 | 15 | Frame(){ 16 | m_className=L"Frame_Class"; 17 | m_style|=WS_OVERLAPPEDWINDOW; 18 | } 19 | 20 | virtual ~Frame(){} 21 | 22 | virtual HWND Create(int w, int h, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT); 23 | 24 | ATOM Register(); 25 | 26 | protected: 27 | }; 28 | 29 | } 30 | 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | #include "../vdev.h" 18 | #include "resource.h" 19 | 20 | //#define BUILD_EXE -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | #include "../vdev.h" 18 | #include "resource.h" 19 | 20 | //#define BUILD_EXE -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | #include "../vdev.h" 18 | #include "resource.h" 19 | 20 | //#define BUILD_EXE -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | HINSTANCE hModule; 5 | 6 | BOOL APIENTRY DllMain( HMODULE hModule, 7 | DWORD ul_reason_for_call, 8 | LPVOID lpReserved 9 | ) 10 | { 11 | ::hModule=hModule; 12 | switch (ul_reason_for_call) 13 | { 14 | case DLL_PROCESS_ATTACH: 15 | case DLL_THREAD_ATTACH: 16 | case DLL_THREAD_DETACH: 17 | case DLL_PROCESS_DETACH: 18 | break; 19 | } 20 | return TRUE; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/system/multithreading/event/c/event.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C event functions 3 | * C event functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef EVENT_C_H 8 | #define EVENT_C_H 9 | 10 | #include 11 | #include "../../../../global/defines.h" 12 | #include "../../../../global/typedefs.h" 13 | 14 | typedef void* EVENT; 15 | 16 | EVENT event_create(int initial_state, int manual_reset); 17 | int event_set(EVENT event); 18 | int event_reset(EVENT event); 19 | int event_waitfor(EVENT event); 20 | int event_try_waitfor(EVENT event); 21 | int event_close(EVENT event); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | // TODO: reference additional headers your program requires here 15 | #include "../../vdev.h" 16 | #include "resource.h" 17 | 18 | extern HINSTANCE hModule; -------------------------------------------------------------------------------- /src/system/multithreading/mutex/c/cmutex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C mutex functions 3 | * C MUTEX functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef MUTEX_C_H 8 | #define MUTEX_C_H 9 | 10 | #ifdef __cplusplus 11 | extern "C"{ 12 | #endif 13 | 14 | #include "../../../../global/defines.h" 15 | #include "../../../../global/typedefs.h" 16 | 17 | typedef void* MUTEX; 18 | 19 | MUTEX mutex_create(); 20 | 21 | int mutex_lock(MUTEX mutex); 22 | 23 | int mutex_trylock(MUTEX mutex); 24 | 25 | int mutex_unlock(MUTEX mutex); 26 | 27 | int mutex_close(MUTEX mutex); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/editbox.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITBOX_H 2 | #define EDITBOX_H 3 | 4 | #include 5 | #include "common_control.h" 6 | 7 | namespace nsObjWin32{ 8 | 9 | namespace nsGUI{ 10 | 11 | class DLLEXPORT EditBox : public CommonControl{ 12 | public: 13 | EditBox(){ 14 | m_className=L"EDIT"; 15 | m_style|=ES_LEFT; 16 | m_exStyle|=WS_EX_CLIENTEDGE; 17 | } 18 | 19 | virtual ~EditBox(){ 20 | 21 | } 22 | 23 | HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID); 24 | 25 | static const int DEF_H=20; 26 | static const int DEF_W=84; 27 | private: 28 | 29 | }; 30 | 31 | } 32 | 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/event.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ event functions 3 | * C++ event functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef EVENT_H 8 | #define EVENT_H 9 | 10 | #include 11 | 12 | class Event{ 13 | public: 14 | Event(bool initialState=false); 15 | Event(bool initialState, bool manualReset); 16 | 17 | Event(const Event& src); 18 | 19 | virtual ~Event(); 20 | 21 | Event& operator=(const Event& src); 22 | 23 | bool Set(); 24 | bool Reset(); 25 | bool WaitFor(); 26 | bool TryWaitFor(); 27 | protected: 28 | HANDLE m_hEvent; 29 | 30 | int* m_nInstances; 31 | private: 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/lib/inih/tests/normal.ini: -------------------------------------------------------------------------------- 1 | ; This is an INI file 2 | [section1] ; section comment 3 | one=This is a test ; name=value comment 4 | two = 1234 5 | ; x=y 6 | 7 | [ section 2 ] 8 | happy = 4 9 | sad = 10 | 11 | [empty] 12 | ; do nothing 13 | 14 | [comment_test] 15 | test1 = 1;2;3 ; only this will be a comment 16 | test2 = 2;3;4;this won't be a comment, needs whitespace before ';' 17 | test;3 = 345 ; key should be "test;3" 18 | test4 = 4#5#6 ; '#' only starts a comment at start of line 19 | #test5 = 567 ; entire line commented 20 | # test6 = 678 ; entire line commented, except in MULTILINE mode 21 | 22 | [colon_tests] 23 | Content-Type: text/html 24 | foo:bar 25 | adams : 42 26 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/mutex.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1394265336 source:g:\code\projects\repositories\hard86\hard86\src\system\mutex\cpp\mutex.cpp 3 | 4 | "mutex.h" 5 | 6 | 1394254904 g:\code\projects\repositories\hard86\hard86\src\system\mutex\cpp\mutex.h 7 | 8 | 9 | 1394265340 source:g:\code\projects\repositories\hard86\hard86\src\system\mutex\cpp\main.cpp 10 | 11 | 12 | "mutex.h" 13 | 14 | 1399068626 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\mutex\cpp\mutex.cpp 15 | 16 | "mutex.h" 17 | 18 | 1399068626 g:\code\projects\repositories\hard86\hard86\src\system\multithreading\mutex\cpp\mutex.h 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/thread.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1393665800 source:c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\cpp\thread.cpp 3 | "thread.h" 4 | 5 | 6 | 1393665788 c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\cpp\thread.h 7 | 8 | 9 | 1394265079 source:g:\code\projects\repositories\hard86\hard86\src\system\thread\cpp\thread.cpp 10 | "thread.h" 11 | 12 | 13 | 1394265060 g:\code\projects\repositories\hard86\hard86\src\system\thread\cpp\thread.h 14 | 15 | 16 | 1393751698 source:g:\code\projects\repositories\hard86\hard86\src\system\thread\cpp\main.cpp 17 | 18 | 19 | "thread.h" 20 | 21 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/scrollbar.h: -------------------------------------------------------------------------------- 1 | #ifndef SCROLLBAR_H 2 | #define SCROLLBAR_H 3 | 4 | #include "common_control.h" 5 | #include 6 | 7 | 8 | namespace nsObjWin32{ 9 | 10 | namespace nsGUI{ 11 | 12 | class DLLEXPORT ScrollBar : public CommonControl 13 | { 14 | public: 15 | ScrollBar(DWORD style=SBS_VERT){ 16 | m_className=L"SCROLLBAR"; 17 | m_style|=style; 18 | } 19 | virtual ~ScrollBar(){} 20 | 21 | HWND Create(int x, int y, int w, int h, HWND hwndParent, int ID, int range=100, int pos=0); 22 | 23 | static const int DEF_W=16; 24 | 25 | private: 26 | HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID){return NULL;}; 27 | 28 | }; 29 | 30 | } 31 | 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /src/system/multithreading/mutex/c/mutex.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | HMODULE hModule; 5 | 6 | int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ 7 | ::hModule=(HMODULE)hInstance; 8 | VirtualDevice_Initialize(NULL, NULL); 9 | return 0; 10 | } 11 | 12 | BOOL APIENTRY DllMain( HMODULE hModule, 13 | DWORD ul_reason_for_call, 14 | LPVOID lpReserved 15 | ) 16 | { 17 | ::hModule=hModule; 18 | switch (ul_reason_for_call) 19 | { 20 | case DLL_PROCESS_ATTACH: 21 | case DLL_THREAD_ATTACH: 22 | case DLL_THREAD_DETACH: 23 | case DLL_PROCESS_DETACH: 24 | break; 25 | } 26 | return TRUE; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | HMODULE hModule; 5 | 6 | int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ 7 | ::hModule=(HMODULE)hInstance; 8 | VirtualDevice_Initialize(NULL, NULL); 9 | return 0; 10 | } 11 | 12 | BOOL APIENTRY DllMain( HMODULE hModule, 13 | DWORD ul_reason_for_call, 14 | LPVOID lpReserved 15 | ) 16 | { 17 | ::hModule=hModule; 18 | switch (ul_reason_for_call) 19 | { 20 | case DLL_PROCESS_ATTACH: 21 | case DLL_THREAD_ATTACH: 22 | case DLL_THREAD_DETACH: 23 | case DLL_PROCESS_DETACH: 24 | break; 25 | } 26 | return TRUE; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | HMODULE hModule; 5 | 6 | int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ 7 | ::hModule=(HMODULE)hInstance; 8 | VirtualDevice_Initialize(NULL, NULL); 9 | return 0; 10 | } 11 | 12 | BOOL APIENTRY DllMain( HMODULE hModule, 13 | DWORD ul_reason_for_call, 14 | LPVOID lpReserved 15 | ) 16 | { 17 | ::hModule=hModule; 18 | switch (ul_reason_for_call) 19 | { 20 | case DLL_PROCESS_ATTACH: 21 | case DLL_THREAD_ATTACH: 22 | case DLL_THREAD_DETACH: 23 | case DLL_PROCESS_DETACH: 24 | break; 25 | } 26 | return TRUE; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/emulator/symbols_loader/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../src/sym_loader.h" 5 | #include 6 | 7 | using namespace std; 8 | 9 | using namespace nsSymLoader; 10 | 11 | long fsize(FILE *stream) 12 | { 13 | long curpos, length; 14 | curpos=ftell(stream); 15 | fseek(stream, 0L, SEEK_END); 16 | length=ftell(stream); 17 | fseek(stream, curpos, SEEK_SET); 18 | return length; 19 | } 20 | 21 | int main(){ 22 | FILE* f=fopen("intest.fas", "r"); 23 | int size=fsize(f); 24 | uint8* data=(uint8*)malloc(size); 25 | fread(data, 1, size, f); 26 | fclose(f); 27 | 28 | SymbolData sym(data, size); 29 | 30 | for(int i=0; i 4 | #include "INIReader.h" 5 | 6 | int main() 7 | { 8 | INIReader reader("../examples/test.ini"); 9 | 10 | if (reader.ParseError() < 0) { 11 | std::cout << "Can't load 'test.ini'\n"; 12 | return 1; 13 | } 14 | std::cout << "Config loaded from 'test.ini': version=" 15 | << reader.GetInteger("protocol", "version", -1) << ", name=" 16 | << reader.Get("user", "name", "UNKNOWN") << ", email=" 17 | << reader.Get("user", "email", "UNKNOWN") << ", pi=" 18 | << reader.GetReal("user", "pi", -1) << ", active=" 19 | << reader.GetBoolean("user", "active", true) << "\n"; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | hard86 2 | ====== 3 | 4 | an emulator for the Intel 8086 microprocessor 5 | --------------------------------------------- 6 | 7 | (C) 2014 Stephen Zhang - http://zsteve.phatcode.net 8 | 9 | Hard86 is an emulator for the Intel 8086 microprocessor, 10 | built primarily for use on Windows. 11 | 12 | It is composed of two main components : the emulator and the frontend, or interface. 13 | The emulator is the heart of hard86. Written in C and C++, it provides the opcode implementations, system 14 | accessor functions, and many other things. The emulator component is mainly platform independent, relying 15 | only on common platform facilities such as mutexes and threads. 16 | 17 | The frontend is written in C++ and provides a user interface and platform dependent implementation of certain 18 | parts of the program -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/thread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C Thread functions 3 | * C thread functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef THREAD_C_H 8 | #define THREAD_C_H 9 | 10 | #include 11 | 12 | #include "../../../../global/defines.h" 13 | #include "../../../../global/typedefs.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C"{ 17 | #endif 18 | 19 | typedef struct{ 20 | HANDLE handle; 21 | uint32 id; 22 | }THREAD; 23 | 24 | int thread_create(LPTHREAD_START_ROUTINE proc, 25 | void* param, 26 | THREAD* thread); 27 | 28 | int thread_start(THREAD* thread); 29 | 30 | int thread_pause(THREAD* thread); 31 | 32 | int thread_kill(THREAD* thread); 33 | 34 | int thread_close(THREAD* thread); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/common_control.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_CONTROL_H 2 | #define COMMON_CONTROL_H 3 | 4 | #include 5 | #include "window.h" 6 | 7 | namespace nsObjWin32{ 8 | 9 | namespace nsGUI{ 10 | 11 | class DLLEXPORT CommonControl : public Window{ 12 | 13 | public: 14 | 15 | CommonControl(){ 16 | m_style|=WS_CHILD; 17 | } 18 | 19 | virtual ~CommonControl(){ 20 | 21 | } 22 | 23 | virtual HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID)=0; 24 | 25 | protected: 26 | 27 | private: 28 | // Some things that are irrelevant to common control 29 | // classes we will set as private to ensure that they 30 | // are not used... 31 | 32 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override {return -1;}; 33 | }; 34 | 35 | } 36 | 37 | } 38 | 39 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/vs2010/hard86_win32/application.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Your application description here. 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/frame.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "frame.h" 4 | 5 | namespace nsObjWin32{ 6 | 7 | namespace nsGUI{ 8 | 9 | HWND Frame::Create(int w, int h, int x, int y){ 10 | return Window::Create(m_exStyle, L"Frame Window", 11 | m_style, 12 | x, y, w, h, NULL, NULL); 13 | } 14 | 15 | ATOM Frame::Register(){ 16 | WNDCLASSEX wcx; 17 | wcx.cbSize=sizeof(WNDCLASSEX); 18 | wcx.style=CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; 19 | wcx.lpfnWndProc=&Base_WndProc; 20 | wcx.cbClsExtra=NULL; 21 | wcx.cbWndExtra=NULL; 22 | wcx.hInstance=m_hInstance; 23 | wcx.hIcon=NULL; 24 | wcx.hCursor=LoadCursor(m_hInstance, IDC_ARROW); 25 | wcx.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); 26 | wcx.lpszMenuName=NULL; 27 | wcx.lpszClassName=m_className; 28 | wcx.hIconSm=NULL; 29 | return (RegisterClassEx(&wcx)); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/mutex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ MUTEX functions 3 | * C++ MUTEX functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef MUTEX_H 8 | #define MUTEX_H 9 | 10 | #include 11 | 12 | class Mutex{ 13 | public: 14 | Mutex(); 15 | Mutex(const Mutex& src); 16 | Mutex(void* hMutex); 17 | 18 | virtual ~Mutex(); 19 | 20 | Mutex& operator=(const Mutex& src); 21 | 22 | /** 23 | * Locks MUTEX, blocking if necessary 24 | */ 25 | int Lock(); 26 | /** 27 | * Attempts to lock MUTEX. Does not block. 28 | * @return true if locking succeeded, false if locking failed 29 | */ 30 | bool TryLock(); 31 | /** 32 | * Unlocks MUTEX 33 | */ 34 | int Unlock(); 35 | 36 | void* GetHandle(){ return m_hMutex; } 37 | private: 38 | protected: 39 | HANDLE m_hMutex; 40 | 41 | int* m_nInstances; 42 | 43 | int m_state; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/system/multithreading/event/c/event.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C event functions 3 | * C event functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include 8 | #include "event.h" 9 | 10 | #include "../../../../global/defines.h" 11 | #include "../../../../global/typedefs.h" 12 | 13 | EVENT event_create(int initial_state, int manual_reset){ 14 | return (EVENT)CreateEvent(NULL, (BOOL)manual_reset, (BOOL)initial_state, NULL); 15 | } 16 | 17 | int event_set(EVENT event){ 18 | return SetEvent((HANDLE)event); 19 | } 20 | 21 | int event_reset(EVENT event){ 22 | return ResetEvent((HANDLE)event); 23 | } 24 | 25 | int event_waitfor(EVENT event){ 26 | return WaitForSingleObject((HANDLE)event, -1); 27 | } 28 | 29 | int event_try_waitfor(EVENT event){ 30 | return (WaitForSingleObject((HANDLE)event, 0)==WAIT_TIMEOUT) ? 0 : 1; 31 | } 32 | 33 | int event_close(EVENT event){ 34 | return CloseHandle((HANDLE)event); 35 | } 36 | -------------------------------------------------------------------------------- /src/system/datastruct/clist/clist.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C linked list 3 | * Stephen Zhang, 2014 4 | */ 5 | 6 | #ifndef CLIST_H 7 | #define CLIST_H 8 | 9 | #ifdef __cplusplus 10 | extern "C"{ 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | typedef struct clist_node { 15 | void* data; 16 | clist_node *prev, *next; 17 | }clist_node; 18 | #else 19 | typedef struct { 20 | void* data; 21 | struct clist_node *prev, *next; 22 | }clist_node; 23 | #endif 24 | 25 | typedef struct { 26 | clist_node *begin, *curr, *end; 27 | }clist; 28 | 29 | clist clist_create(); 30 | void clist_push_back(clist* c, void* data); 31 | void clist_push_front(clist* c, void* data); 32 | void clist_pop_back(clist* c); 33 | void clist_pop_front(clist* c); 34 | void* clist_getcurr(clist* c); 35 | void clist_begin(clist* c); 36 | void clist_end(clist* c); 37 | int clist_next(clist* c); 38 | void clist_prev(clist* c); 39 | void clist_destroy(clist* c); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/8bit_led.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kb_video", "kb_video.vcxproj", "{351EC711-8AB9-4514-970B-2C9240B9A8BB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.Build.0 = Debug|Win32 14 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.ActiveCfg = Release|Win32 15 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kb_video", "kb_video.vcxproj", "{351EC711-8AB9-4514-970B-2C9240B9A8BB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.Build.0 = Debug|Win32 14 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.ActiveCfg = Release|Win32 15 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/lcd_screen.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kb_video", "kb_video.vcxproj", "{351EC711-8AB9-4514-970B-2C9240B9A8BB}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Debug|Win32.Build.0 = Debug|Win32 14 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.ActiveCfg = Release|Win32 15 | {351EC711-8AB9-4514-970B-2C9240B9A8BB}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/c/cmutex.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C MUTEX functions 3 | * C MUTEX functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include 8 | #include "cmutex.h" 9 | 10 | #include "../../../../global/defines.h" 11 | #include "../../../../global/typedefs.h" 12 | 13 | MUTEX mutex_create() 14 | { 15 | return CreateMutex(NULL, FALSE, NULL); 16 | } 17 | 18 | int mutex_lock(MUTEX mutex) 19 | { 20 | int retv=WaitForSingleObject(mutex, INFINITE); 21 | if(retv==WAIT_FAILED) return FALSE; 22 | return TRUE; 23 | } 24 | 25 | /** 26 | * @return true if MUTEX is locked, false otherwise 27 | */ 28 | int mutex_trylock(MUTEX mutex) 29 | { 30 | int retv=WaitForSingleObject(mutex, 0); 31 | if(retv==WAIT_TIMEOUT) return TRUE; 32 | return FALSE; 33 | } 34 | 35 | int mutex_unlock(MUTEX mutex) 36 | { 37 | int retv=ReleaseMutex(mutex); 38 | return retv ? TRUE : FALSE; 39 | } 40 | 41 | int mutex_close(MUTEX mutex) 42 | { 43 | return CloseHandle(mutex); 44 | } 45 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/file/main.1.cpp: -------------------------------------------------------------------------------- 1 | #include "file.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | using namespace nsObjWin32::nsFiles; 9 | 10 | int main(){ 11 | 12 | File myFile(L"C:\\test\\test"); 13 | wcout << "File : " << myFile.GetPath() << " was loaded" << endl; 14 | wcout << "File size : " << myFile.Size() << endl; 15 | myFile.Open(); 16 | myFile.Copy(L"C:\\test\\test2.txt"); 17 | myFile.Write(L"This is UNICODE text"); 18 | wcout << myFile.GetPointer() << endl; 19 | myFile.SetPointer(0); 20 | wcout << myFile.GetPointer() << endl; 21 | myFile.SetPointer(1024); 22 | myFile.SetEOF(); 23 | 24 | Directory myDir(L"G:\\test\\asdf\\asdf"); 25 | list fl(0); 26 | myDir.List(fl); 27 | for(list::iterator it=fl.begin(); 28 | it!=fl.end(); 29 | ++it){ 30 | wcout << it->GetPath() << endl; 31 | } 32 | wcout << FileObject::GetAbsolutePath(L"../asdf", L"G:\\asdf\\asdf\\") << endl; 33 | _getch(); 34 | return 0; 35 | } -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "io_port_watcher", "io_port_watcher.vcxproj", "{A612DBB5-085E-4FB6-A71D-990252F3F08D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {A612DBB5-085E-4FB6-A71D-990252F3F08D}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {A612DBB5-085E-4FB6-A71D-990252F3F08D}.Debug|Win32.Build.0 = Debug|Win32 14 | {A612DBB5-085E-4FB6-A71D-990252F3F08D}.Release|Win32.ActiveCfg = Release|Win32 15 | {A612DBB5-085E-4FB6-A71D-990252F3F08D}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/emulator/emulator_unit/vs2010/hard86_emulator_unit/hard86_emulator_unit.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hard86_emulator_unit", "hard86_emulator_unit\hard86_emulator_unit.vcxproj", "{D8103823-094F-4066-9154-07D0FF568BD8}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D8103823-094F-4066-9154-07D0FF568BD8}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {D8103823-094F-4066-9154-07D0FF568BD8}.Debug|Win32.Build.0 = Debug|Win32 14 | {D8103823-094F-4066-9154-07D0FF568BD8}.Release|Win32.ActiveCfg = Release|Win32 15 | {D8103823-094F-4066-9154-07D0FF568BD8}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/emulator/symbols_loader/vs2013/symbols_loader/symbols_loader.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symbols_loader", "symbols_loader.vcxproj", "{AC741D85-9269-4710-91EC-88037DFE8A4C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {AC741D85-9269-4710-91EC-88037DFE8A4C}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {AC741D85-9269-4710-91EC-88037DFE8A4C}.Debug|Win32.Build.0 = Debug|Win32 16 | {AC741D85-9269-4710-91EC-88037DFE8A4C}.Release|Win32.ActiveCfg = Release|Win32 17 | {AC741D85-9269-4710-91EC-88037DFE8A4C}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /src/emulator/debugger_engine/vs2013/debugger_engine/debugger_engine.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "debugger_engine", "debugger_engine.vcxproj", "{87136826-7925-4E43-87B5-7035B165706F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {87136826-7925-4E43-87B5-7035B165706F}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {87136826-7925-4E43-87B5-7035B165706F}.Debug|Win32.Build.0 = Debug|Win32 16 | {87136826-7925-4E43-87B5-7035B165706F}.Release|Win32.ActiveCfg = Release|Win32 17 | {87136826-7925-4E43-87B5-7035B165706F}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /src/emulator/emulator_engine/src/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file emulator engine unit test 3 | * Stephen Zhang, 2014 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../../../global/typedefs.h" 11 | #include "../../../system/multithreading/mutex/c/cmutex.h" 12 | #include "emulator_engine_interface.h" 13 | #include "dasm/dasm.h" 14 | 15 | long fsize(FILE *stream) 16 | { 17 | long curpos, length; 18 | curpos = ftell(stream); 19 | fseek(stream, 0L, SEEK_END); 20 | length = ftell(stream); 21 | fseek(stream, curpos, SEEK_SET); 22 | return length; 23 | } 24 | 25 | int main(){ 26 | MUTEX mutex; 27 | FILE* in_file=fopen("test/test.com", "r"); 28 | int size=fsize(in_file); 29 | uint8* data=(uint8*)malloc(size); 30 | fread(data, 1, size, in_file); 31 | fclose(in_file); 32 | 33 | mutex=mutex_create(); 34 | mutex_unlock(mutex); /* make sure it's unlocked */ 35 | system_init(mutex); 36 | system_load_mem(data, size); 37 | 38 | system_execute(); 39 | 40 | system_destroy(); 41 | 42 | free(data); 43 | 44 | _getch(); 45 | return 0; 46 | } -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/button.cpp: -------------------------------------------------------------------------------- 1 | #include "button.h" 2 | #include 3 | 4 | namespace nsObjWin32{ 5 | 6 | namespace nsGUI{ 7 | 8 | HWND Button::Create(DWORD dwExStyle, 9 | LPCTSTR lpWindowName, 10 | DWORD dwStyle, 11 | int x, int y, 12 | int w, int h, 13 | HWND hwndParent, 14 | HMENU hMenu) 15 | { 16 | m_hWnd=CreateWindowEx(dwExStyle, 17 | m_className, 18 | lpWindowName, 19 | dwStyle, 20 | x, y, 21 | w, h, 22 | hwndParent, hMenu, 23 | m_hInstance, this); 24 | int e=GetLastError(); 25 | return m_hWnd; 26 | } 27 | 28 | // PushButton 29 | 30 | HWND PushButton::Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID) 31 | { 32 | return Button::Create(m_exStyle, lpName, m_style, x, y, w, h, hwndParent, (HMENU)ID); } 33 | 34 | // Checkbox 35 | 36 | HWND CheckBox::Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID) 37 | { 38 | return Button::Create(m_exStyle, lpName, m_style, x, y, w, h, hwndParent, (HMENU)ID); 39 | } 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/examples/fib/DosCom.asm: -------------------------------------------------------------------------------- 1 | ; A 16-bit DOS HelloWorld program originally by RedOx. Produces a tiny model .com executable. 2 | 3 | ; To assemble and link from within WinAsm Studio, you must have a special 16-bit linker, 4 | ; such as the one in the archive at this URL- http://win32assembly.online.fr/files/Lnk563.exe 5 | ; Run the archive to unpack Link.exe, rename the Link.exe file to Link16.exe and copy it 6 | ; into the \masm32\bin folder. 7 | ; 8 | ; To produce a .COM file, .model must be tiny, also you must add /tiny to the linker command line 9 | 10 | .model tiny, stdcall 11 | .data 12 | .code 13 | 14 | rec_wrapper proto :WORD 15 | 16 | .startup 17 | 18 | invoke rec_wrapper, 20 19 | out 40h, ax 20 | 21 | ret 22 | 23 | rec_fib proc a:WORD, b:WORD, count:WORD 24 | .if(count==0) 25 | mov ax, a 26 | add ax, b 27 | ret 28 | .endif 29 | xor ax, ax 30 | mov ax, a 31 | add ax, b 32 | mov bx, count 33 | dec bx 34 | invoke rec_fib, ax, a, bx 35 | Ret 36 | rec_fib endp 37 | 38 | rec_wrapper proc n:WORD 39 | invoke rec_fib, 1, 0, n 40 | Ret 41 | rec_wrapper endp 42 | end -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/thread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ thread functions 3 | * C++ thread functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #ifndef THREAD_H 8 | #define THREAD_H 9 | 10 | #include 11 | 12 | typedef unsigned long dword; 13 | 14 | class Thread{ 15 | public: 16 | Thread(LPTHREAD_START_ROUTINE threadProc, dword threadParam, int stackSize=NULL); 17 | virtual ~Thread(); 18 | 19 | bool Start(); 20 | bool Pause(); 21 | // Warning : usage of Kill() is dangerous, as thread will be terminated immediately 22 | // Any resources allocated by the thread will not be released. 23 | bool Kill(); 24 | 25 | void* GetHandle(){ return m_hThread; } 26 | 27 | enum ThreadState{ 28 | Running, Suspended, Terminated 29 | }; 30 | 31 | void SetMaxSuspendCount(int c){ m_maxSuspendCount=c; } 32 | 33 | ThreadState State(){ return m_state; } 34 | 35 | int GetSuspendCount(){ return m_suspendCount; } 36 | private: 37 | protected: 38 | HANDLE m_hThread; 39 | DWORD m_threadID; 40 | ThreadState m_state; 41 | 42 | int m_suspendCount; 43 | int m_maxSuspendCount; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/lib/rapidxml/test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../rapidxml.hpp" 4 | #include "../rapidxml_print.hpp" 5 | 6 | using namespace std; 7 | using namespace rapidxml; 8 | 9 | int main(){ 10 | FILE* f=fopen("test.xml", "r"); 11 | int fsize; 12 | { 13 | int pos=ftell(f); 14 | fseek(f, 0, SEEK_END); 15 | fsize=ftell(f); 16 | fseek(f, pos, SEEK_SET); 17 | } 18 | char* txt=new char[fsize]; 19 | fread(txt, 1, fsize, f); 20 | fclose(f); 21 | cout << txt << endl; 22 | xml_document<> doc; 23 | try{ 24 | doc.parse<0>(txt); 25 | xml_node<> *node=doc.first_node("Node1"); 26 | cout << node->name() << endl; 27 | cout << "Node value : " << node->value() << endl; 28 | cout << "Node attrib: " << node->first_attribute()->name() << endl; 29 | node=node->first_node("Node2"); 30 | cout << node->name() << endl; 31 | cout << "Node value : " << node->value() << endl; 32 | cout << "Node attrib: " << node->first_attribute()->name() << endl; 33 | }catch(rapidxml::parse_error e){ 34 | cout << "Exception : " << e.what() << endl; 35 | } 36 | 37 | cout << doc << endl; 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/userwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef USERWINDOW_H 2 | #define USERWINDOW_H 3 | 4 | #include 5 | #include "window.h" 6 | 7 | namespace nsObjWin32{ 8 | 9 | namespace nsGUI{ 10 | 11 | class DLLEXPORT UserWindow : public Window{ 12 | 13 | public: 14 | 15 | virtual ATOM Register()=0; 16 | 17 | wchar_t* GetClassName(){return m_className;} 18 | 19 | protected: 20 | }; 21 | 22 | class DLLEXPORT ToolWindow : public UserWindow{ 23 | public: 24 | ToolWindow(){ 25 | m_exStyle|=WS_EX_TOOLWINDOW; 26 | } 27 | 28 | virtual ~ToolWindow(){ 29 | 30 | } 31 | 32 | ATOM Register(){ 33 | WNDCLASSEX wcx; 34 | wcx.cbSize=sizeof(WNDCLASSEX); 35 | wcx.style=CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; 36 | wcx.lpfnWndProc=&Base_WndProc; 37 | wcx.cbClsExtra=NULL; 38 | wcx.cbWndExtra=NULL; 39 | wcx.hInstance=m_hInstance; 40 | wcx.hIcon=NULL; 41 | wcx.hCursor=NULL; 42 | wcx.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); 43 | wcx.lpszMenuName=NULL; 44 | wcx.lpszClassName=m_className; 45 | wcx.hIconSm=NULL; 46 | return (RegisterClassEx(&wcx)); 47 | } 48 | }; 49 | 50 | } 51 | 52 | } 53 | 54 | #endif -------------------------------------------------------------------------------- /src/lib/inih/examples/ini_dump.c: -------------------------------------------------------------------------------- 1 | /* ini.h example that simply dumps an INI file without comments */ 2 | 3 | #include 4 | #include 5 | #include "../ini.h" 6 | 7 | static int dumper(void* user, const char* section, const char* name, 8 | const char* value) 9 | { 10 | static char prev_section[50] = ""; 11 | 12 | if (strcmp(section, prev_section)) { 13 | printf("%s[%s]\n", (prev_section[0] ? "\n" : ""), section); 14 | strncpy(prev_section, section, sizeof(prev_section)); 15 | prev_section[sizeof(prev_section) - 1] = '\0'; 16 | } 17 | printf("%s = %s\n", name, value); 18 | return 1; 19 | } 20 | 21 | int main(int argc, char* argv[]) 22 | { 23 | int error; 24 | 25 | if (argc <= 1) { 26 | printf("Usage: ini_dump filename.ini\n"); 27 | return 1; 28 | } 29 | 30 | error = ini_parse(argv[1], dumper, NULL); 31 | if (error < 0) { 32 | printf("Can't read '%s'!\n", argv[1]); 33 | return 2; 34 | } 35 | else if (error) { 36 | printf("Bad config file (first error on line %d)!\n", error); 37 | return 3; 38 | } 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/file/main.cpp: -------------------------------------------------------------------------------- 1 | #include "file.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | using namespace nsObjWin32::nsFiles; 9 | 10 | int main(){ 11 | 12 | File myFile(L"C:\\test\\test"); 13 | wcout << "File : " << myFile.GetPath() << " was loaded" << endl; 14 | wcout << "File size : " << myFile.Size() << endl; 15 | myFile.Open(); 16 | myFile.Copy(L"C:\\test\\test2.txt"); 17 | myFile.Write(L"This is UNICODE text"); 18 | wcout << myFile.GetPointer() << endl; 19 | myFile.SetPointer(0); 20 | wcout << myFile.GetPointer() << endl; 21 | myFile.SetPointer(1024); 22 | myFile.SetEOF(); 23 | 24 | Directory myDir(L"G:\\test\\asdf\\asdf"); 25 | list fl(0); 26 | myDir.List(fl); 27 | for(list::iterator it=fl.begin(); 28 | it!=fl.end(); 29 | ++it){ 30 | wcout << it->GetPath() << endl; 31 | } 32 | 33 | wcout << FileObject::GetRelativePath(L"C:\\test\\a.txt", L"C:\\test\\") << endl; 34 | wcout << FileObject::GetRelativePath(L"C:\\test\\a.txt", L"C:\\test") << endl; 35 | wcout << FileObject::GetAbsolutePath(L"../asdf", L"G:\\asdf\\asdf\\") << endl; 36 | _getch(); 37 | return 0; 38 | } -------------------------------------------------------------------------------- /src/emulator/emulator_engine/src/global.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef GLOBAL_H 21 | #define GLOBAL_H 22 | 23 | #ifdef __cplusplus 24 | extern "C"{ 25 | #endif 26 | 27 | unsigned short signext8(unsigned char a); 28 | unsigned long signext16(unsigned short a); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif -------------------------------------------------------------------------------- /src/global/defines.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file global defines 3 | * Stephen Zhang, 2014 4 | */ 5 | 6 | #ifndef DEFINES_H 7 | #define DEFINES_H 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | /* bit defines */ 18 | #define BIT_0 1 19 | #define BIT_1 2 20 | #define BIT_2 4 21 | #define BIT_3 8 22 | #define BIT_4 16 23 | #define BIT_5 32 24 | #define BIT_6 64 25 | #define BIT_7 128 26 | #define BIT_8 256 27 | #define BIT_9 512 28 | #define BIT_10 1024 29 | #define BIT_11 2048 30 | #define BIT_12 4096 31 | #define BIT_13 8192 32 | #define BIT_14 16384 33 | #define BIT_15 32768 34 | 35 | #define getch _getch 36 | 37 | /* bit operations */ 38 | #define LO_BYTE(w) (unsigned char)(w & 0xff) 39 | #define HI_BYTE(w) (unsigned char)(w & 0xff00) >> 8 40 | 41 | #define HI_WORD(d) (unsigned short)((d & 0xffff0000)>>16) 42 | #define LO_WORD(d) (unsigned short)(d & 0xffff) 43 | 44 | #define WORD_B(h, l) (((unsigned short)h)<<8 | l) 45 | #define DWORD_B(h, l) (((unsigned long)h)<<16 | l) 46 | 47 | /* MB and KB, RANGE_8/16 definitions */ 48 | #define KB 1024 49 | #define MB KB*KB 50 | #define RANGE_8 256 51 | #define RANGE_16 65536 52 | 53 | #endif -------------------------------------------------------------------------------- /src/emulator/emulator_engine/src/global.c: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "global.h" 21 | 22 | unsigned short signext8(unsigned char a){ 23 | if(a & 0x80){ 24 | /* negative */ 25 | return (unsigned short)a | 0xff00; 26 | } 27 | return a; 28 | } 29 | 30 | unsigned long signext16(unsigned short a){ 31 | if(a & 0x8000){ 32 | return (unsigned long)a | 0xffff0000; 33 | } 34 | return a; 35 | } -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/thread.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ thread functions 3 | * C++ thread functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include "thread.h" 8 | #include 9 | 10 | Thread::Thread(LPTHREAD_START_ROUTINE threadProc, dword threadParam, int stackSize) : m_suspendCount(0), m_maxSuspendCount(-1){ 11 | SECURITY_ATTRIBUTES sa; 12 | sa.bInheritHandle=false; 13 | sa.lpSecurityDescriptor=NULL; 14 | sa.nLength=sizeof(SECURITY_ATTRIBUTES); 15 | m_hThread=CreateThread(&sa, stackSize, 16 | threadProc, 17 | (LPVOID)threadParam, 18 | CREATE_SUSPENDED, 19 | &m_threadID); 20 | m_state=Suspended; 21 | } 22 | 23 | Thread::~Thread(){ 24 | WaitForSingleObject(m_hThread, -1); 25 | } 26 | 27 | bool Thread::Start(){ 28 | m_state=Running; 29 | int retv=ResumeThread(m_hThread); 30 | if(retv==-1) return false; 31 | m_suspendCount=retv-1; 32 | return true; 33 | } 34 | 35 | bool Thread::Pause(){ 36 | if(m_suspendCount==m_maxSuspendCount) return false; 37 | m_state=Suspended; 38 | int retv=SuspendThread(m_hThread); 39 | if(retv==-1) return false; 40 | m_suspendCount=retv+1; 41 | return true; 42 | } 43 | 44 | bool Thread::Kill(){ 45 | m_state=Terminated; 46 | return TerminateThread(m_hThread, 0); 47 | } 48 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/static.cpp: -------------------------------------------------------------------------------- 1 | #include "static.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | HWND Static::Create(DWORD dwExStyle, 8 | LPCTSTR lpWindowName, 9 | DWORD dwStyle, 10 | int x, int y, 11 | int w, int h, 12 | HWND hwndParent, 13 | HMENU hMenu) 14 | { 15 | m_hWnd=CreateWindowEx(dwExStyle, 16 | m_className, 17 | lpWindowName, 18 | dwStyle, 19 | x, y, 20 | w, h, 21 | hwndParent, hMenu, 22 | m_hInstance, this); 23 | return m_hWnd; 24 | } 25 | 26 | // TextStatic 27 | HWND TextStatic::Create(LPCTSTR lpWindowName, int x, int y, int w, int h, HWND hwndParent, int ID) 28 | { 29 | return Static::Create(m_exStyle, lpWindowName, m_style, x, y, w, h, hwndParent, (HMENU)ID); 30 | } 31 | 32 | // BmpStatic 33 | HWND BmpStatic::Create(LPCTSTR lpBmpResId, int x, int y, int w, int h, HWND hwndParent, int ID) 34 | { 35 | return Static::Create(m_exStyle, lpBmpResId, m_style, x, y, w, h, hwndParent, (HMENU)ID); 36 | } 37 | 38 | // FrameStatic 39 | HWND FrameStatic::Create(LPCTSTR lpWindowName, int x, int y, int w, int h, HWND hwndParent, int ID) 40 | { 41 | return Static::Create(m_exStyle, lpWindowName, m_style, x, y, w, h, hwndParent, (HMENU)ID); 42 | } 43 | 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/event.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/mutex.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /src/lib/inih/examples/ini_example.c: -------------------------------------------------------------------------------- 1 | /* Example: parse a simple configuration file */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../ini.h" 7 | 8 | typedef struct 9 | { 10 | int version; 11 | const char* name; 12 | const char* email; 13 | } configuration; 14 | 15 | static int handler(void* user, const char* section, const char* name, 16 | const char* value) 17 | { 18 | configuration* pconfig = (configuration*)user; 19 | 20 | #define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0 21 | if (MATCH("protocol", "version")) { 22 | pconfig->version = atoi(value); 23 | } else if (MATCH("user", "name")) { 24 | pconfig->name = strdup(value); 25 | } else if (MATCH("user", "email")) { 26 | pconfig->email = strdup(value); 27 | } else { 28 | return 0; /* unknown section/name, error */ 29 | } 30 | return 1; 31 | } 32 | 33 | int main(int argc, char* argv[]) 34 | { 35 | configuration config; 36 | 37 | if (ini_parse("test.ini", handler, &config) < 0) { 38 | printf("Can't load 'test.ini'\n"); 39 | return 1; 40 | } 41 | printf("Config loaded from 'test.ini': version=%d, name=%s, email=%s\n", 42 | config.version, config.name, config.email); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/cpp/thread.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /src/emulator/symbols_loader/vs2013/symbols_loader/symbols_loader.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/system/datastruct/clist/clist.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 46 | 47 | -------------------------------------------------------------------------------- /src/emulator/debugger_engine/src/device_test/device_test.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef DEVICE_TEST_H 21 | #define DEVICE_TEST_H 22 | 23 | #include "../../../emulator_engine/src/emulator_engine_interface.h" 24 | #include "../../../../system/multithreading/mutex/c/cmutex.h" 25 | 26 | namespace nsDeviceTest{ 27 | int VirtualDevice_Initialize(void* param1, void* param2); 28 | int VirtualDevice_Terminate(); 29 | int VirtualDevice_AcceptEmulationMutex(MUTEX sysMutex, sys_state_ptr sysState); 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /src/system/multithreading/event/c/event.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 46 | 47 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_file_lib/win32_file_lib.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_file_lib/win32_file_lib.vcxproj.1.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/thread.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 46 | 47 | -------------------------------------------------------------------------------- /src/lib/inih/examples/ini_xmacros.c: -------------------------------------------------------------------------------- 1 | /* Parse a configuration file into a struct using X-Macros */ 2 | 3 | #include 4 | #include 5 | #include "../ini.h" 6 | 7 | /* define the config struct type */ 8 | typedef struct { 9 | #define CFG(s, n, default) char *s##_##n; 10 | #include "config.def" 11 | } config; 12 | 13 | /* create one and fill in its default values */ 14 | config Config = { 15 | #define CFG(s, n, default) default, 16 | #include "config.def" 17 | }; 18 | 19 | /* process a line of the INI file, storing valid values into config struct */ 20 | int handler(void *user, const char *section, const char *name, 21 | const char *value) 22 | { 23 | config *cfg = (config *)user; 24 | 25 | if (0) ; 26 | #define CFG(s, n, default) else if (strcmp(section, #s)==0 && \ 27 | strcmp(name, #n)==0) cfg->s##_##n = strdup(value); 28 | #include "config.def" 29 | 30 | return 1; 31 | } 32 | 33 | /* print all the variables in the config, one per line */ 34 | void dump_config(config *cfg) 35 | { 36 | #define CFG(s, n, default) printf("%s_%s = %s\n", #s, #n, cfg->s##_##n); 37 | #include "config.def" 38 | } 39 | 40 | int main(int argc, char* argv[]) 41 | { 42 | if (ini_parse("test.ini", handler, &Config) < 0) 43 | printf("Can't load 'test.ini', using defaults\n"); 44 | dump_config(&Config); 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /src/system/multithreading/event/cpp/event.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ event functions 3 | * C++ event functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include 8 | #include "event.h" 9 | 10 | Event::Event(bool initialState){ 11 | m_nInstances=new int; 12 | (*m_nInstances)=1; 13 | m_hEvent=CreateEvent(NULL, FALSE, (BOOL)initialState, NULL); 14 | } 15 | 16 | Event::Event(bool initialState, bool manualReset){ 17 | m_nInstances=new int; 18 | (*m_nInstances)=1; 19 | m_hEvent=CreateEvent(NULL, (BOOL)manualReset, (BOOL)initialState, NULL); 20 | } 21 | 22 | Event::Event(const Event& src){ 23 | m_nInstances=src.m_nInstances; 24 | (*m_nInstances)++; 25 | m_hEvent=src.m_hEvent; 26 | } 27 | 28 | Event::~Event(){ 29 | (*m_nInstances)--; 30 | if(!(*m_nInstances)){ 31 | delete m_nInstances; 32 | CloseHandle(m_hEvent); 33 | } 34 | } 35 | 36 | Event& Event::operator=(const Event& src){ 37 | (*m_nInstances)--; 38 | if(!(*m_nInstances)){ 39 | delete m_nInstances; 40 | CloseHandle(m_hEvent); 41 | } 42 | return *this; 43 | } 44 | 45 | bool Event::Set(){ 46 | return SetEvent(m_hEvent); 47 | } 48 | 49 | bool Event::Reset(){ 50 | return ResetEvent(m_hEvent); 51 | } 52 | 53 | bool Event::WaitFor(){ 54 | return WaitForSingleObject(m_hEvent, -1); 55 | } 56 | 57 | bool Event::TryWaitFor(){ 58 | return (WaitForSingleObject(m_hEvent, 0)==WAIT_TIMEOUT) ? false : true; 59 | } 60 | -------------------------------------------------------------------------------- /src/system/multithreading/thread/c/thread.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C Thread functions 3 | * C thread functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include 8 | #include "thread.h" 9 | 10 | #include "../../../../global/defines.h" 11 | #include "../../../../global/typedefs.h" 12 | 13 | int thread_create(LPTHREAD_START_ROUTINE proc, 14 | void* param, 15 | THREAD* thread) 16 | { 17 | thread->handle=CreateThread(NULL, 18 | 0, 19 | proc, 20 | param, 21 | CREATE_SUSPENDED, 22 | &thread->id); 23 | if(thread->handle){ 24 | return TRUE; 25 | } 26 | return FALSE; 27 | } 28 | 29 | int thread_start(THREAD* thread) 30 | { 31 | return (ResumeThread(thread->handle)==-1) ? FALSE : TRUE; 32 | } 33 | 34 | int thread_pause(THREAD* thread) 35 | { 36 | return (SuspendThread(thread->handle)==-1) ? FALSE : TRUE; 37 | } 38 | 39 | int thread_kill(THREAD* thread) 40 | { 41 | /* fail-safe killing of thread 42 | this is also dangerous, as any handles held 43 | by the thread specified will not be released. 44 | In the case of mutexes, this could result in 45 | a crash 46 | */ 47 | return TerminateThread(thread->handle, 0); 48 | } 49 | 50 | int thread_close(THREAD* thread) 51 | { 52 | WaitForSingleObject(thread->handle, -1); 53 | return CloseHandle(thread->handle); 54 | } 55 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/dialog.cpp: -------------------------------------------------------------------------------- 1 | #include "dialog.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | INT_PTR CALLBACK Dialog::Base_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ 8 | switch(uMsg){ 9 | case WM_SETFONT: 10 | return 0; 11 | case WM_INITDIALOG: 12 | { 13 | Dialog* pDialog=(Dialog*)lParam; 14 | SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG)pDialog); 15 | if(pDialog==nullptr){ 16 | return 0; 17 | } 18 | return pDialog->DlgProc(hWnd, uMsg, wParam, lParam); 19 | } 20 | default: 21 | { 22 | Dialog* pDialog=(Dialog*)GetWindowLong(hWnd, GWL_USERDATA); 23 | if(pDialog==nullptr){ 24 | return 0; 25 | } 26 | return pDialog->DlgProc(hWnd, uMsg, wParam, lParam); 27 | } 28 | } 29 | return 0; 30 | } 31 | 32 | HWND Dialog::Create(HWND hwndParent) 33 | { 34 | m_hInstance=Window::m_hInstance; 35 | return m_hWnd=CreateDialogParam(m_hInstance, MAKEINTRESOURCE(m_resId), hwndParent, Dialog::Base_DlgProc, (LPARAM)this); 36 | } 37 | 38 | void Dialog::CreateNoReturn(HWND hwndParent){ 39 | m_hInstance=Window::m_hInstance; 40 | DialogBoxParam(m_hInstance, MAKEINTRESOURCE(m_resId), hwndParent, Dialog::Base_DlgProc, (LPARAM)this); 41 | } 42 | 43 | LRESULT Dialog::SendMessage(UINT uMsg, WPARAM wParam, LPARAM lParam){ 44 | return ::SendMessage(m_hWnd, uMsg, wParam, lParam); 45 | } 46 | 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/listbox.h: -------------------------------------------------------------------------------- 1 | #ifndef LISTBOX_H 2 | #define LISTBOX_H 3 | 4 | #include "common_control.h" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace nsObjWin32{ 10 | 11 | namespace nsGUI{ 12 | 13 | using namespace std; 14 | 15 | class DLLEXPORT ListBox : public CommonControl{ 16 | public: 17 | ListBox(DWORD style=NULL, DWORD exStyle=NULL) : m_listData(0){ 18 | m_className=L"LISTBOX"; 19 | m_style|=style; 20 | m_exStyle|=exStyle; 21 | } 22 | 23 | virtual ~ListBox(){} 24 | 25 | HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID); 26 | 27 | void push_back(wstring& elem){ 28 | m_listData.push_back(elem); 29 | } 30 | 31 | void pop_back(){ 32 | m_listData.pop_back(); 33 | } 34 | 35 | vector::iterator begin(){ return m_listData.begin(); } 36 | vector::iterator end(){ return m_listData.end(); } 37 | 38 | void clear(){ m_listData.clear(); } 39 | bool empty(){ return m_listData.empty(); } 40 | 41 | void Update(){ 42 | SendMessage(LB_RESETCONTENT, NULL, NULL); 43 | for(vector::iterator it=m_listData.begin(); 44 | it!=m_listData.end(); 45 | ++it){ 46 | SendMessage(LB_ADDSTRING, NULL, (LPARAM)it->c_str()); 47 | } 48 | } 49 | 50 | protected: 51 | 52 | vector m_listData; 53 | 54 | }; 55 | 56 | } 57 | 58 | } 59 | 60 | #endif -------------------------------------------------------------------------------- /src/system/multithreading/mutex/c/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "mutex.h" 6 | 7 | #include "../../thread/c/thread.h" 8 | 9 | DWORD WINAPI PrintLine1(LPVOID param) 10 | { 11 | MUTEX mutex=(MUTEX)param; 12 | int i=0; 13 | int j=0; 14 | while(j++<20){ 15 | mutex_lock(mutex); 16 | for(i=0; i<20; i++){ 17 | putchar('b'); 18 | } 19 | putchar('\n'); 20 | if(!mutex_unlock(mutex)){ 21 | printf("Error\n"); 22 | } 23 | } 24 | return 0; 25 | } 26 | 27 | DWORD WINAPI PrintLine2(LPVOID param) 28 | { 29 | MUTEX mutex=(MUTEX)param; 30 | int i=0; 31 | int j=0; 32 | while(j++<20){ 33 | mutex_lock(mutex); 34 | for(i=0; i<20; i++){ 35 | putchar('z'); 36 | } 37 | putchar('\n'); 38 | if(!mutex_unlock(mutex)){ 39 | printf("Error\n"); 40 | } 41 | } 42 | return 0; 43 | } 44 | 45 | int main() 46 | { 47 | /* MUTEX myMutex; 48 | THREAD myThread1, myThread2; 49 | myMutex=mutex_create(); 50 | thread_create(&PrintLine1, (LPVOID)myMutex, &myThread1); 51 | thread_create(&PrintLine2, (LPVOID)myMutex, &myThread2); 52 | thread_start(&myThread1); 53 | thread_start(&myThread2); 54 | _getch(); 55 | mutex_close(myMutex); 56 | */ 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/global.h: -------------------------------------------------------------------------------- 1 | #define DLLIMPORT __declspec(dllimport) 2 | #define DLLEXPORT __declspec(dllexport) 3 | 4 | #ifndef OBJWIN32_GUI_GLOBAL_H 5 | #define OBJWIN32_GUI_GLOBAL_H 6 | 7 | #include 8 | #include "window.h" 9 | 10 | #define ALERT_ERR(msg)\ 11 | MessageBox(NULL, L"Error", L"Error : "##L##msg, MB_ICONERROR); 12 | 13 | 14 | namespace nsObjWin32{ 15 | 16 | namespace nsGUI{ 17 | 18 | DLLEXPORT int RectWidth(const RECT& rc); 19 | DLLEXPORT int RectHeight(const RECT& rc); 20 | DLLEXPORT int WindowWidth(HWND hWnd); 21 | DLLEXPORT int WindowHeight(HWND hWnd); 22 | DLLEXPORT int WindowWidth(const Window& w); 23 | DLLEXPORT int WindowHeight(const Window& w); 24 | DLLEXPORT int ClientWidth(HWND hWnd); 25 | DLLEXPORT int ClientHeight(HWND hWnd); 26 | DLLEXPORT int SetWindowSize(HWND hWnd, int w, int h); 27 | DLLEXPORT int SetChildWindowSize(HWND hWnd, int w, int h); 28 | DLLEXPORT int SetWindowXY(HWND hWnd, int x, int y); 29 | 30 | DLLEXPORT int WindowX(HWND hWnd); 31 | DLLEXPORT int WindowY(HWND hWnd); 32 | DLLEXPORT int ClientX(HWND hWnd); 33 | DLLEXPORT int ClientY(HWND hWnd); 34 | 35 | DLLEXPORT int FontWidth(HDC hDC); 36 | DLLEXPORT int FontHeight(HDC hDC); 37 | 38 | template 39 | DLLEXPORT T Center(T a, T b){ 40 | return (a+b)/2; 41 | } 42 | 43 | template 44 | DLLEXPORT T Center(T a){ 45 | return a/2; 46 | } 47 | 48 | } 49 | 50 | } 51 | 52 | #endif -------------------------------------------------------------------------------- /src/emulator/emulator_engine/src/dasm/dasm.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef DASM_H 21 | #define DASM_H 22 | 23 | #ifdef __cplusplus 24 | extern "C"{ 25 | #endif 26 | 27 | #include "../../../../system/datastruct/clist/clist.h" 28 | #include "../../../../global/defines.h" 29 | #include "../../../../global/typedefs.h" 30 | 31 | typedef struct{ 32 | char* line; /// line data 33 | uint32 addr; /// address (IP) 34 | uint32 seg; /// segment (CS) 35 | }dasm_list_entry; 36 | 37 | clist dasm_disassemble(int n_instr, uint16 initial_ip, uint16 initial_cs); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit.1.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_ui_lib", "win32_generic_unit\win32_generic_unit.vcxproj", "{EF018B23-8DC6-4249-98C3-78D1B467C97B}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_file_lib", "win32_file_lib\win32_file_lib.vcxproj", "{A14DBCC3-4F4E-4377-8C30-54D04D657459}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.Build.0 = Debug|Win32 16 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.ActiveCfg = Release|Win32 17 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.Build.0 = Release|Win32 18 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.Build.0 = Debug|Win32 20 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.ActiveCfg = Release|Win32 21 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/vs2010/win32_generic_unit/win32_generic_unit.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_ui_lib", "win32_generic_unit\win32_generic_unit.vcxproj", "{EF018B23-8DC6-4249-98C3-78D1B467C97B}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_file_lib", "win32_file_lib\win32_file_lib.vcxproj", "{A14DBCC3-4F4E-4377-8C30-54D04D657459}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.Build.0 = Debug|Win32 16 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.ActiveCfg = Release|Win32 17 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.Build.0 = Release|Win32 18 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.Build.0 = Debug|Win32 20 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.ActiveCfg = Release|Win32 21 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /src/ext_itoa/ext_itoa.h: -------------------------------------------------------------------------------- 1 | #ifndef EXT_ITOA_H 2 | #define EXT_ITOA_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | static void ext_itoa(int value, char* str, int radix, int padto=0, char padchar='0'){ 11 | char buf[10]=""; 12 | itoa(value, buf, radix); 13 | if(padto){ 14 | int padspaces=(padto-strlen(buf)); 15 | int i=padspaces; 16 | if(i > 0){ 17 | while(i){ 18 | str[--i]=padchar; 19 | } 20 | str[padspaces]=NULL; 21 | strcat(str, buf); 22 | return; 23 | } 24 | } 25 | strcpy(str, buf); 26 | } 27 | 28 | static void ext_itow(int value, wchar_t* str, int radix, int padto=0, wchar_t padchar=L'0'){ 29 | wchar_t buf[10]=L""; 30 | _itow(value, buf, radix); 31 | if(padto){ 32 | int padspaces=(padto-wcslen(buf)); 33 | int i=padspaces; 34 | if(i > 0){ 35 | while(i){ 36 | str[--i]=padchar; 37 | } 38 | str[padspaces]=NULL; 39 | wcscat(str, buf); 40 | return; 41 | } 42 | } 43 | wcscat(str, buf); 44 | } 45 | 46 | static wstring ext_itow(int value, int radix, int padto=0, wchar_t padchar=L'0'){ 47 | wchar_t* buf=new wchar_t[padto+10]; 48 | buf[0]=NULL; 49 | ext_itow(value, buf, radix, padto, padchar); 50 | wstring retv(buf); 51 | delete[] buf; 52 | return retv; 53 | } 54 | 55 | static string ext_itoa(int value, int radix, int padto=0, char padchar=L'0'){ 56 | char* buf=new char[padto+10]; 57 | buf[0]=NULL; 58 | ext_itoa(value, buf, radix, padto, padchar); 59 | string retv(buf); 60 | delete[] buf; 61 | return retv; 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/toolwindow.cpp: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "toolwindow.h" 21 | 22 | namespace nsHard86Win32{ 23 | 24 | #define MSGHANDLER(name) void Hard86ToolWindow::On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 25 | 26 | MSGHANDLER(Sizing){ 27 | StickyWindow::OnSizing(hWnd, uMsg, wParam, lParam); 28 | DefWindowProc(hWnd, uMsg, wParam, lParam); 29 | } 30 | 31 | MSGHANDLER(Moving){ 32 | StickyWindow::OnMoving(hWnd, uMsg, wParam, lParam); 33 | DefWindowProc(hWnd, uMsg, wParam, lParam); 34 | } 35 | 36 | MSGHANDLER(NCLButtonDown){ 37 | StickyWindow::OnNCLButtonDown(hWnd, uMsg, wParam, lParam); 38 | DefWindowProc(hWnd, uMsg, wParam, lParam); 39 | } 40 | 41 | MSGHANDLER(Close){ 42 | Show(SW_HIDE); 43 | } 44 | 45 | #undef MSGHANDLER 46 | 47 | } -------------------------------------------------------------------------------- /src/lib/stickywindows/StickyDragManager.h: -------------------------------------------------------------------------------- 1 | #ifndef _STICKYDRAGMANAGER_H 2 | #define _STICKYDRAGMANAGER_H 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class CStickyDragManager 9 | { 10 | public: 11 | CStickyDragManager(bool isDocker = false); 12 | virtual ~CStickyDragManager(); 13 | void Init(HWND hWnd = 0); 14 | vector *SnapMove(LPRECT activeRect, vector& dockedRects); 15 | void SnapMoveRect(LPRECT r); 16 | void SnapSize(LPRECT r); 17 | void GetDockedWindows(HWND hWnd, int index, vector &windows); 18 | void StartTrack(); 19 | 20 | inline void SetDockerState(bool bDockerState) { m_bIsDocker = bDockerState; } 21 | inline void AddWindow(HWND hWnd) { m_registeredWindows.push_back(hWnd); } 22 | inline void AddDesktopWindow() { HWND hWnd = ::GetDesktopWindow(); AddWindow(hWnd); m_exclusionWindow = hWnd; } 23 | inline HWND GetActiveWindow() { return m_activeWindow; } 24 | inline bool IsCloseTo(int ms, int ss) { return ((ms > (ss - m_slack)) && (ms < (ss + m_slack))) ? true : false; } 25 | inline vector* DockedWindows() { return &m_dockedWindows; } 26 | inline vector* UnDockedWindows() { return &m_undockedWindows; } 27 | inline bool IsDocker() { return m_bIsDocker; } 28 | protected: 29 | RECT m_lastDragRect; 30 | bool m_bIsDocker; 31 | POINT m_dragPos; 32 | int m_slack; 33 | bool m_stickFlags[4]; 34 | int m_stickPos[4]; 35 | HWND m_activeWindow; 36 | HWND m_exclusionWindow; 37 | vector m_undockedWindows; 38 | vector m_registeredWindows; 39 | vector m_dockedWindows; 40 | vector m_windowDock; 41 | vector m_windowDockProcess; 42 | }; 43 | 44 | #endif //_STICKYDRAGMANAGER_H 45 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/static.h: -------------------------------------------------------------------------------- 1 | #ifndef STATIC_H 2 | #define STATIC_H 3 | 4 | #include "window.h" 5 | #include "common_control.h" 6 | 7 | namespace nsObjWin32{ 8 | 9 | namespace nsGUI{ 10 | 11 | class DLLEXPORT Static : public CommonControl 12 | { 13 | public: 14 | 15 | Static(){ 16 | m_className=L"STATIC"; 17 | } 18 | virtual ~Static(){} 19 | 20 | protected: 21 | HWND Create(DWORD dwExStyle, 22 | LPCTSTR lpWindowName, 23 | DWORD dwStyle, 24 | int x, int y, 25 | int w, int h, 26 | HWND hwndParent, 27 | HMENU hMenu); 28 | }; 29 | 30 | class DLLEXPORT TextStatic : public Static 31 | { 32 | public: 33 | TextStatic(DWORD style=0, DWORD exStyle=0){ 34 | m_style|=style; 35 | m_exStyle|=exStyle; 36 | } 37 | virtual ~TextStatic(){} 38 | 39 | HWND Create(LPCTSTR lpWindowName, int x, int y, int w, int h, HWND hwndParent, int ID); 40 | 41 | private: 42 | 43 | }; 44 | 45 | /** 46 | * Bitmap static control 47 | */ 48 | class DLLEXPORT BmpStatic : public Static 49 | { 50 | public: 51 | 52 | BmpStatic(DWORD style=SS_BITMAP, DWORD exStyle=0){ 53 | m_style|=style; 54 | m_exStyle|=exStyle; 55 | } 56 | 57 | virtual ~BmpStatic(){} 58 | 59 | /** 60 | * @param lpBmpResId - Resource identifier of the bitmap to use 61 | */ 62 | HWND Create(LPCTSTR lpBmpResId, int x, int y, int w, int h, HWND hwndParent, int ID); 63 | }; 64 | 65 | class DLLEXPORT FrameStatic : public Static 66 | { 67 | public: 68 | 69 | FrameStatic(DWORD style=SS_GRAYFRAME, DWORD exStyle=0){ 70 | m_style|=style; 71 | m_exStyle|=exStyle; 72 | } 73 | 74 | virtual ~FrameStatic(){} 75 | 76 | HWND Create(LPCTSTR lpWindowName, int x, int y, int w, int h, HWND hwndParent, int ID); 77 | }; 78 | 79 | } 80 | 81 | } 82 | 83 | #endif -------------------------------------------------------------------------------- /src/lib/inih/tests/unittest.c: -------------------------------------------------------------------------------- 1 | /* inih -- unit tests 2 | 3 | This works simply by dumping a bunch of info to standard output, which is 4 | redirected to an output file (baseline_*.txt) and checked into the Subversion 5 | repository. This baseline file is the test output, so the idea is to check it 6 | once, and if it changes -- look at the diff and see which tests failed. 7 | 8 | Here's how I produced the two baseline files (with Tiny C Compiler): 9 | 10 | tcc -DINI_ALLOW_MULTILINE=1 ../ini.c -run unittest.c > baseline_multi.txt 11 | tcc -DINI_ALLOW_MULTILINE=0 ../ini.c -run unittest.c > baseline_single.txt 12 | 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include "../ini.h" 19 | 20 | int User; 21 | char Prev_section[50]; 22 | 23 | int dumper(void* user, const char* section, const char* name, 24 | const char* value) 25 | { 26 | User = (int)user; 27 | if (strcmp(section, Prev_section)) { 28 | printf("... [%s]\n", section); 29 | strncpy(Prev_section, section, sizeof(Prev_section)); 30 | Prev_section[sizeof(Prev_section) - 1] = '\0'; 31 | } 32 | printf("... %s=%s;\n", name, value); 33 | 34 | return strcmp(name, "user")==0 && strcmp(value, "parse_error")==0 ? 0 : 1; 35 | } 36 | 37 | void parse(const char* fname) { 38 | static int u = 100; 39 | int e; 40 | 41 | *Prev_section = '\0'; 42 | e = ini_parse(fname, dumper, (void*)u); 43 | printf("%s: e=%d user=%d\n", fname, e, User); 44 | u++; 45 | } 46 | 47 | int main(void) 48 | { 49 | parse("no_file.ini"); 50 | parse("normal.ini"); 51 | parse("bad_section.ini"); 52 | parse("bad_comment.ini"); 53 | parse("user_error.ini"); 54 | parse("multi_line.ini"); 55 | parse("bad_multi.ini"); 56 | parse("bom.ini"); 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/kb_video/kb_video.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/system/multithreading/mutex/cpp/mutex.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C++ MUTEX functions 3 | * C++ MUTEX functions for hard86 4 | * Stephen Zhang, 2014 5 | */ 6 | 7 | #include 8 | #include "mutex.h" 9 | 10 | /* 11 | quick note : 12 | when MUTEX is signaled -> free 13 | when object is not signaled -> owned 14 | */ 15 | 16 | Mutex::Mutex() : m_state(0){ 17 | m_nInstances=new int; 18 | (*m_nInstances)=1; 19 | m_hMutex=CreateMutex(NULL, FALSE, NULL); 20 | } 21 | 22 | Mutex::Mutex(const Mutex& src) : m_state(0){ 23 | m_nInstances=src.m_nInstances; 24 | (*m_nInstances)++; 25 | m_hMutex=src.m_hMutex; 26 | } 27 | 28 | Mutex::Mutex(void* hMutex) : m_state(0){ 29 | m_nInstances=new int; 30 | // since we are initializing from a raw handle 31 | // we don't know the lifetime of that handle. 32 | // therefore, in order to prevent usage of a released handle, 33 | // we will not attempt to use instance tracking or 34 | // releasing in the destructor. 35 | (*m_nInstances)=-1; 36 | m_hMutex=hMutex; 37 | } 38 | 39 | Mutex::~Mutex(){ 40 | if((*m_nInstances)==-1){ 41 | delete m_nInstances; 42 | return; 43 | } 44 | (*m_nInstances)--; 45 | if(!*m_nInstances){ 46 | delete m_nInstances; 47 | m_nInstances=NULL; 48 | CloseHandle(m_hMutex); 49 | } 50 | } 51 | 52 | Mutex& Mutex::operator=(const Mutex& src){ 53 | m_nInstances=src.m_nInstances; 54 | (*m_nInstances)++; 55 | m_hMutex=src.m_hMutex; 56 | return *this; 57 | } 58 | 59 | int Mutex::Lock(){ 60 | int retv=WaitForSingleObject(m_hMutex, INFINITE); 61 | m_state++; 62 | return retv; 63 | } 64 | 65 | bool Mutex::TryLock(){ 66 | DWORD dwReturn=WaitForSingleObject(m_hMutex, 0); 67 | if(dwReturn==WAIT_TIMEOUT){ 68 | return false; 69 | } 70 | m_state++; 71 | return true; 72 | } 73 | 74 | int Mutex::Unlock(){ 75 | int retv=ReleaseMutex(m_hMutex); 76 | m_state--; 77 | return retv; 78 | } 79 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/lcd_screen/kb_video.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/toolwindow.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_TOOLWINDOW_H 21 | #define HARD86_TOOLWINDOW_H 22 | 23 | #include "../../../objwin32/src/gui/userwindow.h" 24 | #include "winmanager.h" 25 | 26 | using namespace nsObjWin32::nsGUI; 27 | 28 | namespace nsHard86Win32{ 29 | class Hard86ToolWindow : public ToolWindow, public StickyWindow{ 30 | public: 31 | Hard86ToolWindow(bool& registeredFlag){ 32 | m_style|=WS_SYSMENU; 33 | m_className=L"Hard86_ToolWindow"; 34 | if(!registeredFlag){ 35 | Register(); 36 | registeredFlag=true; 37 | } 38 | } 39 | virtual ~Hard86ToolWindow(){} 40 | 41 | virtual HWND Create(int x, int y, int w, int h, HWND hwndParent, HMENU hMenu=NULL)=0; 42 | 43 | #define MSGHANDLER(name) void On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 44 | 45 | MSGHANDLER(Sizing); 46 | MSGHANDLER(Moving); 47 | MSGHANDLER(NCLButtonDown); 48 | MSGHANDLER(Close); 49 | 50 | #undef MSGHANDLER 51 | }; 52 | } 53 | 54 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/frontend_global.cpp: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "global.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | using namespace std; 27 | 28 | namespace nsHard86Win32{ 29 | 30 | /** 31 | * Write to debug 32 | */ 33 | void WriteDebug(const wchar_t* message, const wchar_t* func, const wchar_t* file, int line, bool fatal){ 34 | wfstream f("debug.log", ios_base::app); 35 | f << message << L" at " << func << L", File: " << file << L", Line: " << line << endl; 36 | if(fatal){ 37 | MessageBox(NULL, message, L"Error : check debug.log", MB_ICONERROR); 38 | } 39 | } 40 | 41 | std::wstring strtowstr(const std::string& s){ 42 | std::wstring retv; 43 | retv.resize(s.size()); 44 | for(int i=0; i 21 | #include 22 | 23 | #include "../../../emulator_engine/src/emulator_engine_interface.h" 24 | #include "../../../../system/multithreading/mutex/c/cmutex.h" 25 | 26 | using namespace std; 27 | 28 | namespace nsDeviceTest{ 29 | 30 | int VirtualDevice_Initialize(void* param1, void* param2){ 31 | cout << "VirtualDeviceTest initialized" << endl; 32 | cout << "Param 1 : " << (int)param1 << " Param 2 : " << (int)param2 << endl; 33 | return 0; 34 | } 35 | 36 | int VirtualDevice_Terminate(){ 37 | return 0; 38 | } 39 | 40 | int VirtualDevice_AcceptEmulationMutex(MUTEX sysMutex, sys_state_ptr sysState){ 41 | mutex_lock(sysMutex); 42 | cout << "[VDEVTEST]-------------------------------------------------------" << endl; 43 | cout << "VirtualDeviceTest now owns sysMutex" << endl; 44 | cout << "Test : LOBYTE of AX " << hex << (int)(sysState->ax[0]) << endl; 45 | cout << "[VDEVTEST]-------------------------------------------------------" << endl; 46 | mutex_unlock(sysMutex); 47 | return 0; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/test/test.asm: -------------------------------------------------------------------------------- 1 | org 100h 2 | 3 | jmp start 4 | 5 | ; computes n! 6 | factorial: 7 | cmp ax, 1 8 | jz @@r 9 | push ax 10 | dec ax 11 | call factorial 12 | mov bx, ax 13 | pop ax 14 | mul bx 15 | @@r: 16 | ret 17 | 18 | a db 5 dup(0xff) 19 | b db 5 dup(0) 20 | 21 | start: 22 | 23 | mov ah, 3h 24 | int 10h 25 | 26 | inc dl 27 | 28 | mov ah, 2h 29 | int 10h 30 | 31 | 32 | @@cont: 33 | 34 | mov ah, 0 35 | int 16h 36 | mov ah, 9h 37 | mov cx, 1 38 | mov bl, 0dh 39 | mov bh, 1h 40 | int 10h 41 | 42 | mov ah, 3h 43 | int 10h 44 | 45 | inc dl 46 | 47 | mov ah, 2h 48 | int 10h 49 | 50 | jmp @@cont 51 | 52 | 53 | mov al, 1 54 | mov bh, 0 55 | mov bl, 0eh 56 | mov cx, msg1end - msg1 ; calculate message size. 57 | mov dl, 10 58 | mov dh, 7 59 | push cs 60 | pop es 61 | mov bp, msg1 62 | mov ah, 13h 63 | int 10h 64 | jmp msg1end 65 | msg1 db " hello, world! my name is Hard86 8086 emulator with support for virtual devices! " 66 | msg1end: 67 | 68 | ; interrupt test 69 | mov al, 'a' 70 | mov bl, 2 71 | mov ah, 9 72 | mov cx, 81 73 | int 10h 74 | 75 | ; screen test 76 | mov ax, 0b800h 77 | mov es, ax 78 | mov si, 1 79 | mov al, 'A' 80 | mov [es:si], al 81 | 82 | 83 | ; test of xchg 84 | mov ax, 5 85 | mov bx, 6 86 | xchg ax, bx 87 | 88 | ; test of string ops 89 | 90 | lea si, [a] 91 | lea di, [b] 92 | 93 | mov cx, 5 94 | 95 | rep movsb 96 | 97 | mov ax, 5 98 | mov bx, ds 99 | mov es, bx 100 | lea di, [b] 101 | mov cx, 5 102 | rep stosb 103 | 104 | ; in/out test 105 | mov cx, 0xffff 106 | @@start: 107 | xor ax, ax 108 | mov al, cl 109 | shl ax, 4 110 | out 5, ax 111 | 112 | dec cx 113 | cmp cx, 0 114 | jne @@start 115 | 116 | ret 117 | 118 | ; parameter : ax = n 119 | ; calculate 5! 120 | mov cx, 1 121 | mov ah, 9h 122 | mov al, 'a' 123 | int 10h 124 | mov ax, 100 125 | call factorial 126 | 127 | 128 | ret -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/8bit_led/kb_video.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | Resource Files 21 | 22 | 23 | Resource Files 24 | 25 | 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | 49 | 50 | Resource Files 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/statusbar.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_STATUSBAR_H 21 | #define HARD86_STATUSBAR_H 22 | 23 | #include "../../../objwin32/src/gui/userwindow.h" 24 | #include "winmanager.h" 25 | 26 | namespace nsHard86Win32{ 27 | 28 | using namespace nsObjWin32::nsGUI; 29 | 30 | class StatusBar : public UserWindow{ 31 | public: 32 | static const int DEF_H=16; 33 | 34 | StatusBar(){ 35 | m_style|=WS_CHILD; 36 | m_className=L"Hard86_StatusBar"; 37 | if(!m_registered){ 38 | Register(); 39 | m_registered=true; 40 | } 41 | } 42 | 43 | virtual ~StatusBar(){ 44 | 45 | } 46 | 47 | ATOM Register(); 48 | 49 | HWND Create(int x, int y, int w, HWND hwndParent, int ID); 50 | 51 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 52 | 53 | void SetStatus(wchar_t* status); 54 | void SetInfo(wchar_t* info); 55 | private: 56 | 57 | enum Children{ 58 | STATUS, INFO 59 | }; 60 | 61 | WinManager m_children; 62 | 63 | template 64 | T*& Child(int id){ 65 | return (T*&)m_children[id]; 66 | } 67 | 68 | static bool m_registered; 69 | }; 70 | 71 | } 72 | 73 | #endif -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "global.h" 4 | #include "window.h" 5 | #include "frame.h" 6 | #include "progressbar.h" 7 | #include "button.h" 8 | #include "static.h" 9 | #include "dialog.h" 10 | #include "scrollbar.h" 11 | 12 | #include "../../vs2010/win32_generic_unit/win32_generic_unit/resource.h" 13 | #include "../../vs2010/win32_generic_unit/win32_generic_unit/resource1.h" 14 | 15 | using namespace nsObjWin32::nsGUI; 16 | 17 | class MainFrame : public Frame 18 | { 19 | public: 20 | MainFrame(){ 21 | this->m_className=L"MainFrame"; 22 | } 23 | 24 | virtual ~MainFrame(){} 25 | 26 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ 27 | switch(uMsg){ 28 | case WM_CREATE: 29 | { 30 | 31 | } 32 | break; 33 | case WM_COMMAND: 34 | { 35 | 36 | } 37 | break; 38 | case WM_DESTROY: 39 | SendMessage(WM_CLOSE, NULL, NULL); 40 | break; 41 | case WM_CLOSE: 42 | PostQuitMessage(WM_QUIT); 43 | default: 44 | return DefWindowProc(hWnd, uMsg, wParam, lParam); 45 | } 46 | return 0; 47 | } 48 | }; 49 | 50 | int CALLBACK WinMain(HINSTANCE hInstance, 51 | HINSTANCE hPrevInstance, 52 | LPSTR lpCmdLine, 53 | int nCmdShow) 54 | { 55 | Window::SetHInstance(hInstance); 56 | 57 | MainFrame frm; 58 | frm.Register(); 59 | frm.Create(320, 200); 60 | frm.Show(SW_SHOWDEFAULT); 61 | 62 | ScrollBar sb; 63 | sb.Create(0, 0, 100, WindowHeight(frm), frm.GetHWND(), 1002); 64 | sb.Show(SW_SHOWDEFAULT); 65 | 66 | RetroProgressBar pb; 67 | pb.Register(); 68 | pb.Create(frm.GetHWND(), ClientWidth(frm.GetHWND()), 24); 69 | pb.Show(SW_SHOWDEFAULT); 70 | 71 | pb.SendMessage(pb.CPM_SETPOS, 20, NULL); 72 | pb.SendMessage(pb.CPM_SETTEXT, (WPARAM)L"RetroProgressBar", NULL); 73 | 74 | HBITMAP hBmp; 75 | hBmp=LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)); 76 | 77 | PushButton bn; 78 | bn.Create(L"Text", 0, 48, 80, 24, frm.GetHWND(), 1001); 79 | bn.Show(SW_SHOWDEFAULT); 80 | bn.SetEnabled(false); 81 | 82 | MSG msg; 83 | while(GetMessage(&msg, NULL, 0, 0)){ 84 | TranslateMessage(&msg); 85 | DispatchMessage(&msg); 86 | } 87 | return 0; 88 | } -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/global.cpp: -------------------------------------------------------------------------------- 1 | #include "global.h" 2 | 3 | namespace nsObjWin32{ 4 | 5 | namespace nsGUI{ 6 | 7 | int RectWidth(const RECT& rc){ 8 | return (rc.right-rc.left); 9 | } 10 | 11 | int RectHeight(const RECT& rc){ 12 | return (rc.bottom-rc.top); 13 | } 14 | 15 | int WindowWidth(HWND hWnd){ 16 | static RECT rc; 17 | GetWindowRect(hWnd, &rc); 18 | return RectWidth(rc); 19 | } 20 | 21 | int WindowHeight(HWND hWnd){ 22 | static RECT rc; 23 | GetWindowRect(hWnd, &rc); 24 | return RectHeight(rc); 25 | } 26 | 27 | int WindowWidth(const Window& w){ 28 | return WindowWidth(w.GetHWND()); 29 | } 30 | 31 | int WindowHeight(const Window& w){ 32 | return WindowHeight(w.GetHWND()); 33 | } 34 | 35 | int ClientWidth(HWND hWnd){ 36 | static RECT rc; 37 | GetClientRect(hWnd, &rc); 38 | return RectWidth(rc); 39 | } 40 | 41 | int ClientHeight(HWND hWnd){ 42 | static RECT rc; 43 | GetClientRect(hWnd, &rc); 44 | return RectHeight(rc); 45 | } 46 | 47 | int WindowX(HWND hWnd){ 48 | static RECT rc; 49 | GetWindowRect(hWnd, &rc); 50 | return (rc.left); 51 | } 52 | 53 | int WindowY(HWND hWnd){ 54 | static RECT rc; 55 | GetWindowRect(hWnd, &rc); 56 | return (rc.top); 57 | } 58 | 59 | int ClientX(HWND hWnd){ 60 | static RECT rc; 61 | GetClientRect(hWnd, &rc); 62 | return (rc.left); 63 | } 64 | 65 | int ClientY(HWND hWnd){ 66 | static RECT rc; 67 | GetClientRect(hWnd, &rc); 68 | return (rc.top); 69 | } 70 | 71 | int SetWindowSize(HWND hWnd, int w, int h){ 72 | return MoveWindow(hWnd, WindowX(hWnd), WindowY(hWnd), w, h, true); 73 | } 74 | 75 | int SetChildWindowSize(HWND hWnd, int w, int h){ 76 | return MoveWindow(hWnd, ClientX(hWnd), ClientY(hWnd), w, h, true); 77 | } 78 | 79 | int SetWindowXY(HWND hWnd, int x, int y){ 80 | return MoveWindow(hWnd, x, y, WindowWidth(hWnd), WindowHeight(hWnd), true); 81 | } 82 | 83 | // Font functions 84 | int FontHeight(HDC hDC){ 85 | static TEXTMETRIC tm; 86 | GetTextMetrics(hDC, &tm); 87 | return tm.tmHeight; 88 | } 89 | 90 | int FontWidth(HDC hDC){ 91 | static TEXTMETRIC tm; 92 | GetTextMetrics(hDC, &tm); 93 | return tm.tmAveCharWidth; 94 | } 95 | 96 | } 97 | 98 | } -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/bp_list.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_BP_LIST_H 21 | #define HARD86_BP_LIST_H 22 | 23 | #include 24 | #include "../global.h" 25 | #include "toolwindow.h" 26 | #include "../../../objwin32/src/gui/listbox.h" 27 | 28 | namespace nsHard86Win32{ 29 | 30 | class BPList : public Hard86ToolWindow{ 31 | public: 32 | BPList(); 33 | 34 | virtual ~BPList(){ 35 | DestroyWindow(m_hWnd); 36 | } 37 | 38 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 39 | 40 | HWND Create(int x, int y, int w, int h, HWND hwndParent, HMENU hMenu=NULL){ 41 | Window::Create(m_exStyle, L"Breakpoints", m_style, x, y, w, h, hwndParent, hMenu); 42 | Show(); 43 | return m_hWnd; 44 | } 45 | 46 | void Update(); 47 | 48 | private: 49 | 50 | #define MSGHANDLER(name) void On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 51 | 52 | MSGHANDLER(Create); 53 | MSGHANDLER(Command); 54 | MSGHANDLER(VScroll); 55 | 56 | #undef MSGHANDLER 57 | 58 | void CreateChildren(HWND hWnd); 59 | 60 | enum Children{ 61 | LISTBOX 62 | }; 63 | 64 | WinManager m_children; 65 | 66 | template 67 | T*& Child(int id){ 68 | return (T*&)m_children[id]; 69 | } 70 | 71 | static bool m_registered; 72 | }; 73 | 74 | } 75 | 76 | #endif -------------------------------------------------------------------------------- /src/system/datastruct/clist/clist.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file C linked list 3 | * Stephen Zhang, 2014 4 | */ 5 | 6 | #include 7 | #include "clist.h" 8 | 9 | clist clist_create(){ 10 | clist c; 11 | c.begin=c.curr=c.end=0; /* initialize to NULL */ 12 | return c; 13 | } 14 | 15 | static void join(clist_node* a, clist_node* b){ 16 | /* joins two nodes */ 17 | if(a){ 18 | a->next=b; 19 | } 20 | if(b){ 21 | b->prev=a; 22 | } 23 | } 24 | 25 | void clist_push_back(clist* c, void* data){ 26 | clist_node* e=(clist_node*)malloc(sizeof(clist_node)); 27 | if(!e){ 28 | abort(); 29 | } 30 | e->data=data; 31 | e->prev=0; 32 | e->next=0; 33 | if(c->end==0 && c->begin==0){ 34 | /* special case - empty list */ 35 | c->begin=c->end=e; 36 | return; 37 | } 38 | join(c->end, e); 39 | c->end=e; 40 | } 41 | 42 | void clist_push_front(clist* c, void* data){ 43 | clist_node* e=(clist_node*)malloc(sizeof(clist_node)); 44 | if(!e){ 45 | abort(); 46 | } 47 | e->data=data; 48 | e->prev=0; 49 | e->next=0; 50 | if(c->end==0 && c->begin==0){ 51 | /* special case - empty list */ 52 | c->begin=c->end=e; 53 | return; 54 | } 55 | join(e, c->begin); 56 | c->begin=e; 57 | } 58 | 59 | void clist_pop_back(clist* c){ 60 | clist_node* e=c->end->prev; 61 | free(c->end->data); 62 | free(c->end); 63 | c->end=e; 64 | } 65 | 66 | void clist_pop_front(clist* c){ 67 | clist_node* e=c->begin->next; 68 | free(c->begin->data); 69 | free(c->begin); 70 | c->begin=e; 71 | } 72 | 73 | void* clist_getcurr(clist* c){ 74 | return c->curr->data; 75 | } 76 | 77 | void clist_begin(clist* c){ 78 | c->curr=c->begin; 79 | } 80 | 81 | void clist_end(clist* c){ 82 | c->curr=c->end; 83 | } 84 | 85 | int clist_next(clist* c){ 86 | if(c->curr->next){ 87 | c->curr=c->curr->next; 88 | return 0; 89 | } 90 | return -1; 91 | } 92 | 93 | void clist_prev(clist* c){ 94 | if(c->curr->prev){ 95 | c->curr=c->curr->prev; 96 | } 97 | } 98 | 99 | void clist_destroy(clist* c){ 100 | clist_node* e=c->begin; 101 | while(e!=0){ 102 | clist_node* n; 103 | free(e->data); 104 | n=e->next; 105 | free(e); 106 | e=n; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/vdev/io_port_watcher/io_port_watcher/io_port_watcher.cpp: -------------------------------------------------------------------------------- 1 | // io_port_watcher.cpp : Defines the exported functions for the DLL application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | #include 7 | 8 | HANDLE mainThread=NULL; 9 | 10 | unsigned short portNum=0; 11 | static unsigned short portVal=0; 12 | 13 | bool readWord=false; // 16 bit? 14 | 15 | HWND hDlg=NULL; 16 | HANDLE hMainThread=NULL; 17 | 18 | #define UPDATE_PORT_VAL WM_USER+1 19 | 20 | INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ 21 | 22 | switch(uMsg){ 23 | case WM_INITDIALOG: 24 | ::hDlg=hWnd; 25 | SetTimer(hWnd, 0, 30, NULL); 26 | break; 27 | case WM_TIMER: 28 | SetDlgItemInt(hWnd, IDC_PORTVAL, portVal, FALSE); 29 | break; 30 | case WM_COMMAND: 31 | switch(LOWORD(wParam)){ 32 | case IDC_GO: 33 | { 34 | portNum=GetDlgItemInt(hWnd, IDC_PORTNUM, NULL, FALSE); 35 | SetDlgItemInt(hWnd, IDC_PORTNUM, (unsigned long)portNum, FALSE); 36 | } 37 | break; 38 | case IDC_16: 39 | readWord=Button_GetCheck(GetDlgItem(hWnd, IDC_16)); 40 | break; 41 | } 42 | break; 43 | case UPDATE_PORT_VAL: 44 | SetDlgItemInt(hWnd, IDC_PORTVAL, (unsigned long)portVal, FALSE); 45 | break; 46 | case WM_DESTROY: 47 | case WM_CLOSE: 48 | case WM_QUIT: 49 | EndDialog(hWnd, WM_QUIT); 50 | break; 51 | default: 52 | break; 53 | } 54 | return 0; 55 | } 56 | 57 | DWORD CALLBACK MainThread(LPVOID lpParam){ 58 | DialogBox(::hModule, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc); 59 | return 0; 60 | } 61 | 62 | int VirtualDevice_AcceptEmulationMutex(MUTEX a, sys_state_ptr b) 63 | { 64 | if(::hDlg){ 65 | if(readWord){ 66 | portVal=b->io_bus[portNum]; 67 | portVal<<=8; 68 | if(portNum<65535){ 69 | portVal|=b->io_bus[portNum+1]; 70 | } 71 | }else{ 72 | portVal=b->io_bus[portNum]; 73 | } 74 | } 75 | return 0; 76 | } 77 | 78 | int VirtualDevice_Terminate() 79 | { 80 | MessageBoxA(NULL, "Terminating", NULL, NULL); 81 | DestroyWindow(::hDlg); 82 | WaitForSingleObject(hMainThread, INFINITE); 83 | return 0; 84 | } 85 | 86 | int VirtualDevice_Initialize(void* a, void* b) 87 | { 88 | mainThread=CreateThread(NULL, NULL, MainThread, NULL, NULL, NULL); 89 | return 0; 90 | } -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/stack_watcher.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_STACK_WATCHER_H 21 | #define HARD86_STACK_WATCHER_H 22 | 23 | #include 24 | #include "../global.h" 25 | #include "toolwindow.h" 26 | #include "codelist.h" 27 | #include "../../../objwin32/src/gui/scrollbar.h" 28 | 29 | namespace nsHard86Win32{ 30 | 31 | class StackWatcher : public Hard86ToolWindow{ 32 | public: 33 | StackWatcher(); 34 | 35 | virtual ~StackWatcher(){ 36 | DestroyWindow(m_hWnd); 37 | } 38 | 39 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 40 | 41 | HWND Create(int x, int y, int w, int h, HWND hwndParent, HMENU hMenu=NULL){ 42 | Window::Create(m_exStyle, L"Stack", m_style, x, y, w, h, hwndParent, hMenu); 43 | Show(); 44 | return m_hWnd; 45 | } 46 | 47 | private: 48 | 49 | #define MSGHANDLER(name) void On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 50 | 51 | MSGHANDLER(Create); 52 | MSGHANDLER(Command); 53 | MSGHANDLER(VScroll); 54 | 55 | #undef MSGHANDLER 56 | 57 | bool m_enabled; 58 | 59 | void CreateChildren(HWND hWnd); 60 | 61 | enum Children{ 62 | CODELIST, 63 | SCROLLBAR 64 | }; 65 | 66 | WinManager m_children; 67 | 68 | template 69 | T*& Child(int id){ 70 | return (T*&)m_children[id]; 71 | } 72 | 73 | static bool m_registered; 74 | }; 75 | 76 | } 77 | 78 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/global.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_WIN32_GLOBAL_H 21 | #define HARD86_WIN32_GLOBAL_H 22 | 23 | #include 24 | 25 | #include "../../../../global/defines.h" 26 | #include "../../../../global/typedefs.h" 27 | 28 | namespace nsHard86Win32{ 29 | 30 | enum AppWindows{ WND_MAINFRAME }; 31 | 32 | void WriteDebug(const wchar_t* message, const wchar_t* func, const wchar_t* file, int line, bool fatal=false); 33 | 34 | #define OUT_DEBUG(msg) WriteDebug(L"Error : "L##msg, __FUNCTIONW__, __FILEW__, __LINE__) 35 | #define OUT_DEBUG_FATAL(msg) WriteDebug(L"Error : "L##msg, __FUNCTIONW__, __FILEW__, __LINE__, true) 36 | 37 | /** 38 | * Convert RGB to COLORREF 39 | */ 40 | #define RGB2COLORREF(rgb) RGB((rgb & 0xff0000)>>16, (rgb & 0xff00)>>8, (rgb & 0xff)) 41 | 42 | /** 43 | * Convert wstring to string 44 | */ 45 | std::string wstrtostr(const std::wstring& w); 46 | 47 | /** 48 | * Convert string to wstring 49 | */ 50 | std::wstring strtowstr(const std::string& s); 51 | 52 | /** 53 | * Special window message H86_UPDATE_SYS_DATA 54 | * Informs window to update emulated system data 55 | * WPARAM - system mutex handle 56 | * LPARAM - system state struct pointer 57 | */ 58 | #define H86_UPDATE_SYS_DATA WM_USER+1 59 | #define H86_BREAKPOINT_HIT WM_USER+2 60 | #define H86_TERMINATE WM_USER+3 61 | #define H86_USER_INPUT WM_USER+4 62 | 63 | } 64 | 65 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/winmanager.cpp: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "winmanager.h" 21 | namespace nsHard86Win32{ 22 | 23 | WinManager::WinManager(const wchar_t* defFontName, int defFontHeight){ 24 | m_defFont=CreateFont(defFontHeight, 25 | NULL, 26 | 0, 0, FW_DONTCARE, 0, 0, 0, 27 | DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 28 | CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, 29 | FF_DONTCARE, defFontName); 30 | if(!m_defFont){ 31 | MessageBox(NULL, L"Error : WinManager::WinManager() - m_defFont==NULL", L"Error", MB_ICONERROR); 32 | } 33 | } 34 | 35 | WinManager::~WinManager(){ 36 | for(map::iterator it=m_wndMap.begin(); 37 | it!=m_wndMap.end(); 38 | ++it){ 39 | delete (*it).second; 40 | } 41 | DeleteFont(m_defFont); 42 | } 43 | 44 | bool WinManager::SetDefFont(int id){ 45 | if(!Exists(id)) return false; 46 | m_wndMap[id]->SendMessage(WM_SETFONT, (WPARAM)m_defFont, true); 47 | } 48 | 49 | bool WinManager::AddWindow(int id, Window* win){ 50 | if(m_wndMap.count(id)>0) return false; // cannot replace existing 51 | m_wndMap[id]=win; 52 | } 53 | 54 | bool WinManager::RemoveWindow(int id){ 55 | if(m_wndMap.count(id)) return false; // non existent 56 | m_wndMap.erase(id); 57 | return true; 58 | } 59 | 60 | bool WinManager::SetFont(int id, HFONT font){ 61 | if(m_wndMap.count(id)) return false; 62 | m_wndMap[id]->SendMessage(WM_SETFONT, (WPARAM)font, FALSE); 63 | return true; 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/lib/inih/cpp/INIReader.h: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 4 | // Go to the project home page for more info: 5 | // 6 | // http://code.google.com/p/inih/ 7 | 8 | #ifndef __INIREADER_H__ 9 | #define __INIREADER_H__ 10 | 11 | #include 12 | #include 13 | 14 | // Read an INI file into easy-to-access name/value pairs. (Note that I've gone 15 | // for simplicity here rather than speed, but it should be pretty decent.) 16 | class INIReader 17 | { 18 | public: 19 | // Construct INIReader and parse given filename. See ini.h for more info 20 | // about the parsing. 21 | INIReader(std::string filename); 22 | 23 | // Return the result of ini_parse(), i.e., 0 on success, line number of 24 | // first error on parse error, or -1 on file open error. 25 | int ParseError(); 26 | 27 | // Get a string value from INI file, returning default_value if not found. 28 | std::string Get(std::string section, std::string name, 29 | std::string default_value); 30 | 31 | // Get an integer (long) value from INI file, returning default_value if 32 | // not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). 33 | long GetInteger(std::string section, std::string name, long default_value); 34 | 35 | // Get a real (floating point double) value from INI file, returning 36 | // default_value if not found or not a valid floating point value 37 | // according to strtod(). 38 | double GetReal(std::string section, std::string name, double default_value); 39 | 40 | // Get a boolean value from INI file, returning default_value if not found or if 41 | // not a valid true/false value. Valid true values are "true", "yes", "on", "1", 42 | // and valid false values are "false", "no", "off", "0" (not case sensitive). 43 | bool GetBoolean(std::string section, std::string name, bool default_value); 44 | 45 | private: 46 | int _error; 47 | std::map _values; 48 | static std::string MakeKey(std::string section, std::string name); 49 | static int ValueHandler(void* user, const char* section, const char* name, 50 | const char* value); 51 | }; 52 | 53 | #endif // __INIREADER_H__ 54 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_H 2 | #define DIALOG_H 3 | 4 | #include 5 | #include "window.h" 6 | #include "global.h" 7 | 8 | namespace nsObjWin32{ 9 | 10 | namespace nsGUI{ 11 | 12 | class DLLEXPORT Dialog{ 13 | public: 14 | 15 | Dialog() 16 | { 17 | m_hWnd=0; 18 | m_resId=0; 19 | } 20 | 21 | virtual ~Dialog(){} 22 | 23 | static INT_PTR CALLBACK Base_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 24 | 25 | virtual HWND Create(HWND hwndParent=NULL); 26 | 27 | void Dialog::CreateNoReturn(HWND hwndParent=NULL); 28 | 29 | virtual INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)=0; 30 | 31 | LRESULT SendMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 32 | 33 | HWND GetHWND(){ return m_hWnd; } 34 | 35 | // Exactly the same as in Window 36 | 37 | int GetText(wchar_t lpBuffer[]) const{ 38 | return GetWindowText(m_hWnd, lpBuffer, 80); 39 | } 40 | 41 | int SetText(const wchar_t* lpName) const{ 42 | return SetWindowText(m_hWnd, lpName); 43 | } 44 | 45 | int GetTextLength() const{ 46 | return GetWindowTextLength(m_hWnd); 47 | } 48 | 49 | std::wstring GetText() const{ 50 | wchar_t* buffer=new wchar_t[GetTextLength()]; 51 | GetText(buffer); 52 | std::wstring retv(buffer); 53 | delete[] buffer; 54 | return retv; 55 | } 56 | 57 | inline int WindowWidth(){ return nsGUI::WindowWidth(m_hWnd); } 58 | inline int WindowHeight(){ return nsGUI::WindowHeight(m_hWnd); } 59 | inline int ClientWidth(){ return nsGUI::ClientWidth(m_hWnd); } 60 | inline int ClientHeight(){ return nsGUI::ClientHeight(m_hWnd); } 61 | inline int XPos(){ return nsGUI::WindowX(m_hWnd); } 62 | inline int YPos(){ return nsGUI::WindowY(m_hWnd); } 63 | inline int SetSize(int w, int h){ return SetWindowSize(m_hWnd, w, h); } 64 | inline int SetWidth(int w){ return SetSize(w, WindowWidth()); } 65 | inline int SetHeight(int h){ return SetSize(WindowHeight(), h); } 66 | inline int SetXY(int x, int y){ return nsGUI::SetWindowXY(m_hWnd, x, y); } 67 | inline int SetX(int x){ return SetXY(x, YPos()); } 68 | inline int SetY(int y){ return SetXY(XPos(), y); } 69 | 70 | protected: 71 | HWND m_hWnd; 72 | HINSTANCE m_hInstance; 73 | 74 | DWORD m_resId; 75 | private: 76 | }; 77 | 78 | } 79 | 80 | } 81 | 82 | #endif -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/button.h: -------------------------------------------------------------------------------- 1 | #ifndef BUTTON_H 2 | #define BUTTON_H 3 | 4 | #include "common_control.h" 5 | #include 6 | #include 7 | 8 | namespace nsObjWin32{ 9 | 10 | namespace nsGUI{ 11 | 12 | /** 13 | * Button base class 14 | */ 15 | class DLLEXPORT Button : public CommonControl 16 | { 17 | public: 18 | 19 | Button(){ 20 | m_className=L"BUTTON"; 21 | } 22 | 23 | virtual ~Button(){} 24 | 25 | LRESULT GetState(){ return Button_GetState(m_hWnd); } 26 | 27 | LRESULT SetState(BOOL state){ return Button_SetState(m_hWnd, state); } 28 | 29 | void SetStyle(DWORD dwStyle, BOOL fRedraw=FALSE){ return Button_SetStyle(m_hWnd, dwStyle, fRedraw); } 30 | 31 | static const int DEF_H=20; 32 | static const int DEF_W=84; 33 | 34 | protected: 35 | 36 | HWND Create(DWORD dwExStyle, 37 | LPCTSTR lpWindowName, 38 | DWORD dwStyle, 39 | int x, int y, 40 | int w, int h, 41 | HWND hwndParent, 42 | HMENU hMenu); 43 | 44 | private: 45 | }; 46 | 47 | class DLLEXPORT PushButton : public Button 48 | { 49 | public: 50 | 51 | PushButton(DWORD style=BS_PUSHBUTTON, DWORD exStyle=0){ 52 | m_style|=style; 53 | m_exStyle|=exStyle; 54 | } 55 | 56 | virtual ~PushButton(){} 57 | 58 | HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID); 59 | 60 | protected: 61 | 62 | private: 63 | }; 64 | 65 | class DLLEXPORT CheckBox : public Button 66 | { 67 | public: 68 | 69 | CheckBox(DWORD style=BS_CHECKBOX, DWORD exStyle=0){ 70 | m_style|=style; 71 | m_exStyle|=exStyle; 72 | } 73 | 74 | virtual ~CheckBox(){} 75 | 76 | HWND Create(LPCTSTR lpName, int x, int y, int w, int h, HWND hwndParent, int ID); 77 | 78 | void SetCheck(int check){ Button_SetCheck(m_hWnd, check); } 79 | 80 | LRESULT GetCheck(){ return Button_GetCheck(m_hWnd); } 81 | }; 82 | 83 | class DLLEXPORT BmpPushButton : public PushButton 84 | { 85 | public: 86 | 87 | BmpPushButton(DWORD style, DWORD exStyle=0){ 88 | m_style|=style|BS_BITMAP; 89 | m_exStyle|=exStyle; 90 | } 91 | 92 | virtual ~BmpPushButton(){} 93 | 94 | HBITMAP SetImage(HBITMAP hBmp){ 95 | return (HBITMAP)SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp); 96 | } 97 | }; 98 | } 99 | 100 | } 101 | 102 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/winmain.cpp: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "winmain.h" 21 | #include "windows/mainframe.h" 22 | #include "windows/winmanager.h" 23 | 24 | using namespace nsObjWin32::nsGUI; 25 | using namespace nsHard86Win32; 26 | 27 | Application* Application::m_instance=NULL; 28 | HINSTANCE Application::hInstance=NULL; 29 | HACCEL Application::hMainAccel=NULL; 30 | 31 | namespace nsHard86Win32{ 32 | wstring& GetAppDir(){ return Application::GetAppDirectory(); } 33 | } 34 | 35 | int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 36 | { 37 | 38 | Application* app=Application::GetInstance(hInstance); 39 | app->mainFrame=new MainFrame(); 40 | app->mainFrame->Register(); 41 | app->mainFrame->Create(480, 640, CW_USEDEFAULT, CW_USEDEFAULT); 42 | app->winManager.AddWindow(WND_MAINFRAME, app->mainFrame); 43 | app->mainFrame->Show(); 44 | 45 | /*if(numArgs > 1){ 46 | // looks like there is a second argument - the file to open 47 | if(File::GetExt(wstring(cmdLineArgs[1]))==wstring(L"h86")){ 48 | app->mainFrame->LoadProjectToFrontend(wstring(cmdLineArgs[1])); 49 | } 50 | else{ 51 | app->mainFrame->LoadFileToEmulator(wstring(cmdLineArgs[1]), wstring(L"")); 52 | }; 53 | }*/ 54 | 55 | 56 | MSG msg; 57 | while(GetMessage(&msg, NULL, NULL, NULL)){ 58 | if(!TranslateAccelerator(app->mainFrame->GetHWND(), Application::hMainAccel, &msg)) 59 | TranslateMessage(&msg); 60 | DispatchMessage(&msg); 61 | } 62 | 63 | delete app; 64 | return 0; 65 | } -------------------------------------------------------------------------------- /src/emulator/debugger_engine/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "debugger.h" 4 | 5 | #include "../../emulator_engine/src/cpp_interface/emulator_cpp.h" 6 | #include "../../emulator_engine/src/dasm/dasm_cpp.h" 7 | #include "../../symbols_loader/src/sym_loader.h" 8 | #include "../../../global/defines.h" 9 | #include "../../../global/typedefs.h" 10 | #include "../../../system/multithreading/mutex/cpp/mutex.h" 11 | 12 | #include "device_test/device_test.h" 13 | 14 | using namespace std; 15 | 16 | using namespace nsDebugger; 17 | using namespace nsVDev; 18 | using namespace nsDasm; 19 | using namespace nsEmulator; 20 | using namespace nsSymLoader; 21 | 22 | long fsize(FILE *stream) 23 | { 24 | long curpos, length; 25 | curpos=ftell(stream); 26 | fseek(stream, 0L, SEEK_END); 27 | length=ftell(stream); 28 | fseek(stream, curpos, SEEK_SET); 29 | return length; 30 | } 31 | 32 | int main(){ 33 | Mutex sysMutex; 34 | VDevList* vdevList=VDevList::GetInstance(); 35 | VDev testDev(nsDeviceTest::VirtualDevice_Initialize, 36 | nsDeviceTest::VirtualDevice_Terminate, 37 | nsDeviceTest::VirtualDevice_AcceptEmulationMutex, 38 | (void*)22, (void*)24); 39 | vdevList->Add(testDev); 40 | Debugger::Init(vdevList); 41 | Debugger* dbg=Debugger::GetInstance(); 42 | FILE* in_file=fopen("test/test.com", "r"); 43 | int size=fsize(in_file); 44 | uint8* data=(uint8*)malloc(size); 45 | fread(data, 1, size, in_file); 46 | fclose(in_file); 47 | 48 | // load FAS symbols file 49 | uint8* fas_data; 50 | int fas_size; 51 | { 52 | FILE* fas_file=fopen("test/test.fas", "r"); 53 | fas_size=fsize(fas_file); 54 | fas_data=(uint8*)malloc(fas_size); 55 | fread(fas_data, 1, fas_size, fas_file); 56 | fclose(fas_file); 57 | } 58 | 59 | SymbolData symbolData(fas_data, fas_size); 60 | 61 | sysMutex.Unlock(); 62 | 63 | Emulator& emulator=*Emulator::GetInstance(sysMutex, 64 | Debugger::BreakPointHit, 65 | Debugger::PreInstructionExecute, 66 | Debugger::PostInstructionExecute, 67 | data, 68 | size); 69 | 70 | 71 | Disassembler dasm; 72 | DasmList l=dasm.Disassemble(100, emulator.ReadReg(Regs::ip), emulator.ReadReg(Regs::cs), symbolData); 73 | for(DasmList::iterator it=l.begin(); 74 | it!=l.end(); 75 | ++it){ 76 | cout << "DASM :: " << hex << it->GetAddr() << " : " << it->GetLine() << endl; 77 | } 78 | 79 | emulator.Execute(); 80 | 81 | emulator.Reset(); 82 | 83 | free(data); 84 | 85 | return 0; 86 | } -------------------------------------------------------------------------------- /src/system/multithreading/mutex/c/mutex.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1393756272 source:c:\documents and settings\stephen\desktop\8086-emulator\src\test\mutex\c\main.c 3 | 4 | 5 | 6 | 7 | "mutex.h" 8 | "../../thread/c/thread.h" 9 | 10 | 1393753405 source:c:\documents and settings\stephen\desktop\8086-emulator\src\test\mutex\c\mutex.c 11 | 12 | "mutex.h" 13 | 14 | 1393755220 c:\documents and settings\stephen\desktop\8086-emulator\src\test\mutex\c\mutex.h 15 | 16 | 1393752672 c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\c\thread.h 17 | 18 | 19 | 1393752694 source:c:\documents and settings\stephen\desktop\8086-emulator\src\test\thread\c\thread.c 20 | 21 | "thread.h" 22 | 23 | 1394253838 source:g:\code\projects\repositories\hard86\hard86\src\test\mutex\c\mutex.c 24 | 25 | "mutex.h" 26 | 27 | 1394253867 g:\code\projects\repositories\hard86\hard86\src\test\mutex\c\mutex.h 28 | 29 | 1394254093 source:g:\code\projects\repositories\hard86\hard86\src\test\thread\c\thread.c 30 | 31 | "thread.h" 32 | 33 | 1394254120 g:\code\projects\repositories\hard86\hard86\src\test\thread\c\thread.h 34 | 35 | 36 | 1394253896 source:g:\code\projects\repositories\hard86\hard86\src\test\mutex\c\main.c 37 | 38 | 39 | 40 | 41 | "mutex.h" 42 | "../../thread/c/thread.h" 43 | 44 | 1394253896 source:g:\code\projects\repositories\hard86\hard86\src\system\mutex\c\main.c 45 | 46 | 47 | 48 | 49 | "mutex.h" 50 | "../../thread/c/thread.h" 51 | 52 | 1394253867 g:\code\projects\repositories\hard86\hard86\src\system\mutex\c\mutex.h 53 | 54 | 1394254874 g:\code\projects\repositories\hard86\hard86\src\system\thread\c\thread.h 55 | 56 | 57 | 1394270639 source:g:\code\projects\repositories\hard86\hard86\src\system\multithreading\mutex\c\mutex.c 58 | 59 | "mutex.h" 60 | "../../../../global/defines.h" 61 | "../../../../global/typedefs.h" 62 | 63 | 1394270633 g:\code\projects\repositories\hard86\hard86\src\system\multithreading\mutex\c\mutex.h 64 | "../../../../global/defines.h" 65 | "../../../../global/typedefs.h" 66 | 67 | 1394270502 g:\code\projects\repositories\hard86\hard86\src\global\defines.h 68 | 69 | 1394270492 g:\code\projects\repositories\hard86\hard86\src\global\typedefs.h 70 | 71 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/progressbar.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSBAR_H 2 | #define PROGRESSBAR_H 3 | 4 | #include 5 | #include "userwindow.h" 6 | #include "global.h" 7 | 8 | namespace nsObjWin32{ 9 | 10 | namespace nsGUI{ 11 | 12 | /** 13 | * Custom progress bar 14 | * Window Messages 15 | * ~~~~~~~~~~~~~~~ 16 | * CPM_SETRANGE - Sets range. 17 | * wParam - Minimum range value 18 | * lParam - Maximum range value 19 | * 20 | * CPM_SETPOS - Sets position 21 | * wParam - position 22 | * 23 | * CPM_GETRANGE - Returns range 24 | * wParam - If true, return max. If false, return min. 25 | * 26 | * CPM_GETPOS - Returns position 27 | * 28 | * CPM_SETCOLOR - Sets color 29 | * wParam - COLORREF value for color 30 | * 31 | * CPM_SETTEXT - Sets text 32 | * wParam - LPWSTR pointer to text (will be copied) 33 | * 34 | * CPM_SETTEXTCOLOR - Sets text color 35 | * wParam - COLORREF value for color 36 | * 37 | * CPM_SETBKCOLOR - Sets background color 38 | * wParam - COLORREF value for color 39 | */ 40 | 41 | class DLLEXPORT RetroProgressBar : public UserWindow{ 42 | public: 43 | 44 | // Custom window messages 45 | enum{ 46 | CPM_SETRANGE=WM_USER+1, CPM_GETRANGE, CPM_SETPOS, CPM_GETPOS, 47 | CPM_SETCOLOR, CPM_SETTEXT, CPM_SETTEXTCOLOR, CPM_SETBKCOLOR 48 | }; 49 | 50 | RetroProgressBar(){ 51 | m_className=L"RetroProgressBar_Class"; 52 | m_rangeMin=0; 53 | m_rangeMax=100; 54 | m_value=0; 55 | m_color=RGB(0, 0, 0); 56 | m_textColor=RGB(120, 120, 120); 57 | m_bkColor=RGB(255, 255, 255); 58 | m_text=new wchar_t[1]; 59 | *m_text=L''; 60 | } 61 | 62 | virtual ~RetroProgressBar(){ 63 | delete[] m_text; 64 | } 65 | 66 | HWND Create(HWND hwndParent, int w, int h, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT); 67 | 68 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 69 | 70 | ATOM Register(); 71 | 72 | // Message handlers 73 | int OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam); 74 | 75 | protected: 76 | 77 | HWND Create(DWORD dwExStyle, 78 | LPCTSTR lpWindowName, 79 | DWORD dwStyle, 80 | int x, int y, 81 | int w, int h, 82 | HWND hwndParent, 83 | HMENU hMenu); 84 | 85 | int m_rangeMin; 86 | int m_rangeMax; 87 | int m_value; 88 | COLORREF m_color; 89 | COLORREF m_textColor; 90 | COLORREF m_bkColor; 91 | wchar_t* m_text; 92 | }; 93 | 94 | } 95 | 96 | } 97 | 98 | #endif -------------------------------------------------------------------------------- /src/lib/inih/cpp/INIReader.cpp: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | #include 4 | #include 5 | #include 6 | #include "../ini.h" 7 | #include "INIReader.h" 8 | 9 | using std::string; 10 | 11 | INIReader::INIReader(string filename) 12 | { 13 | _error = ini_parse(filename.c_str(), ValueHandler, this); 14 | } 15 | 16 | int INIReader::ParseError() 17 | { 18 | return _error; 19 | } 20 | 21 | string INIReader::Get(string section, string name, string default_value) 22 | { 23 | string key = MakeKey(section, name); 24 | return _values.count(key) ? _values[key] : default_value; 25 | } 26 | 27 | long INIReader::GetInteger(string section, string name, long default_value) 28 | { 29 | string valstr = Get(section, name, ""); 30 | const char* value = valstr.c_str(); 31 | char* end; 32 | // This parses "1234" (decimal) and also "0x4D2" (hex) 33 | long n = strtol(value, &end, 0); 34 | return end > value ? n : default_value; 35 | } 36 | 37 | double INIReader::GetReal(string section, string name, double default_value) 38 | { 39 | string valstr = Get(section, name, ""); 40 | const char* value = valstr.c_str(); 41 | char* end; 42 | double n = strtod(value, &end); 43 | return end > value ? n : default_value; 44 | } 45 | 46 | bool INIReader::GetBoolean(string section, string name, bool default_value) 47 | { 48 | string valstr = Get(section, name, ""); 49 | // Convert to lower case to make string comparisons case-insensitive 50 | std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower); 51 | if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1") 52 | return true; 53 | else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0") 54 | return false; 55 | else 56 | return default_value; 57 | } 58 | 59 | string INIReader::MakeKey(string section, string name) 60 | { 61 | string key = section + "." + name; 62 | // Convert to lower case to make section/name lookups case-insensitive 63 | std::transform(key.begin(), key.end(), key.begin(), ::tolower); 64 | return key; 65 | } 66 | 67 | int INIReader::ValueHandler(void* user, const char* section, const char* name, 68 | const char* value) 69 | { 70 | INIReader* reader = (INIReader*)user; 71 | string key = MakeKey(section, name); 72 | if (reader->_values[key].size() > 0) 73 | reader->_values[key] += "\n"; 74 | reader->_values[key] += value; 75 | return 1; 76 | } 77 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/mem_watcher.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_MEM_WATCHER_H 21 | #define HARD86_MEM_WATCHER_H 22 | 23 | #include 24 | 25 | #include "../global.h" 26 | #include "toolwindow.h" 27 | #include "hexgrid.h" 28 | 29 | #include "../../../objwin32/src/gui/scrollbar.h" 30 | #include "../../../objwin32/src/gui/editbox.h" 31 | #include "../../../objwin32/src/gui/button.h" 32 | 33 | #include "../../../../../system/multithreading/mutex/cpp/mutex.h" 34 | 35 | namespace nsHard86Win32{ 36 | 37 | using namespace nsObjWin32::nsGUI; 38 | 39 | class MemoryWatcher : public Hard86ToolWindow{ 40 | public: 41 | MemoryWatcher(); 42 | 43 | virtual ~MemoryWatcher(){ 44 | DestroyWindow(m_hWnd); 45 | } 46 | 47 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 48 | 49 | HWND Create(int x, int y, int w, int h, HWND hwndParent, HMENU hMenu=NULL){ 50 | Window::Create(m_exStyle, L"Memory", m_style, x, y, w, h, hwndParent, hMenu); 51 | Show(); 52 | return m_hWnd; 53 | } 54 | private: 55 | 56 | // Message handlers 57 | #define MSGHANDLER(name) void On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 58 | 59 | MSGHANDLER(Create); 60 | MSGHANDLER(Size); 61 | MSGHANDLER(Command); 62 | MSGHANDLER(VScroll); 63 | 64 | #undef MSGHANDLER 65 | 66 | void CreateChildren(HWND hWnd); 67 | 68 | enum Children{ 69 | MEMGRID, 70 | SCROLLBAR, 71 | ADDRBOX, 72 | SEGBOX, 73 | GOTO_BUTTON 74 | }; 75 | 76 | WinManager m_children; 77 | 78 | template 79 | T*& Child(int id){ 80 | return (T*&)m_children[id]; 81 | } 82 | 83 | static bool m_registered; 84 | 85 | uint32 GetAddr(); 86 | uint32 GetSeg(); 87 | void SetAddr(uint32 i); 88 | void SetSeg(uint32 i); 89 | 90 | uint32 m_lastBaseAddr; 91 | 92 | bool m_enabled; 93 | 94 | }; 95 | 96 | } 97 | 98 | #endif -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/vs2010/hard86_win32/hard86_win32.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hard86_win32", "hard86_win32.vcxproj", "{97CE327D-863A-4C46-B460-E27BED50A061}" 4 | ProjectSection(ProjectDependencies) = postProject 5 | {EF018B23-8DC6-4249-98C3-78D1B467C97B} = {EF018B23-8DC6-4249-98C3-78D1B467C97B} 6 | {A14DBCC3-4F4E-4377-8C30-54D04D657459} = {A14DBCC3-4F4E-4377-8C30-54D04D657459} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_ui_lib", "..\..\..\objwin32\vs2010\win32_generic_unit\win32_generic_unit\win32_generic_unit.vcxproj", "{EF018B23-8DC6-4249-98C3-78D1B467C97B}" 10 | EndProject 11 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8492A8D8-8C0D-4F28-8642-B941A3FDDDA5}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_file_lib", "..\..\..\objwin32\vs2010\win32_generic_unit\win32_file_lib\win32_file_lib.vcxproj", "{A14DBCC3-4F4E-4377-8C30-54D04D657459}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Release|Win32 = Release|Win32 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {97CE327D-863A-4C46-B460-E27BED50A061}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {97CE327D-863A-4C46-B460-E27BED50A061}.Debug|Win32.Build.0 = Debug|Win32 23 | {97CE327D-863A-4C46-B460-E27BED50A061}.Release|Win32.ActiveCfg = Release|Win32 24 | {97CE327D-863A-4C46-B460-E27BED50A061}.Release|Win32.Build.0 = Release|Win32 25 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.ActiveCfg = Debug|Win32 26 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.Build.0 = Debug|Win32 27 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.ActiveCfg = Release|Win32 28 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.Build.0 = Release|Win32 29 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.Build.0 = Debug|Win32 31 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.ActiveCfg = Release|Win32 32 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.Build.0 = Release|Win32 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | GlobalSection(NestedProjects) = preSolution 38 | {EF018B23-8DC6-4249-98C3-78D1B467C97B} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 39 | {97CE327D-863A-4C46-B460-E27BED50A061} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 40 | {A14DBCC3-4F4E-4377-8C30-54D04D657459} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /src/lib/inih/ini.h: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 4 | home page for more info: 5 | 6 | http://code.google.com/p/inih/ 7 | 8 | */ 9 | 10 | #ifndef __INI_H__ 11 | #define __INI_H__ 12 | 13 | /* Make this header file easier to include in C++ code */ 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #include 19 | 20 | /* Parse given INI-style file. May have [section]s, name=value pairs 21 | (whitespace stripped), and comments starting with ';' (semicolon). Section 22 | is "" if name=value pair parsed before any section heading. name:value 23 | pairs are also supported as a concession to Python's ConfigParser. 24 | 25 | For each name=value pair parsed, call handler function with given user 26 | pointer as well as section, name, and value (data only valid for duration 27 | of handler call). Handler should return nonzero on success, zero on error. 28 | 29 | Returns 0 on success, line number of first error on parse error (doesn't 30 | stop on first error), -1 on file open error, or -2 on memory allocation 31 | error (only when INI_USE_STACK is zero). 32 | */ 33 | int ini_parse(const char* filename, 34 | int (*handler)(void* user, const char* section, 35 | const char* name, const char* value), 36 | void* user); 37 | 38 | /* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't 39 | close the file when it's finished -- the caller must do that. */ 40 | int ini_parse_file(FILE* file, 41 | int (*handler)(void* user, const char* section, 42 | const char* name, const char* value), 43 | void* user); 44 | 45 | /* Nonzero to allow multi-line value parsing, in the style of Python's 46 | ConfigParser. If allowed, ini_parse() will call the handler with the same 47 | name for each subsequent line parsed. */ 48 | #ifndef INI_ALLOW_MULTILINE 49 | #define INI_ALLOW_MULTILINE 1 50 | #endif 51 | 52 | /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of 53 | the file. See http://code.google.com/p/inih/issues/detail?id=21 */ 54 | #ifndef INI_ALLOW_BOM 55 | #define INI_ALLOW_BOM 1 56 | #endif 57 | 58 | /* Nonzero to use stack, zero to use heap (malloc/free). */ 59 | #ifndef INI_USE_STACK 60 | #define INI_USE_STACK 1 61 | #endif 62 | 63 | /* Stop parsing on first error (default is to keep parsing). */ 64 | #ifndef INI_STOP_ON_FIRST_ERROR 65 | #define INI_STOP_ON_FIRST_ERROR 0 66 | #endif 67 | 68 | /* Maximum line length for any line in INI file. */ 69 | #ifndef INI_MAX_LINE 70 | #define INI_MAX_LINE 200 71 | #endif 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* __INI_H__ */ 78 | -------------------------------------------------------------------------------- /src/emulator/emulator_engine/src/flags.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef FLAGS_H 21 | #define FLAGS_H 22 | 23 | #include "emulator_engine.h" 24 | 25 | #define FLAG_DF sys_state.f_bits.DF 26 | #define FLAG_IF sys_state.f_bits.IF 27 | #define FLAG_TF sys_state.f_bits.TF 28 | #define FLAG_CF sys_state.f_bits.CF 29 | #define FLAG_PF sys_state.f_bits.PF 30 | #define FLAG_AF sys_state.f_bits.AF 31 | #define FLAG_ZF sys_state.f_bits.ZF 32 | #define FLAG_SF sys_state.f_bits.SF 33 | #define FLAG_OF sys_state.f_bits.OF 34 | 35 | void set_df(int v); 36 | void set_if(int v); 37 | void set_cf(int v); 38 | void set_pf(uint32 v); 39 | void set_af(); 40 | void set_zf(uint32 v); 41 | void set_sf8(uint8 v); 42 | void set_sf16(uint16 v); 43 | void set_of(int v); 44 | 45 | #define SETF_2OP_PROTO(name, type)\ 46 | void name(type a, type b); 47 | 48 | #define SETF_3OP_PROTO(name, type)\ 49 | void name(type a, type b, type c); 50 | 51 | #define SETF_1OP_PROTO(name, type)\ 52 | void name(type a); 53 | 54 | SETF_2OP_PROTO(setf_add8, uint8) 55 | SETF_2OP_PROTO(setf_add16, uint16) 56 | SETF_3OP_PROTO(setf_adc8, uint8) 57 | SETF_3OP_PROTO(setf_adc16, uint16) 58 | SETF_2OP_PROTO(setf_sub8, uint8) 59 | SETF_2OP_PROTO(setf_sub16, uint16) 60 | SETF_1OP_PROTO(setf_inc8, uint8) 61 | SETF_1OP_PROTO(setf_inc16, uint16) 62 | SETF_1OP_PROTO(setf_dec8, uint8) 63 | SETF_1OP_PROTO(setf_dec16, uint16) 64 | SETF_1OP_PROTO(setf_neg8, uint8); 65 | SETF_1OP_PROTO(setf_neg16, uint16); 66 | SETF_2OP_PROTO(setf_shl8, uint8); 67 | SETF_2OP_PROTO(setf_shl16, uint16); 68 | SETF_2OP_PROTO(setf_shr8, uint8); 69 | SETF_2OP_PROTO(setf_shr16, uint16); 70 | SETF_2OP_PROTO(setf_and8, uint8); 71 | SETF_2OP_PROTO(setf_and16, uint16); 72 | SETF_2OP_PROTO(setf_or8, uint8); 73 | SETF_2OP_PROTO(setf_or16, uint16); 74 | SETF_2OP_PROTO(setf_xor8, uint8); 75 | SETF_2OP_PROTO(setf_xor16, uint16); 76 | SETF_2OP_PROTO(setf_mul8, uint8); 77 | SETF_2OP_PROTO(setf_mul16, uint16); 78 | SETF_2OP_PROTO(setf_test8, uint8); 79 | SETF_2OP_PROTO(setf_test16, uint16); 80 | 81 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/vs2010/hard86_win32/hard86_win32_vs2013.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hard86_win32", "hard86_win32.vcxproj", "{97CE327D-863A-4C46-B460-E27BED50A061}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {EF018B23-8DC6-4249-98C3-78D1B467C97B} = {EF018B23-8DC6-4249-98C3-78D1B467C97B} 9 | {A14DBCC3-4F4E-4377-8C30-54D04D657459} = {A14DBCC3-4F4E-4377-8C30-54D04D657459} 10 | EndProjectSection 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_ui_lib", "..\..\..\objwin32\vs2010\win32_generic_unit\win32_generic_unit\win32_generic_unit.vcxproj", "{EF018B23-8DC6-4249-98C3-78D1B467C97B}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8492A8D8-8C0D-4F28-8642-B941A3FDDDA5}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_file_lib", "..\..\..\objwin32\vs2010\win32_generic_unit\win32_file_lib\win32_file_lib.vcxproj", "{A14DBCC3-4F4E-4377-8C30-54D04D657459}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Win32 = Debug|Win32 21 | Release|Win32 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {97CE327D-863A-4C46-B460-E27BED50A061}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {97CE327D-863A-4C46-B460-E27BED50A061}.Debug|Win32.Build.0 = Debug|Win32 26 | {97CE327D-863A-4C46-B460-E27BED50A061}.Release|Win32.ActiveCfg = Release|Win32 27 | {97CE327D-863A-4C46-B460-E27BED50A061}.Release|Win32.Build.0 = Release|Win32 28 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.ActiveCfg = Debug|Win32 29 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Debug|Win32.Build.0 = Debug|Win32 30 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.ActiveCfg = Release|Win32 31 | {EF018B23-8DC6-4249-98C3-78D1B467C97B}.Release|Win32.Build.0 = Release|Win32 32 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Debug|Win32.Build.0 = Debug|Win32 34 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.ActiveCfg = Release|Win32 35 | {A14DBCC3-4F4E-4377-8C30-54D04D657459}.Release|Win32.Build.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(NestedProjects) = preSolution 41 | {EF018B23-8DC6-4249-98C3-78D1B467C97B} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 42 | {97CE327D-863A-4C46-B460-E27BED50A061} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 43 | {A14DBCC3-4F4E-4377-8C30-54D04D657459} = {8492A8D8-8C0D-4F28-8642-B941A3FDDDA5} 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /src/interface/win32/objwin32/src/gui/window.cpp: -------------------------------------------------------------------------------- 1 | #include "window.h" 2 | #include "global.h" 3 | 4 | namespace nsObjWin32{ 5 | 6 | namespace nsGUI{ 7 | 8 | HINSTANCE Window::m_hInstance; 9 | 10 | void Window::SetHInstance(HINSTANCE hInstance){ 11 | m_hInstance=hInstance; 12 | } 13 | 14 | bool Window::Show(int nCmdShow){ 15 | BOOL canShow=ShowWindow(m_hWnd, nCmdShow); 16 | UpdateWindow(m_hWnd); 17 | return canShow; 18 | } 19 | 20 | LRESULT Window::SendMessage(UINT uMsg, WPARAM wParam, LPARAM lParam){ 21 | return ::SendMessageW(m_hWnd, uMsg, wParam, lParam); 22 | } 23 | 24 | LRESULT CALLBACK Window::Base_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ 25 | switch(uMsg){ 26 | case WM_NCCREATE: 27 | { 28 | CREATESTRUCT* cs=(CREATESTRUCT*)lParam; 29 | Window* pWindow=(Window*)cs->lpCreateParams; 30 | if(pWindow==nullptr){ 31 | ALERT_ERR("pWindow is a NULL pointer"); 32 | abort(); 33 | } 34 | SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG)pWindow); 35 | pWindow->m_hWnd=hWnd; 36 | return pWindow->WndProc(hWnd, uMsg, wParam, lParam); 37 | } 38 | default: 39 | { 40 | Window* pWindow=(Window*)GetWindowLongPtr(hWnd, GWL_USERDATA); 41 | if(pWindow==nullptr){ 42 | return DefWindowProc(hWnd, uMsg, wParam, lParam); 43 | } 44 | return pWindow->WndProc(hWnd, uMsg, wParam, lParam); 45 | } 46 | } 47 | return 0; 48 | } 49 | 50 | HWND Window::Create(DWORD dwExStyle, 51 | LPCTSTR lpWindowName, 52 | DWORD dwStyle, 53 | int x, int y, 54 | int w, int h, 55 | HWND hwndParent, 56 | HMENU hMenu) 57 | { 58 | m_width=w; 59 | m_height=h; 60 | m_hWnd=CreateWindowEx(dwExStyle, 61 | m_className, 62 | lpWindowName, 63 | dwStyle, 64 | x, y, 65 | w, h, 66 | hwndParent, hMenu, 67 | m_hInstance, this); 68 | int e=GetLastError(); 69 | return m_hWnd; 70 | } 71 | 72 | inline int Window::WindowWidth(){ return nsGUI::WindowWidth(m_hWnd); } 73 | inline int Window::WindowHeight(){ return nsGUI::WindowHeight(m_hWnd); } 74 | inline int Window::ClientWidth(){ return nsGUI::ClientWidth(m_hWnd); } 75 | inline int Window::ClientHeight(){ return nsGUI::ClientHeight(m_hWnd); } 76 | inline int Window::XPos(){ return nsGUI::WindowX(m_hWnd); } 77 | inline int Window::YPos(){ return nsGUI::WindowY(m_hWnd); } 78 | inline int Window::SetSize(int w, int h){ return (m_style & WS_CHILD) ? nsGUI::SetChildWindowSize(m_hWnd, w, h) : nsGUI::SetWindowSize(m_hWnd, w, h); } 79 | inline int Window::SetWidth(int w){ return SetSize(w, WindowWidth()); } 80 | inline int Window::SetHeight(int h){ return SetSize(WindowHeight(), h); } 81 | inline int Window::SetXY(int x, int y){ return nsGUI::SetWindowXY(m_hWnd, x, y); } 82 | inline int Window::SetX(int x){ return SetXY(x, YPos()); } 83 | inline int Window::SetY(int y){ return SetXY(XPos(), y); } 84 | } 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/lib/rapidxml/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/dasmview.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef HARD86_DASMVIEW_H 21 | #define HARD86_DASMVIEW_H 22 | 23 | #include 24 | #include "codelist.h" 25 | #include "winmanager.h" 26 | #include "../../../objwin32/src/gui/scrollbar.h" 27 | #include "../../../objwin32/src/gui/userwindow.h" 28 | 29 | #include "../emulator.h" 30 | 31 | #include "../../../../../emulator/emulator_engine/src/cpp_interface/emulator_cpp.h" 32 | #include "../../../../../emulator/debugger_engine/src/debugger.h" 33 | #include "../../../../../emulator/emulator_engine/src/dasm/dasm_cpp.h" 34 | 35 | namespace nsHard86Win32{ 36 | 37 | class DasmView : public UserWindow{ 38 | public: 39 | DasmView(); 40 | virtual ~DasmView(); 41 | 42 | ATOM Register(); 43 | 44 | HWND Create(int x, int y, int w, int h, HWND hwndParent, int ID); 45 | 46 | LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 47 | 48 | void Reset(){ 49 | CodeList* codeList=Child(CODELIST); 50 | codeList->Clear(); 51 | codeList->Insert(make_pair(0, wstring(L"Disassembly not loaded"))); 52 | m_dasmList.clear(); 53 | InvalidateRect(codeList->GetHWND(), NULL, false); 54 | } 55 | 56 | // returns the seg:addr of the cursor selected entry 57 | uint32 GetCursorSelection(){ 58 | vector >::iterator entry=Child(CODELIST)->GetCurSel(); 59 | return entry->first; 60 | } 61 | 62 | private: 63 | 64 | static bool m_registered; 65 | 66 | enum Children{ 67 | CODELIST, 68 | //SCROLLBAR 69 | }; 70 | 71 | template 72 | T*& Child(int id){ 73 | return (T*&)m_children[id]; 74 | } 75 | 76 | WinManager m_children; 77 | 78 | void CreateChildren(HWND hWnd); 79 | 80 | uint32 m_baseAddr; 81 | 82 | // Message handlers 83 | #define MSGHANDLER(name) void On##name(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 84 | 85 | MSGHANDLER(Create); 86 | MSGHANDLER(VScroll); 87 | MSGHANDLER(H86UpdateSysData); 88 | MSGHANDLER(Sizing); 89 | 90 | #undef MSGHANDLER 91 | 92 | nsDasm::DasmList m_dasmList; 93 | }; 94 | 95 | } 96 | 97 | #endif -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/windows/statusbar.cpp: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "statusbar.h" 21 | #include "../settings.h" 22 | #include "../../../objwin32/src/gui/static.h" 23 | 24 | namespace nsHard86Win32{ 25 | 26 | bool StatusBar::m_registered=false; 27 | 28 | ATOM StatusBar::Register(){ 29 | WNDCLASSEX wcx; 30 | wcx.cbSize=sizeof(WNDCLASSEX); 31 | wcx.style=CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW; 32 | wcx.lpfnWndProc=&Base_WndProc; 33 | wcx.cbClsExtra=NULL; 34 | wcx.cbWndExtra=NULL; 35 | wcx.hInstance=m_hInstance; 36 | wcx.hIcon=NULL; 37 | wcx.hCursor=NULL; 38 | wcx.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); 39 | wcx.lpszMenuName=NULL; 40 | wcx.lpszClassName=m_className; 41 | wcx.hIconSm=NULL; 42 | return (RegisterClassEx(&wcx)); 43 | } 44 | 45 | HWND StatusBar::Create(int x, int y, int w, HWND hwndParent, int ID) 46 | { 47 | return Window::Create(m_exStyle, L"", m_style, x, y, w, DEF_H, hwndParent, (HMENU)ID); 48 | } 49 | 50 | LRESULT CALLBACK StatusBar::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 51 | { 52 | switch(uMsg){ 53 | case WM_CREATE: 54 | { 55 | TextStatic*& info=Child(INFO); 56 | info=new TextStatic(); 57 | info->SetExStyle(WS_EX_CLIENTEDGE); 58 | info->Create(L"[Info]", 0, 0, ClientWidth()/2, ClientHeight(), hWnd, INFO); 59 | info->SetFont(Settings::GetFont(Settings::Fonts::GUI_FONT)); 60 | info->Show(); 61 | 62 | TextStatic*& status=Child(STATUS); 63 | status=new TextStatic(); 64 | status->SetStyle(SS_RIGHT); 65 | status->SetExStyle(WS_EX_CLIENTEDGE); 66 | status->Create(L"[Status]", ClientWidth()/2, 0, ClientWidth()/2, ClientHeight(), hWnd, STATUS); 67 | status->SetFont(Settings::GetFont(Settings::Fonts::GUI_FONT)); 68 | status->Show(); 69 | 70 | break; 71 | } 72 | default: 73 | return DefWindowProc(hWnd, uMsg, wParam, lParam); 74 | } 75 | return 0; 76 | } 77 | 78 | void StatusBar::SetStatus(wchar_t* status){ 79 | Child(STATUS)->SetText(status); 80 | } 81 | 82 | void StatusBar::SetInfo(wchar_t* info){ 83 | Child(INFO)->SetText(info); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/interface/win32/hard86_win32/src/application.h: -------------------------------------------------------------------------------- 1 | /* Hard86 - An 8086 Emulator with support for virtual hardware 2 | 3 | Copyright (C) 2014 Stephen Zhang 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef APPLICATION_H 21 | #define APPLICATION_H 22 | 23 | #include 24 | #include 25 | #include "settings.h" 26 | #include "h86project.h" 27 | #include "windows/mainframe.h" 28 | #include "windows/winmanager.h" 29 | 30 | #include "emulator.h" 31 | 32 | #include "../../../../emulator/debugger_engine/src/debugger.h" 33 | #include "../../../../emulator/debugger_engine/src/vdev.h" 34 | 35 | class Application{ 36 | private: 37 | Application(HINSTANCE hInstance) : appDir(L"") 38 | { 39 | this->hInstance=hInstance; 40 | Window::SetHInstance(hInstance); 41 | settings=Settings::GetInstance(); 42 | 43 | { 44 | wchar_t path[MAX_PATH]; 45 | GetCurrentDirectory(MAX_PATH, path); 46 | appDir=path; 47 | } 48 | 49 | // initialize common controls 50 | INITCOMMONCONTROLSEX icx; 51 | icx.dwSize=sizeof(icx); 52 | icx.dwICC=ICC_BAR_CLASSES; 53 | InitCommonControlsEx(&icx); 54 | 55 | // initialize nsDebugger::Debugger 56 | nsDebugger::Debugger::Init(nsVDev::VDevList::GetInstance()); 57 | } 58 | 59 | static Application *m_instance; 60 | public: 61 | 62 | ~Application() 63 | { 64 | EmulatorThread::DisposeInstance(); 65 | H86Project::DisposeInstance(); 66 | } 67 | 68 | static Application* GetInstance(){ 69 | return m_instance; 70 | } 71 | 72 | static Application* GetInstance(HINSTANCE hInstance){ 73 | if(m_instance) return GetInstance(); 74 | m_instance=new Application(hInstance); 75 | return m_instance; 76 | } 77 | 78 | static wstring& GetAppDirectory(){ return GetInstance()->appDir; } 79 | 80 | static HINSTANCE hInstance; 81 | 82 | // Main Window 83 | MainFrame* mainFrame; 84 | 85 | // Window manager 86 | WinManager winManager; 87 | 88 | // Settings manager 89 | Settings* settings; 90 | 91 | // Application directory 92 | wstring appDir; 93 | 94 | // Exiting condition 95 | bool isExiting; 96 | 97 | static bool IsExiting(){ return GetInstance()->isExiting; } 98 | static void SetExiting(bool b){ GetInstance()->isExiting=b; } 99 | 100 | private: 101 | protected: 102 | }; 103 | 104 | 105 | #endif --------------------------------------------------------------------------------