diff --git a/README.md b/README.md index 665eef3..0c2b3e7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The stack mapping is 254 bytes of data, a byte for the pointer and a byte for an All you need is X11. ```sh -gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11 +gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11 ``` ### Terminal @@ -33,13 +33,15 @@ gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c If you wish to build the emulator without graphics mode: ```sh -cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli +gcc -DNDEBUG -Og -g0 -s src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli ``` -## Run +## Usage + +The first parameter is the rom file, the subsequent arguments will be accessible to the rom, via the [Console vector](https://wiki.xxiivv.com/site/varvara.html#console). ```sh -bin/uxnemu bin/polycat.rom +bin/uxnemu bin/polycat.rom arg1 arg2 ``` ## Devices diff --git a/build.sh b/build.sh index 6956bfe..78e3dd2 100755 --- a/build.sh +++ b/build.sh @@ -1,32 +1,38 @@ #!/bin/sh -e +RELEASE_FLAGS="-DNDEBUG -Og -g0 -s" +DEBUG_FLAGS="-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined" +EMU_INC="src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11" +CLI_INC="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli" + if [ "${1}" = '--format' ]; then echo "Formatting.." + clang-format -i src/uxn.c + clang-format -i src/uxn.h clang-format -i src/uxn11.c clang-format -i src/uxncli.c clang-format -i src/devices/* fi echo "Cleaning.." -rm -f ./bin/* - -echo "Building.." +rm -f bin/* mkdir -p bin +echo "Building.." if [ "${1}" = '--install' ]; then echo "Installing.." - gcc src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxn11 -lX11 - gcc src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -D_POSIX_C_SOURCE=199309L -DNDEBUG -Os -g0 -s -o bin/uxncli + gcc ${RELEASE_FLAGS} ${EMU_INC} + gcc ${RELEASE_FLAGS} ${CLI_INC} cp bin/uxn11 ~/bin cp bin/uxncli ~/bin else - gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11 - gcc -std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli + gcc ${DEBUG_FLAGS} ${EMU_INC} + gcc ${DEBUG_FLAGS} ${CLI_INC} fi -echo "Assembling polycat.." +echo "Assembling.." bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/ echo "Running.."