Spectrum pages
Home -> Spectrum -> Haunted House

_____________________________________________________________________

Haunted House by Jenny Tyler and Les Howarth

The Usborne book Write Your Own Adventure Programs for Your Microcomputer used Haunted House as a worked example for constructing an adventure game in BASIC. This page provides the original BASIC programs, plus a couple of ports.

Original listing

The original program was supplied in Microsoft BASIC format. The version here was typed in and tested under Disk BASIC on an IBM XT.

[BASIC] haunted.bas (9k) is the original listing.

[BASIC] hauntx.bas (10k) includes the additional SAVE, LOAD and QUIT functions.

[BASIC] hauntx.tzx (10k) is a TZX file for Cassette BASIC on the IBM 5150 PC. Connect the 5150's "EAR" connector to a more recent PC's loudspeaker socket, and use a utility such as PlayTZX to play back the TZX file. The BASIC command to load from tape is LOAD "CAS1:"

The listing may require some tweaks, small or large, for Microsoft-compatible BASICs on other computers. For example:

Spectrum version

The Spectrum version was created with zmakebas. It includes the optional SAVE / LOAD / QUIT commands, but not the optional BEEP commands (page 28 of the book).

[BASIC] hauntzx.bas (11k) is the listing in text form.

[TAP] hauntzx.tap (11k) is the game as a ready-to-run tape file.

ZX81 version

The ZX81 version is reduced in size (36 rooms as opposed to 64).

The original version needs to be initialised with the object locations at the start of each game. Type the following numbers, pressing ENTER after each: 30 24 21 32 5 8 16 26 2 13 14 36 18 11 35 3 27 6

If the game is broken into, it must be restarted with GOTO 10 rather than RUN.

[ZX81] haunted.p (12k)

This version, which I have not tested particularly thoroughly, adds an additional array of initial object positions, so does not need to be manually initialised.

[ZX81] hauntx.p (12k)

C

This is a simplistic port of the original BASIC version to ANSI C (with a little conditional code for clearing the screen under DOS).

[C source] haunted.c (27k) is the C source code.

[TAP] haunted.exe (19k) is a compiled version for DOS (it will also run on 32-bit versions of Windows; for 64-bit versions, you will need to use a virtualisation or emulation solution such as DOSBox).

Inform

This is an adaptation of Haunted House to the Inform 6 adventure-writing language. It takes a somewhat looser approach than the other ports on this page; instead of trying to replicate the exact structure and behaviour of the BASIC original, it takes full advantage of the Inform library and its support for doors, vehicles, containers, supporters and so on.

[Inform] haunted.inf (46k)

[Inform] haunted.z5 (93k)

Play online with Parchment

=====================================================================

John Elliott 2014-06-10