diff --git a/.gitignore b/.gitignore index 9ea94eb..a886729 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ bin -tools/win-release-tools win-release \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b31c020..0b4016c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,10 @@ +#Variables +#----------------------------------------------------------------------------------------- +set(PROJ_NAME DragonVM) +set(MAJOR_VER 0) +set(MINOR_VER 1) +#----------------------------------------------------------------------------------------- + #Setup #----------------------------------------------------------------------------------------- set(CMAKE_CXX_COMPILER "clang++") @@ -7,27 +14,15 @@ cmake_minimum_required(VERSION 3.18) project(${PROJ_NAME} LANGUAGES C CXX) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CXX_STANDARD 20) -file(STRINGS "./tools/build.nr" BUILD_NUMBER) +file(STRINGS "./build.nr" BUILD_NUMBER) #----------------------------------------------------------------------------------------- - - -#Variables -#----------------------------------------------------------------------------------------- -set(PROJ_NAME DragonVM) -set(MAJOR_VER 0) -set(MINOR_VER 1) - message("** Building ${PROJ_NAME} ${MAJOR_VER}.${MINOR_VER}.${BUILD_NUMBER}") -#----------------------------------------------------------------------------------------- - - #Sources #----------------------------------------------------------------------------------------- list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/src - ${CMAKE_CURRENT_LIST_DIR}/../omnia-framework/src ) list(APPEND RUNTIME_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/src/runtime/runtime_main.cpp @@ -88,8 +83,6 @@ list(APPEND TOOLS_SOURCE_FILES ) #----------------------------------------------------------------------------------------- - - #Targets #----------------------------------------------------------------------------------------- set(RUNTIME_TARGET dvm) @@ -117,11 +110,10 @@ target_compile_definitions(${RUNTIME_TARGET} PUBLIC BUILD_NR=${BUILD_NUMBER} MA add_compile_options(-O3 -m32 -MMD -MP -Wall -ggdb) if (UNIX) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") - #target_link_libraries(${RUNTIME_TARGET} X11 GL) - target_link_libraries(${RUNTIME_TARGET} xcb xcb-randr) - target_link_libraries(${ASSEMBLER_TARGET} xcb xcb-randr) - target_link_libraries(${TOOLS_TARGET} xcb xcb-randr) - target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr) + target_link_libraries(${RUNTIME_TARGET} xcb xcb-randr boost_regex) + target_link_libraries(${ASSEMBLER_TARGET} xcb xcb-randr boost_regex) + target_link_libraries(${TOOLS_TARGET} xcb xcb-randr boost_regex) + target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr boost_regex) endif (UNIX) if (WIN32) target_link_libraries(${RUNTIME_TARGET} mingw32) @@ -131,49 +123,16 @@ if (WIN32) endif (WIN32) target_link_libraries(${RUNTIME_TARGET} SDL2main SDL2 SDL2_mixer SDL2_image) target_link_libraries(${DEBUGGER_TARGET} SDL2main SDL2 SDL2_mixer SDL2_image) - -# target_link_libraries(${RUNTIME_TARGET} sfml-system sfml-window sfml-graphics) #----------------------------------------------------------------------------------------- - - #Linking #----------------------------------------------------------------------------------------- -find_library(OMNIA_STD_LIB - NAMES ostd - HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../omnia-framework/bin/" - NO_CACHE -) -target_link_libraries(${RUNTIME_TARGET} ${OMNIA_STD_LIB}) -target_link_libraries(${DEBUGGER_TARGET} ${OMNIA_STD_LIB}) -target_link_libraries(${ASSEMBLER_TARGET} ${OMNIA_STD_LIB}) -target_link_libraries(${TOOLS_TARGET} ${OMNIA_STD_LIB}) +target_link_libraries(${RUNTIME_TARGET} ostd) +target_link_libraries(${DEBUGGER_TARGET} ostd) +target_link_libraries(${ASSEMBLER_TARGET} ostd) +target_link_libraries(${TOOLS_TARGET} ostd) #----------------------------------------------------------------------------------------- - - -#BuildNumber Target -#----------------------------------------------------------------------------------------- -if (WIN32) - add_custom_command ( OUTPUT ./tools/build.nr - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/inc_bnr.exe - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/ - ) -endif (WIN32) -if (UNIX) - add_custom_command ( OUTPUT ./tools/build.nr - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/inc_bnr - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/ - ) -endif (UNIX) - -add_custom_target( - IncBnr ALL - DEPENDS ./tools/build.nr -) -#----------------------------------------------------------------------------------------- - - add_custom_command(TARGET ${RUNTIME_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/extra/ $ diff --git a/README.md b/README.md index e7a94b5..49ebdf0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ # DragonVM -Compile instructions on Windows +An amulator for a 16-bit machine that never existed +## Build instructions - All +This project requires the OmniaFramework library I wrote, which can be found at https://github.com/OmniaX-dev/OmniaFramework +This library must be correctly installed in clang's search paths (include, lib, bin) before compiling this project. + +## Build instructions - Windows **Step 1:** download MSYS2 from https://www.msys2.org/ and install it @@ -9,7 +14,7 @@ download MSYS2 from https://www.msys2.org/ and install it run MSYS2, and in the terminal run: ``` pacman -Syuu -pacman -S --needed base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-sfml mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-SDL2 +pacman -S --needed base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_mixer mingw-w64-ucrt-x86_64-SDL2_image ``` **Step 3:** @@ -20,3 +25,31 @@ execute this command: ``` ./compile ``` +## Build instructions - Linux (Arch) +**Step 1:** +open a terminal and run: +``` +sudo pacman -Syuu +sudo pacman -S --needed base-devel clang gdb cmake make sdl2 sdl2_mixer sdl2_image +``` + +**Step 2:** +open a terminal inside the root directory of the project and run this command: +``` +./compile +``` +## Build instructions - Linux (Ubuntu) +**Step 1:** +open a terminal and run: +``` +sudo apt update && sudo apt upgrade +sudo apt install clang gdb make cmake libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev libxcb-randr0-dev +``` + +**Step 2:** +open a terminal inside the root directory of the project and run this command: +``` +./compile +``` + +#### For other Linux distros, install the dependencies using your package manager. \ No newline at end of file diff --git a/build.nr b/build.nr new file mode 100644 index 0000000..57c7c05 --- /dev/null +++ b/build.nr @@ -0,0 +1 @@ +1542 diff --git a/compile b/compile index 405fcd6..266a8e8 100644 --- a/compile +++ b/compile @@ -12,5 +12,4 @@ elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then cd bin mingw32-make.exe cd .. - cp ../omnia-framework/bin/libostd.dll ./bin fi \ No newline at end of file diff --git a/create_win_release.sh b/create_win_release.sh new file mode 100644 index 0000000..d9b31bb --- /dev/null +++ b/create_win_release.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +rm -r ./win-release + +./compile + +cd bin + +printf "${green}Compiling vBIOS...\n${clear}" +./dasm dss/bios.dss -o dragon/bios.bin --save-disassembly disassembly/bios.dds + +printf "\n${green}Creating Virtual Disk...\n${clear}" +rm dragon/disk1.dr +./dtools new-vdisk dragon/disk1.dr 1048576 + +printf "\n${green}Compiling MBR Block...\n${clear}" +./dasm dss/mbr.dss -o dragon/mbr.bin --save-disassembly disassembly/mbr.dds + +printf "\n${green}Loading MBR Block...\n${clear}" +./dtools load-program dragon/disk1.dr dragon/mbr.bin 0x00000000 + +printf "${green}Compiling Test Program...\n" +./dasm dss/test.dss -o test.bin --save-disassembly disassembly/test.dds + +printf "${green}Creating Windows Release...\n" +cd .. +mkdir win-release +cp ./bin/dasm.exe ./win-release +cp ./bin/ddb.exe ./win-release +cp ./bin/dtools.exe ./win-release +cp ./bin/dvm.exe ./win-release +cp ./bin/font.bmp ./win-release +cp ./bin/test.bin ./win-release + +cp -r ./bin/config ./win-release +cp -r ./bin/disassembly ./win-release +cp -r ./bin/dragon ./win-release + +mkdir ./win-release/dss +cp ./bin/dss/bios.dss ./win-release/dss +cp ./bin/dss/mbr.dss ./win-release/dss +cp ./bin/dss/test.dss ./win-release/dss + +cp C:/msys64/ucrt64/bin/libgcc_s_seh-1.dll ./win-release +cp C:/msys64/ucrt64/bin/libstdc++-6.dll ./win-release +cp C:/msys64/ucrt64/bin/libwinpthread-1.dll ./win-release +cp C:/msys64/ucrt64/bin/SDL2.dll ./win-release +cp C:/msys64/ucrt64/bin/libostd.dll ./win-release + +cp ./run-test.bat ./win-release + +typeset -i build_number=$(cat build.nr) +((build_number++)) +truncate -s 0 build.nr +echo $build_number >> build.nr \ No newline at end of file diff --git a/run-test.bat b/run-test.bat new file mode 100644 index 0000000..7251887 --- /dev/null +++ b/run-test.bat @@ -0,0 +1 @@ +ddb config/testMachine.dvm --force-load test.bin 0x00 --verbose-load --track-step-diff --hide-vdisplay \ No newline at end of file diff --git a/tools/CppResourceMaker b/tools/CppResourceMaker deleted file mode 100644 index 6d78724..0000000 Binary files a/tools/CppResourceMaker and /dev/null differ diff --git a/tools/build.nr b/tools/build.nr deleted file mode 100644 index fa94e88..0000000 --- a/tools/build.nr +++ /dev/null @@ -1 +0,0 @@ -1536 diff --git a/tools/inc_bnr b/tools/inc_bnr deleted file mode 100644 index 4a0e37b..0000000 Binary files a/tools/inc_bnr and /dev/null differ diff --git a/tools/inc_bnr.exe b/tools/inc_bnr.exe deleted file mode 100644 index ba3b943..0000000 Binary files a/tools/inc_bnr.exe and /dev/null differ