├── 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 | S t e p h e n S T E P H E N - P C
--------------------------------------------------------------------------------
/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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/system/multithreading/mutex/cpp/mutex.cbp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
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