83 lines
2.6 KiB
Bash
83 lines
2.6 KiB
Bash
#!/bin/bash
|
|
# CBE Platform - launcher script
|
|
# Usage: ./run.sh build - rebuild all jars
|
|
# ./run.sh compile - compile example .cbeplugin files
|
|
# ./run.sh os - boot the full OS from disk (big-disk.cbeplugin)
|
|
# ./run.sh nogui - run emulator in headless mode
|
|
# ./run.sh - run emulator with GUI window (basic, no disk)
|
|
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
|
|
GUI_JAR="modules/gui/build/libs/gui-0.1.0.jar"
|
|
LOADER_JAR="modules/loader/build/libs/loader-0.1.0.jar"
|
|
CORE_JAR="modules/core/build/libs/core-0.1.0.jar"
|
|
CBECC_JAR="modules/cbecc/build/libs/cbecc-0.1.0.jar"
|
|
EMU_CP="$GUI_JAR:$LOADER_JAR:$CORE_JAR"
|
|
BUILD_CP="$CBECC_JAR:$LOADER_JAR:$CORE_JAR"
|
|
|
|
build() {
|
|
./gradlew build --no-daemon -q
|
|
}
|
|
|
|
compile_plugins() {
|
|
mkdir -p build
|
|
for src in examples/*/; do
|
|
full=$(basename "$src")
|
|
name="${full%.*}"
|
|
out="build/${name}.cbeplugin"
|
|
if [ ! -f "$out" ]; then
|
|
java -cp "$BUILD_CP" com.cbe.cbecc.Main build "$src" -o "$out" 2>&1 | tail -1
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Common JVM flags for all emulator runs
|
|
EMU_FLAGS="-Djava.awt.headless=true"
|
|
|
|
case "${1:-gui}" in
|
|
build)
|
|
build
|
|
;;
|
|
compile)
|
|
compile_plugins
|
|
;;
|
|
jar)
|
|
./gradlew :modules:gui:stage --no-daemon -q
|
|
echo "Jar: modules/gui/build/stage/cbe-emu.jar"
|
|
echo "Run: java -jar modules/gui/build/stage/cbe-emu.jar --nogui --cpu <file>"
|
|
;;
|
|
os)
|
|
# Full OS mode: disk + all peripherals
|
|
compile_plugins
|
|
java $EMU_FLAGS -cp "$EMU_CP" com.cbe.gui.Main \
|
|
--cpu build/tiny-cpu.cbeplugin \
|
|
--ram build/basic-ram.cbeplugin \
|
|
--gpu build/vga-display.cbeplugin \
|
|
--kbd build/basic-kbd.cbeplugin \
|
|
--snd build/basic-snd.cbeplugin \
|
|
--bios build/tiny-bios.cbeplugin \
|
|
--disk build/big-disk.cbeplugin
|
|
;;
|
|
nogui)
|
|
# Headless OS mode
|
|
compile_plugins
|
|
java $EMU_FLAGS -cp "$EMU_CP" com.cbe.gui.Main \
|
|
--cpu build/tiny-cpu.cbeplugin \
|
|
--ram build/basic-ram.cbeplugin \
|
|
--gpu build/vga-display.cbeplugin \
|
|
--kbd build/basic-kbd.cbeplugin \
|
|
--snd build/basic-snd.cbeplugin \
|
|
--bios build/tiny-bios.cbeplugin \
|
|
--disk build/big-disk.cbeplugin --nogui
|
|
;;
|
|
gui|*)
|
|
# Basic GUI: minimal modules (no disk, for testing)
|
|
compile_plugins
|
|
java -cp "$EMU_CP" com.cbe.gui.Main \
|
|
--cpu build/tiny-cpu.cbeplugin \
|
|
--ram build/basic-ram.cbeplugin \
|
|
--gpu build/vga-display.cbeplugin
|
|
;;
|
|
esac
|