Tamagotchi CDROM in a v86 Browser VM
README.md

Tamagotchi CD-ROM (1997), preserved in a browser #

The US English Windows 95 release of Tamagotchi CD-ROM (Bandai Digital Entertainment / 7th Level, 1997) installed on a Windows 95 disk and running in v86. The result is a static web bundle that opens directly into the game's "hatch your new Tamagotchi?" prompt.

This is a private preservation copy. Windows 95 is © Microsoft and the game is © Bandai, so don't publish dist/ or the tarball.

Run #

scripts/serve.sh            # serves dist/ on http://localhost:8000/

Or unpack tamagotchi-v86-*.tar.zst anywhere and serve its dist/ with any static file server. The bundle doesn't use Range requests, and file:// won't work.

URL Behaviour
/ restore the saved state, already in the game
/?fresh=1 cold-boot Win95; the game autostarts from the StartUp group
/?setup=1 cold boot plus authoring buttons (save state, export disk writes)

Progress is not persisted: Reset or a page reload goes back to the saved state.

Inputs (see SHA256SUMS) #

File Source
Tamagotchi_CD-ROM_Windows_95_Bandai_Digital_Entertainment_1997.iso archive.org item of the same name (download.sh). The canonical disc.
TAMAGOTCHI.ISO the same ISO with about 600 KB of zero padding appended; redundant
Tamagotchi CD-ROM (Japan).{zip,bin,cue} No-Intro Pippin set. Pure HFS (Mac/Pippin) with no Windows content, so not usable here; a SheepShaver/MAME project would need it
vendor/windows95/windows95_5.0.1_amd64.deb felixrieseberg/windows95 v5.0.1
vendor/windows95.img images/windows95.img from that release (1 GiB, FAT32, VBMOUSE absolute-mouse driver preinstalled)
vendor/v86/* (committed) libv86.js, v86.wasm, SeaBIOS/VGABIOS from the same release

The v86 build has to come from windows95 rather than upstream. Its fork carries the IDE shared-register fix, without which Win95 hangs at the splash screen on disks larger than about 535 MiB. It also has the VMware absolute-pointer backdoor that the preinstalled VBMOUSE driver uses.

Build from a fresh checkout #

scripts/fetch-deps.sh   # game ISO (archive.org) + vendor/windows95.img (windows95 deb)
scripts/build.sh        # recreates build/tama-c.img, assembles dist/
scripts/serve.sh

Two authored files are committed under assets/:

  • tama-c.blocks.zst: every 256-byte block where the installed disk differs from the stock windows95 disk. Applying it to the stock disk reproduces build/tama-c.img byte for byte.
  • tama-state.bin.zst: the saved state, which only works with that exact disk.

Re-author from scratch #

Only needed to redo the install itself, e.g. on a different base disk.

scripts/fetch-deps.sh
scripts/build.sh --base          # dist/ with the stock disk, no state
scripts/serve.sh &
# open http://localhost:8000/?setup=1, dismiss the boot dialogs, then
#   Start > Run > D:\SETUP.EXE, take all defaults (incl. the screen saver)
#   at "Restart now?" answer Yes; v86 hangs on the reset after Windows
#   has flushed the disk, which is expected
#   press "Export disk writes" -> build/install.blocks
scripts/post-install.sh build/install.blocks   # -> build/tama-c.img
scripts/build.sh --no-state
# open /?setup=1 again; Win95 boots into the game. Wait for the hatch
# prompt, press "Save state", then:
zstd -19 tama-state.bin -o assets/tama-state.bin.zst
scripts/diff-blocks.py vendor/windows95.img build/tama-c.img assets/tama-c.blocks.zst
scripts/build.sh                 # final dist/
# update SHA256SUMS for build/tama-c.img and assets/*
tar --zstd -cf tamagotchi-v86-$(date +%F).tar.zst dist/

scripts/cdp.mjs drives the page in headless Chromium over the DevTools protocol, with commands for screenshots, clicks, typing and pulling the state or disk writes. The whole setup above was done with it:

chromium --headless=new --remote-debugging-port=9222 --window-size=1100,820 about:blank &
scripts/cdp.mjs open 'http://localhost:8000/?setup=1'
scripts/cdp.mjs shot /tmp/s.png; scripts/cdp.mjs click 30 755; scripts/cdp.mjs type 'D:\SETUP.EXE\n'
scripts/cdp.mjs dump build/install.blocks 'tama.exportDiskWrites(emulator)'
scripts/cdp.mjs dump build/tama-state.bin 'emulator.save_state()'

The disk and the state are a matched pair, so rebuilding either means rebuilding both. scripts/verify.sh checks everything present against SHA256SUMS.

Notes #

  • The game needs the CD in the drive to hatch a new Tamagotchi, so the ISO is always attached as the secondary-IDE CD-ROM (D:).
  • The disk is served as 1024 × 1 MiB zstd chunks (disk/tama-c-<start>-<end>.img.zst, v86 use_parts), which brings 1 GiB down to about 270 MB.
  • VBMOUSE reads the VMware backdoor queue one packet behind the PS/2 IRQ. Real mice don't notice, but cdp.mjs jiggles the pointer after clicks.