Skip to content
jroarkPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

BE-300 Emulator

Casio Cassiopeia BE-300 emulator using a lightly integrated GXemul 0.7.0 MIPS CPU core. The active target is accurate cold boot of Windows CE 3.0 from the real masked boot ROM and a raw NAND restore image.

NAND restore images, Casio backup images, restore-package binaries, and vendor PDFs are not distributed in this repository. Place local copies at the expected paths before running WinCE boot tests; see docs/LOCAL_ASSETS.md.

The emulator must boot the unmodified ROM and NAND image through the same chain as hardware after battery removal:

ROM reset vector -> SPL/Kloader from NAND -> NK.exe decompression -> WinCE 3.0

Current Status

The primary boot target is:

./be300 --nand ../ce/restore_images/All_nand_300.bin

Current implementation status and investigation guidance live in docs/CURRENT_STATUS.md.

Historical pass handoffs and superseded investigation notes are archived in docs/archive/.

Requirements

  • CMake 3.10+
  • C11 compiler
  • Git submodules for GXemul, Dear ImGui, and native file dialogs
  • SDL2 for the default native launcher, interactive framebuffer window, and host audio. An asset-free headless CLI can instead be built with -DBUILD_LAUNCHER=OFF when SDL2 is unavailable.
  • libpng is optional; it enables the rendered BE-300 bezel in SDL builds
  • gtimeout or GNU timeout for bounded boot smoke tests

The GXemul CPU engine is a submodule. Fresh clones need:

git submodule update --init

Build

mkdir -p build-host
cd build-host
cmake ..
make -j$(nproc)

On macOS, replace $(nproc) with the number of jobs you want to run, or use a shell that provides nproc.

Run ./build-host/be300 with no arguments to open the native VM manager. It creates reusable .be300vm bundles, remembers display and accessory settings, and can boot a selected NAND image without assembling the CLI options by hand. Pass --nand and other options to bypass the launcher and run directly.

Windows x86_64 ZIP

From macOS, the MinGW cross-build helper produces a portable Windows package:

brew install mingw-w64
./tools/build_windows.sh

The output is dist/be300-windows-amd64.zip. It contains be300.exe, SDL2.dll, and a run-be300.bat helper. The WinCE NAND image is not bundled; copy your local image to the Windows machine and run:

be300.exe --nand C:\path\to\All_nand_300.bin

Run WinCE 3.0

Provide a local NAND image first:

ce/restore_images/All_nand_300.bin

Then run:

cd build-host
./be300 --nand ../ce/restore_images/All_nand_300.bin

Serial output is written to stdout. Emulator diagnostics are written to stderr. An SDL window opens for the framebuffer when SDL is available. Panel and backlight power control presentation; see LCD model.

The desktop window behaves like a native app on macOS and Windows:

  • It shows the LCD with the touch panel's strip of seven icons below it (panel rows 320-359), or the whole BE-300 bezel (View > Show Bezel, or --frame). Both layouts take taps on the icon strip.
  • It is HiDPI-aware and resizes with a locked aspect ratio. Drag the window edges (or the bezel's lower corners), or use View > Zoom 100%-400% (Cmd/Ctrl+1-4), Fit Screen (Cmd/Ctrl+0) and Pixel Accurate.
  • The menu bar (macOS) or window menu (Windows; right-click the bezel) has File (Install App, Save Screenshot, Copy Screen), Device (Rocket, Power, OK, Esc, D-pad, Restart (Cold Boot)), View and Help > Keyboard Shortcuts. Hardware keys: arrows = D-pad, Return = OK, Esc = Esc, Tab = Rocket, F12 = Power. Linux has no menu bar, but the Ctrl shortcuts work.
  • Save Screenshot (Cmd/Ctrl+S) writes a full-resolution PNG of the window to the Desktop. The LCD-only BMP that every run saves in the working directory on exit is unchanged.
  • Drop a .cbea on the window to install it (see Installing apps).
  • Position, zoom, bezel and Pixel Accurate are remembered between runs. --frame / --scale override them for one run. BE300_WINDOW_PREFS sets the preferences file, and an empty value disables it. Set BE300_AUDIO=0 to mute host audio without changing guest-visible hardware state. The separate piezo buzzer's register behavior remains unverified. Touch input coalesces rapid host click events into one guest pen session. BE300_TOUCH_MIN_DWELL_MS sets the minimum guest pen-down time in milliseconds; set it to 0 for direct host timing.

Native cold boot leaves the RTC in the first-boot/default state so WinCE can prompt for date/time like real hardware after battery removal. For interactive application or network testing, add --rtc-host-time to initialize the guest RTC from host local time.

For a bounded smoke test:

cd build-host
gtimeout 60s ./be300 --nand ../ce/restore_images/All_nand_300.bin \
  > cold_stdout.log 2> cold_stderr.log

Exit code 124 from gtimeout is expected for a long-running boot; WinCE does not exit on its own.

Install Applications Offline

be300-install applies Casio .cbea application packages directly to a copy of the NAND image, without a Windows VM or PC Connect session:

./build-host/be300-install \
  --output /tmp/All_nand_300_apps.bin \
  ce/restore_images/All_nand_300.bin \
  path/to/package.cbea
./build-host/be300 --nand /tmp/All_nand_300_apps.bin

The web frontend provides the same operation through its Install apps (.cbea) picker and file-drop support. Package formats, transactional behavior, and current limitations are documented in docs/INSTALLING_APPS.md.

Regression Tests

The asset-free unit suite covers the RTC, PMU, ROM/SPL NAND path, USB function controller, host bridges, launcher configuration, and .cbea installer:

cmake -S . -B build-host -DBUILD_TESTING=ON
cmake --build build-host -j4
ctest --test-dir build-host --output-on-failure -LE local

To register the full cold-boot regression, configure with the local WinCE 3.0 image. The test copies the image before running, verifies that the source hash does not change, and checks the serial milestones through the Casio shell:

cmake -S . -B build-host \
  -DBUILD_TESTING=ON \
  -DBE300_TEST_NAND="$PWD/ce/restore_images/All_nand_300.bin"
cmake --build build-host -j4
ctest --test-dir build-host --output-on-failure -R cold_boot

Logs and the final screenshot are written under build-host/cold-boot-artifacts/. Public CI intentionally runs only the asset-free suite because the restore image cannot be redistributed.

Secondary Paths

These paths remain implemented for targeted investigation, but they are not the primary regression target:

  • --restore --cf — CompactFlash recovery path using a local NANDWRITER tool
  • --ppsh — WinCE PPSH debug-shell probe path
  • --ne2000 — PCMCIA NE2000 Ethernet card model
  • --xi825 — Z-Com XI-825 wireless CF card with a virtual access point; requires the local vendor driver. See XI-825 setup.
  • --3c589 — 3Com EtherLink III PC Card (a real 3C589D's CIS)
  • --hermes — Lucent/Agere Orinoco or WaveLAN Gold (Hermes) PC Card with the same virtual access point (a real Orinoco Gold's CIS); --hermes-firmware 6.4 gives the older Agere firmware with no host scan (default 8.72)
  • --jacket — put --ne2000, --3c589 or --hermes in a PCMCIA jacket: Windows CE's socket 1, a second socket controller at 0x0B000000 with card windows at 0x0B200000 (I/O) and 0x0B600000 (attribute memory), which the guest powers and resets (src/hw/jacket.h; glaze-os docs/hardware/PCCARDS.md). Its interrupt reaches GIRQ0 source 6 through 0x0A001B50 bit 3, as on the real machine.
  • --cf-modem <spec> — Rockwell RC56LD CF data modem (the CIS of a real CF56R-BCT-DX card, a 16550 at 3f8h and a Hayes command interpreter). A dialed call connects to a host chardev: tcp:HOST:PORT (e.g. glaze-os tests/ppp_peer.py), pty:auto for a host pppd, unix:/PATH. Dropping DTR hangs up.
  • --cf-gps <file.nmea> — an NMEA GPS CF card (FUNCID serial, a 16550 at 3f8h, the modem's 16550 model; the CIS of a real AmbiCom GPS-CF, "CFGPS", COR at 0x400) replaying the file one second, through each RMC sentence, at a time, looped. Data flows only at 4800 baud, as a SiRF receiver's default. glaze-os tools/mknmea.py writes tracks; tests/gps/track.nmea is one.
  • --rtc-host-time — initialize the guest RTC from host local time
  • --audio — route emulated wave-audio output to SDL
  • --stowaway-keyboard — attach the Targus/Think Outside serial keyboard dock
  • --serial0-bridge / --serial1-bridge — expose either emulated UART to a host TCP, Unix-socket, or PTY chardev
  • --pcconnect-bridge — bridge the dock cable to a host chardev for real PC Connect, carrying serial bytes by default or usbredir packets with --pcconnect-dock usb-sync
  • --trace, --log-mmio, --mmio-coverage, --detect-stall — diagnostic options for controlled investigations

Run ./be300 --help for the current option list.

Reference Material

Primary hardware and boot references:

The WinCE 3.0 restore image reference is ce/restore_images/RESTORE_IMAGES.md.

Development Notes

  • Keep guest binaries unmodified. Fix hardware emulation bugs instead of patching WinCE, pre-seeding RAM, or forcing handoff state.
  • Commit only functional changes or maintained documentation. Do not commit one-off probes, local logs, extracted modules, screenshots, or build outputs.
  • Use the Docker mips-dev environment for MIPS and WinCE binary analysis:
docker compose build mips-dev
docker compose run --rm mips-dev /bin/bash

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages