Skip to content
MZPicoPublic

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

2 watching

Forks

Latest commit

 

History

135 Commits

Folders and files

Repository files navigation

Prince of Persia for the Sharp MZ-800

A fan port of Prince of Persia (Jordan Mechner, Brøderbund, 1989) to the Sharp MZ-800: the complete game, all 14 levels with the guards, the traps, the shadow, the cutscenes, the music and the sound, in 320x200 with 16 colours, plus a two-player sword duel hidden behind the title. It is a non-commercial fan project by MZPico; it is not affiliated with or endorsed by the owners of Prince of Persia.

The title screen

The first level: the dungeon A palace room
A sword fight with a guard The two-player duel

What you need

  • A Sharp MZ-800 with the 32 KB VRAM extension (MZ-1R25). The game uses the 320x200 16-colour mode, which needs the extension; without it the loading screen says so and stops.

  • A RAM disk of 512 KB or more, either

    • a chip-based RAM disk card: real RAM chips, such as an MZ-1R18-style card, with close to zero wait states, or
    • an MZPico card with firmware v0.6.0 or later, set up as in Running on an MZPico (its copy-on-write RAM disk; a plain file-backed one is too slow), or
    • a Unicard mk3b with an STM32F429 and firmware 0.35 or later, set up as in Running on a Unicard.

    The game keeps its graphics there; a bigger RAM disk only makes it faster, the game is the same:

    RAM disk What you get
    512 KB the minimum: the whole game, the slowest
    1 MB (or 2 MB) recommended: the prince's and the level's guards' animation frames are prepared in the RAM disk while the game loads (about 7 s), so walking and fighting are smoother
    4 MB or more the fastest: more of the prince's frames, every guard's frames and the trap pictures are prepared and kept (about 20 s on the loading screen)

    The loading screen measures the RAM disk's speed in wait states (WS: 0 is a card without waits); one slower than 15 WS stops the start with RAM DISK TOO SLOW: ... WS.

  • A floppy drive, or the MZPico's or the Unicard's floppy emulation, for the disk image (one 320 KB disk). The game also saves your progress to it.

  • Optional: an MZPico card, for the duel over the network, as the floppy drive and as the RAM disk.

  • A joystick is optional: the keyboard plays everything.

Getting the game

Download a disk image from the Releases page:

  • pop800-X.Y.Z.dsk for an MZ-1R18-style RAM disk: a chip-based card, the MZPico Deluxe's [ramdisk], a Unicard, or an emulator;
  • pop800-picord-X.Y.Z.dsk for the MZPico's own [pico_rd] RAM disk (every MZPico board, the Frugal one too; real cards only, the emulators have no pico_rd).

The game is the same on both, and the two duel each other over the network. Each disk comes with its checksum file (.sha256); sha256sum -c pop800-X.Y.Z.dsk.sha256 checks your download.

To try it first without a machine, play it in the browser on mzpico.com (an emulated MZ-800 with a 4 MB RAM disk).

Starting it

  1. Put the disk image in the first floppy drive: write it to a real disk, or select it in the MZPico's or the Unicard's floppy emulation.
  2. Switch on (or reset) the MZ-800 and let it boot from the floppy. Keep the disk writable if you want to save games.
  3. The loading screen shows:
    • the game's version under the title (V0.2.0);
    • a progress bar while the game loads (LOADING...) and, with 1 MB or more, while it prepares the animation frames (PREPARING SPRITES);
    • the RAM disk it found and its speed in wait states (RAM DISK 1M, 0 WS; 0 WS is a card without waits);
    • whether an MZPico network is there for the duel (NETWORK: MZPICO NET (DUEL: CTRL+D) or NETWORK: NONE (DUEL: CTRL+D)).
  4. Then the title and the intro play. Press any key, or the joystick's fire, for a new game; Ctrl+L continues your saved game.

The loading screen

Running on an MZPico

An MZPico card can be the game's RAM disk, no RAM disk card needed, with firmware v0.6.0 or later (MZPico/MZPico-firmware releases). The RAM disk runs in copy-on-write mode: an image in the card's flash, the changes in a RAM pool.

Updating a 2 MB board (every genuine Pico and Pico W) to v0.6.0 erases its flash: volume, which grows to make room for a 1 MB RAM disk: copy your files off over USB first, flash mzpico_format_2m_v0.6.0.uf2, then the firmware, and copy them back (the v0.6.0 release notes have the steps). Do not use v0.5.0's Pico W images: they overwrite the flash volume.

Add one of these to mzpico.ini:

  • Deluxe board, with pop800-X.Y.Z.dsk:
    [ramdisk]
    image=flash:/POP800RD.IMG
    mode=cow
    size=1M
  • Any board (Frugal too), with pop800-picord-X.Y.Z.dsk:
    [pico_rd]
    image=flash:/POP800RD.IMG
    mode=cow
    size=1M

Let the card create the image (do not copy one in, and delete POP800RD.IMG when you change the size): on the first boots it learns which parts of the RAM disk to keep in flash, so the first one or two starts pause for a few seconds while loading; after that the card runs at about 3 to 4 wait states (RAM DISK 1M, 3 WS), close to a chip card. A card has one copy-on-write RAM disk: use one of the two sections, not both. The size: 1M on a 2 MB board (the recommended tier, as for a chip card; 512K also works and leaves more of flash: free), 4M on the Frugal 16 MB board (the fastest tier). The firmware's README has every option.

Running on a Unicard

A Unicard mk3b can be the game's RAM disk and floppy drive, with firmware 0.35 or later (download): it keeps a cache of the RAM disk in the card's RAM. The cache needs the card's STM32F429 (most mk3b cards have one; check the chip); on an STM32F407 the RAM disk is too slow and the start stops with RAM DISK TOO SLOW.

  • RAM disk: a file on the card's SD card, selected in the Unicard Manager (/unicard/ramdisc.cfg); the file's size is the RAM disk's size. Use a 1 MB file and keep it writable. The cache is on by default (RAMDISC_CACHE = WB in the [MZ800] section of /unicard/unicard.cfg); with OFF the game is too slow to start.
  • Floppy: pop800-X.Y.Z.dsk in the Unicard's floppy emulation, drive A.

The loading screen then shows about RAM DISK 1M, 3 WS; while playing, the game waits for the SD card about 0.5 % of the time.

Playing in an emulator

The game runs in mz800emu; the version the project tests with is MZPico's (MZPico/mz800emu, branch wasm). The settings it needs:

  • RAM disk: MZ-1R18 connected, size 1 MB (or 512 KB, 2, 4, 8 or 16 MB; MZPico's build adds 2, 4 and 8 MB), no extra wait states. This emulates a chip-based card.
  • VRAM: mz800emu emulates the 32 KB VRAM extension; nothing to set.
  • Floppy: insert the disk image into drive FD0, then reset. Work on a copy: the emulator writes the disk back (saved games), and it may do so even when the disk is marked read-only.
  • Joystick (optional): mz800emu can play joystick 1 on the PC's numeric keypad.

emu/mz800emu.ini in this repository is a complete configuration with these settings.

Controls

Action Keyboard Joystick
Run, jump, climb, crouch cursor keys stick (port 1)
The action button: careful step, hang on, pick up, drink, strike with the sword SHIFT fire
Show the time left SPACE
Pause (any key resumes) BREAK
Restart the level Ctrl+A, or ENTER after you die
Save the game (levels 3 to 13) Ctrl+G
Load the saved game Ctrl+L on the title
Sound on / off Ctrl+S
Back to the title Ctrl+R (or Ctrl+Q)
Show the version Ctrl+V
Skip to the next level (levels 1 to 3 only, as in the original) SHIFT+L

You have 60 minutes to rescue the princess, as in the original; the clock runs only while you play.

The duel: a two-player easter egg

Press Ctrl+D on the title for a sword duel: the prince against a second prince in a blue suit (the screenshot at the top, with the round and the score on the bottom line). Every round the prince starts on the right and the blue prince on the left, facing each other.

  • Without an MZPico the local duel starts at once, both players on one MZ-800.
  • With an MZPico you choose: 1 LOCAL, 2 HOST or 3 JOIN (BREAK goes back to the title).
Player 1 (the prince) Player 2 (the blue prince)
Move cursor keys, or joystick 1 W A S D, or joystick 2
Button (draw, strike) / or ?, or joystick 1's fire Q, or joystick 2's fire

After a match: ENTER for a rematch, BREAK back to the title.

The swords are drawn and put away by hand:

  • Every round starts with both swords sheathed.
  • Draw: press the button alone while standing. If your opponent is behind you, you turn round and draw in one go. With a potion right in front of you, the button drinks it first; press again to draw.
  • Put the sword away: down, en garde. Nothing puts it away for you, not even winning a round.
  • The button with a direction works as in the game (with forward: the careful step).
  • A player hit while the sword is sheathed dies at once.

The rules in short:

  • Each round both players have 3 hit points; the first to win 3 rounds (best of 5) takes the match. A round where both fall at once is a draw and is played again.
  • When both strike at the same moment, the blades clash and nobody is hurt.
  • Every match is in a random level, every round in a random room of it, dungeon or palace.
  • Every other round a pair of potions stands on the floor, one for each player: healing, a longer life, or poison. Stand in front of yours with the sword sheathed and press the button to drink it.
  • Some rooms have spikes, and every third round some are added. Running, jumping or falling onto them kills as in the game. Careful steps over raised spikes are safe, and so is everything with the sword drawn; only other moves onto raised spikes with the sword sheathed (a turn, a hop) cost a hit point.

Over the network (MZPico, through the MZPico NET service; each MZ-800 needs its own RAM disk: a card, or the MZPico's own as in Running on an MZPico): one player picks 2 HOST and gets a four-letter ROOM CODE; the other picks 3 JOIN, types the code (DEL deletes) and presses ENTER. The match starts when both are in. Each machine plays its own fighter with either set of keys (SHIFT fires too); the host is the prince. Both machines must boot the same release (either of its disks: the MZ-1R18 one and the MZPico pico_rd one duel each other; OTHER VERSION otherwise). Other messages: NO SUCH ROOM (a wrong code), NO LINK (no connection to the service), OTHER PLAYER LEFT, CONNECTION LOST, and DESYNC (a bug: please report it). In emulators the network duel needs a relay running on your PC: see docs/duel-net-howto.md.

Known limitations

  • Room changes pause for a moment (one to two seconds) while the next room is drawn, and busy rooms (several traps and gates moving) run slower than the rest of the game.
  • The game runs slower than the PC original in general, and a smaller RAM disk is slower again (see above).
  • Not in this port: the original's attract-mode demo and the hall of fame.
  • The RAM disk must be fast, with few wait states: the game reads its graphics from it all the time. A file-backed RAM disk without copy-on-write or a cache (the MZPico's plain file mode, a Unicard with RAMDISC_CACHE = OFF or an STM32F407) is too slow. The boot measures the RAM disk's speed and stops with RAM DISK TOO SLOW: ... WS (and the measured figures) when it is slower than 15 wait states.
  • A 256 KB RAM disk is not enough.

For developers

The port is written in Z80 assembly and built on a PC from the original DOS game's data files, which you must supply yourself: they are not in this repository. Start with docs/DEVELOPING.md (the source layout, the requirements, the make targets and the tests). More:

Credits and licence

  • Prince of Persia was created by Jordan Mechner and published by Brøderbund in 1989. The graphics, levels, sound and music used here come from the original DOS version (1.3); Prince of Persia and its content remain the property of their owners.
  • The game logic follows SDLPoP by David Nagy and its contributors, the open-source reconstruction of the DOS game. Sergey Potapov's ZX Spectrum 128K port was studied early on.
  • The music in the title and the cutscenes is arranged from the Sega Master System version's soundtrack.
  • The network duel uses the MZPico NET service of BomberNet.
  • The MZ-800 port: MZPico.

The port's own code, tools and documentation are licensed under the GNU General Public License v3.0 (LICENSE); parts derived from SDLPoP are GPL-3 as SDLPoP is. The licence does not cover the original game: its data is not in this repository, and the build reads it from the developer's own copy.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages